delphi-2007

What is the best way to autostart an action after OnShow event?

折月煮酒 提交于 2019-11-30 13:50:37
问题 I have a small application that most of the time have an action behind a Start-button that should be triggered from the commandline parameter /AUTORUN. If that parameter is missing the user could also press it manually. My question is where should I place this check for commandline so when it is given the GUI is still updated. The current solution is this, but the GUI is not updated until the action is finished. procedure TfrmMainForm.FormShow(Sender: TObject); begin if FindCmdLineSwitch(

How do I get TAnimate's Common AVIs to work on Vista and Win7?

天大地大妈咪最大 提交于 2019-11-30 11:13:49
I have a Delphi 2007 application that has a TAnimate control with a FindFile Common AVI. It works perfectly when the application is run on Windows XP, but nothing ever appears on Windows 7. I've heard it now requires its own thread, but I am not certain. Does anyone know how to get TAnimate's Common AVI control to work on Windows 7 (or Vista)? You must add the unit ShellAnimations to you project or add the component TShellResources from the Win32 tab of the component palette. (Tested in Windows Vista- Delphi 2007) uses ShellAnimations; this unit adds the following replacement animation

How can I get the tooltips of notification-area icons?

只愿长相守 提交于 2019-11-30 09:55:54
I can enumerate the applications (handle,pid,path) with icons in the notification area, and I can control the position of the icons, but I can't get the tooltip. How can I enumerate systray icons including the tooltips? Here is my method tested with windows xp and delphi 2010 if you are using a version of delphi wich doesn't support unicode make shure you convert the strings read to ansi uses CommCtrl; function TForm1.GetIconsCount: Integer; begin Result := SendMessage(FindTrayToolbar, TB_BUTTONCOUNT, 0, 0); end; procedure TForm1.Button1Click(Sender: TObject); begin ListTips; end; function

Removing the namespace from SOAP request

两盒软妹~` 提交于 2019-11-30 08:59:49
I have imported a WSDL and use it to send a SOAP request. It looks like this: <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <Calculate xmlns="urn:xx.WSDL.xxxxxWebService"> <ContractdocumentIn> <AL> ...More XML... The problem is the xmlns="urn:xx.WSDL.xxxxxWebService" part in the Calculate element. The web service cannot accept this. The web service doesn't like namespaces like this... Using SoapUI I found this request to work

What is the best way to autostart an action after OnShow event?

房东的猫 提交于 2019-11-30 08:37:42
I have a small application that most of the time have an action behind a Start-button that should be triggered from the commandline parameter /AUTORUN. If that parameter is missing the user could also press it manually. My question is where should I place this check for commandline so when it is given the GUI is still updated. The current solution is this, but the GUI is not updated until the action is finished. procedure TfrmMainForm.FormShow(Sender: TObject); begin if FindCmdLineSwitch('AUTORUN') then btnStart.Click; end; Post yourself a message from your OnShow event handler. This will be

How do I insert 800000 records into an MS Access table?

假如想象 提交于 2019-11-30 07:40:56
问题 I need to insert 800000 records into an MS Access table. I am using Delphi 2007 and the TAdoXxxx components. The table contains some integer fields, one float field and one text field with only one character. There is a primary key on one of the integer fields (which is not autoinc) and two indexes on another integer and the float field. Inserting the data using AdoTable.AppendRecord(...) takes > 10 Minutes which is not acceptable since this is done every time the user starts using a new

How do I copy a form as an image to the clipboard

爷,独闯天下 提交于 2019-11-30 07:06:53
I need to copy a form (Delphi 2007) to the clipboard as an image to paste what the user can see into a word document. The clipboard part is not really a problem. The questions is how to get a bitmap for the form. Searching has turned up multiple options. Call GetFormImage Use the PrintWindow API function that is part of the GDI+ Send a WM_PRINT message Copy the Canvas for the current form using Canvas.CopyRect I also found a component called TExcellentFormPrinter that has a solution that claims to works better than any of these options, but I don't know what method it is using. All of these

Delphi: count number of times a string occurs in another string

杀马特。学长 韩版系。学妹 提交于 2019-11-30 05:59:37
问题 I'm using Delphi 2007 and wonder if there is a simple way of counting the number of times a string occurs in another string. Any builtin function I can use? Examples: "How" occurs once in the string "How are you?" "do" occurs twice in the string "How do you do?" 回答1: function Occurrences(const Substring, Text: string): integer; var offset: integer; begin result := 0; offset := PosEx(Substring, Text, 1); while offset <> 0 do begin inc(result); offset := PosEx(Substring, Text, offset + length

How do I determine if a unit has been compiled into a Delphi program?

痞子三分冷 提交于 2019-11-30 04:58:28
I want to be able to determine if a particular unit has been compiled into a Delphi program, e.g. the unit SomeUnitName is part of some of my programs but not of others. I would like to have a function function IsSomeUnitNameInProgram: boolean; (which is of course not declared in SomeUnitName because in that case it would always be included) that at runtime returns true, if the unit has been compiled into the program, and false, if not. My thoughts so far have gone along the lines of using the jcl debug information (compiled from a detailed map file) which I basically add to all my programs to

How to get information about the computer? [32bit or 64bit]

假如想象 提交于 2019-11-30 04:22:29
问题 How I can get information about Windows OS type? Is it 32bit or 64bit? How I can get this information programatically? 回答1: You need to use GetProcAddress() to check the availability of the IsWow64Process() function at runtime, like so: function Is64BitWindows: boolean; type TIsWow64Process = function(hProcess: THandle; var Wow64Process: BOOL): BOOL; stdcall; var DLLHandle: THandle; pIsWow64Process: TIsWow64Process; IsWow64: BOOL; begin Result := False; DllHandle := LoadLibrary('kernel32.dll'