小编Pea*_*lyk的帖子

安装后启动应用程序

我搜索了一下,发现了一些话题

http://wix.sourceforge.net/manual-wix3/run_program_after_install.htm

安装完成后启动应用程序,打开UAC

但是,我不使用任何ui.只需简单的安装!至今

<CustomAction Id="LaunchApp" Directory="INSTALLDIR" ExeCommand="[SystemFolder]cmd.exe /C MyExe.exe" />

<InstallExecuteSequence>
      <RemoveExistingProducts Before="InstallInitialize" /> 
      <Custom Action="LaunchApp" After="InstallFinalize" />
    </InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)

但是当我启动安装程序时,会弹出一个窗口:"请等待Windows配置MyProgram".在它上面只有一个闪烁的光标cmd.exe,当我关闭cmd时,我收到消息:"这个Windows Installer程序包有问题.无法运行此安装完成所需的程序." 虽然计划仍然开放.我怎样才能正确地做到这一点(没有任何UI)?提前致谢!

wix

20
推荐指数
2
解决办法
1万
查看次数

如何在Delphi中发出HTTPS POST请求?

在Delphi中执行HTTPS POST请求的最简单方法是什么?我在发出HTTP POST请求时遇到问题,但是如何使用SSL呢?我已经google了一下,并没有发现任何能够解释得很好的东西.

这是我试过的代码:

procedure TForm1.FormCreate(Sender: TObject);
var
  responseXML:TMemoryStream;
  responseFromServer:string;
begin
  responseXML := TMemoryStream.Create;
  IdSSLIOHandlerSocketOpenSSL1 := TIdSSLIOHandlerSocketOpenSSL.Create(self);
  with idSSLIOHandlerSocketOpenSSL1 do
    begin
      SSLOptions.Method := sslvSSLv2;
      SSLOptions.Mode := sslmUnassigned;
      SSLOptions.VerifyMode := [];
      SSLOptions.VerifyDepth := 0;
      host := '';
    end;

  IdHTTP1 := TIdHTTP.Create(Self);
  with IdHTTP1 do
    begin
      IOHandler := IdSSLIOHandlerSocketOpenSSL1;
      AllowCookies := True;
      ProxyParams.BasicAuthentication := False;
      ProxyParams.ProxyPort := 0;
      Request.ContentLength := -1;
      Request.ContentRangeEnd := 0;
      Request.ContentRangeStart := 0;
      Request.Accept := 'text/html, */*';
      Request.BasicAuthentication := False;
      Request.UserAgent := 'Mozilla/3.0 (compatible; Indy Library)';
      HTTPOptions := …
Run Code Online (Sandbox Code Playgroud)

delphi indy

17
推荐指数
1
解决办法
4万
查看次数

在全屏启动时,应用程序停留在任务栏后面

这是我正在使用的代码:

BorderStyle := bsNone;
WindowState := wsMaximized;
Run Code Online (Sandbox Code Playgroud)

我的问题是应用程序不会覆盖任务栏,而是支持它.

它在运行时切换到全屏时工作正常,但在系统启动时启动应用程序时不起作用.

UPDATE

事实证明,这两条线的效果非常好.它们位于FormShow事件处理程序中.如果我在FormShow结束时断点,应用程序似乎全屏; 我可以通过任务栏看到该应用程序.但是在FormShow之后,应用程序的Top属性会以某种方式发生变化.我没有在代码中更改它 - 值为-20,因此应用程序不再最大化.

有没有办法跟踪更改的位置或时间?

提前致谢!

UPDATE

这篇文章被标记.请不要发布任何答案!谢谢.

delphi

7
推荐指数
1
解决办法
3265
查看次数

更改Listview项目高度

我需要在每个列表项之间腾出更多空间.是否可以在Delphi中更改Listview项目高度?

delphi listview

5
推荐指数
1
解决办法
7472
查看次数

Tidhttp.connectTimeout不工作!

所以我正在使用tidhttp发布帖子请求.当我尝试设置connectTimeout时,无论什么时间段它都没有效果.在我得到例外之前,我仍然等待〜5秒.提前致谢!

delphi indy10

4
推荐指数
1
解决办法
5229
查看次数

仅允许该程序的一个实例时,从系统托盘恢复窗口

好吧,标题很长,应该告诉我面临的问题.

这是最小化图标托盘时的代码:

void MainFormResize(object sender, EventArgs e)
        {
            if (WindowState == FormWindowState.Minimized)
            {
                this.Hide();
                this.ShowInTaskbar = false;
            }
        }
Run Code Online (Sandbox Code Playgroud)

当程序已经打开并且在sys托盘中时,仍然有人想要打开它的另一个实例,那么:

    private static void Main(string[] args)
            {
                bool createdNew = true;
                using (Mutex mutex = new Mutex(true, "IPADcommunicator", out createdNew))
                {
                    if (createdNew)
                    {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        Application.Run(new MainForm());
                    }
                    else
                    {
                        Process current = Process.GetCurrentProcess();
                        foreach (Process process in Process.GetProcessesByName(current.ProcessName))
                        {
                            if (process.Id != current.Id)
                            {
                                IntPtr handle = FindWindow(null,"IPADcommunicator");
                                SetForegroundWindow(handle);
                                ShowWindow(handle,5);

                                break;
                            }
                        }
...
Run Code Online (Sandbox Code Playgroud)

但是,它不能正常工作.主窗口没有恢复.我已经google了很多,并没有找到解决这个问题的方法.提前致谢!

c# winapi

4
推荐指数
1
解决办法
4554
查看次数

在ios应用程序中打开URL

我需要在iOS应用程序中打开带有safari的网页.
有了XE2,就有了iphoneall单元,它暴露了UIApplication.XE4不再使用FPC,所以我不能使用它.
Embarcadero文档 说我只能使用SDK与c ++或使用delphi接口(但仍然,macapi仅用于OSX,而​​不是iOS).那么,似乎UIKit框架没有界面?!
我尝试的另一个解决方案是

_system('open http://www.google.com');
Run Code Online (Sandbox Code Playgroud)

但这完全没有影响!
有没有其他方法可以打开网址,或者我没有运气来完成它?
我知道ios有TWebBrowser组件,但我不想仅仅为了显示网页而采取这种方式.

提前致谢!

delphi ios firemonkey delphi-xe4

4
推荐指数
1
解决办法
2417
查看次数

访问线程中的vcl组件!德尔福

所以,我的目标是在另一个线程中启动一个函数.此外,我需要从新线程访问其他vcl组件.到目前为止,这是我的代码:

procedure TForm1.StartButtonClick(Sender: TObject);
var
thread1: integer;
id1: longword;
begin
   thread1 := beginthread(nil,0,Addr(Tform1.fetchingdata),nil,0,id1);
    closehandle(thread1);
end;

procedure TForm1.FetchingData;
var
  ...
begin
  Idhttp1.IOHandler := IdSSLIOHandlerSocketOpenSSL1;   //<- error
  idhttp1.Request.ContentType := 'application/x-www-form-urlencoded';
Run Code Online (Sandbox Code Playgroud)

我的程序挂起,我收到错误:00154E53模块my.exe中的异常EAccessViolation.模块"my.exe"中地址00554E53的访问冲突.读取地址00000398.

提前致谢.

delphi multithreading

2
推荐指数
2
解决办法
3015
查看次数

将命令直接发送到打印机的正确方法!

好的,我是这样做的:

procedure TMainWindow.btnRawPrintClick(Sender: TObject);
begin
  BeginPrint;
  SendStr(#27#69);
  SendStr('MyData');
  SendStr(#10);
  EndPrint;
end;

procedure TMainWindow.SendStr(Text: String);
var
  i: Integer;
  data : Array of Char;
begin
  for i := 1 to Length(Text) do
  begin
    SetLength(data,i);
    data[Pred(i)] := Text[i];
  end;

  if (PrintRawData(printHandle,
                   data,
                   Length(data)) < 0) then begin
    ShowMessage('PrintRawData Failed');
    EndRawPrintPage(printHandle);
    EndRawPrintJob(printHandle);
    exit;
  end;
end;

procedure TMainWindow.BeginPrint;
begin
  printHandle := StartRawPrintJob('EPSON TM-T70 Receipt','ESDPRT001','Test Document');

  if printHandle < 0 then
  begin
    ShowMessage('StartRawPrintJob Failed!');
    exit;
  end;

  if (StartRawPrintPage(printHandle) < 0) then begin
    ShowMessage('StartRawPrintPage Failed!');
    EndRawPrintJob(printHandle);
    exit; …
Run Code Online (Sandbox Code Playgroud)

printing delphi epson

2
推荐指数
1
解决办法
9989
查看次数

将Custom控件添加到另一个自定义控件

我想要完成的是创建新的触摸键盘.

首先,我创建了从速度按钮派生的按钮.完成,现在我需要创建多个按钮并将它们布局在某处.这是我被卡住了.

我创建了一个新组件,我从TGraphicControl派生(这应该是我的新触摸键盘),但我不知道如何向画布添加组件.我实际上不知道我是否应该将它们添加到画布或其他组件(例如面板)!?!

我的方法好吗?

提前致谢.

delphi custom-controls

1
推荐指数
1
解决办法
694
查看次数

从邮件服务器检索邮件时更改charset!

我目前正在创建一个小邮件客户端,并面临charset的问题.我使用indy的TIdIMAP4组件从邮件服务器检索数据.当我尝试检索邮件正文时,ä,ü等强调字母分别转换为= E4,= FC,因为它使用字符集ISO-8859-1.

内容类型:text/plain; charset ="ISO-8859-1"Content-Transfer-Encoding:quoted-printable

如何让服务器在另一个字符集中发送数据,比如utf-8?什么是这个问题的最佳解决方案?

提前致谢!

delphi indy character-encoding

1
推荐指数
1
解决办法
1081
查看次数

Rijndael加密.第一个角色很怪异

代码我正在使用(XE):

// Encrypt a string and return the Base64 encoded result
function Encrypt(DataToEncrypt: ansistring):ansistring;
const Key: Ansistring = 'keykey';
  KeySize = 32; // 32 bytes = 256 bits
  BlockSize = 16; // 16 bytes = 128 bits
var
  Cipher : TDCP_rijndael;
  Data: ansistring;
  IV: array[0..15] of byte;      // the initialization vector
  i:Integer;
begin
  // Pad Key, IV and Data with zeros as appropriate
  FillChar(IV,Sizeof(IV),0);            // make the IV all zeros

  Data := PadWithZeros(DataToEncrypt,BlockSize);

  for i := 0 to (Length(IV) - …
Run Code Online (Sandbox Code Playgroud)

delphi encryption rijndael delphi-xe

0
推荐指数
1
解决办法
1031
查看次数