If the FileAssociation component for some reason does not work for you, or you need to run it as administrator for all users without elevating your application privileges, an Inno Setup Script may fit your needs best. To add icons to file associations, and register them for use with a program, use the FileAssociation component. The result may be, for example, interleaved output to a file which is probably not what you intended.įor details of code signing Windows executables to avoid your end users receiving warnings that the publisher of the software is "unknown" when attempting to run an executable, see Code Signing for Windows. That second click will be put into the Windows message queue and a second identical task will now be triggered. sprinkling Application.ProcessMessages through your code like fairy dust may sound like a good idea, but consider what happens if your application is still busy with the task and an impatient user clicks that button a second time. However, even in that case, it might be better to simply alert the user to the extended processing time (eg when compressing a file) by using the appropriate "busy" cursor or a progress bar.īeware of unintended consequences. Instead, you should be calling another function or procedure which may require the use of Application.ProcessMessages to ensure the application continues to respond to events and does not appear to have locked up. Of course, event handlers should probably not be doing any significant processing. So you would only need to call it in your event handler where there is a significant delay doing some processing. Note that Application.ProcessMessages is called by the LCL automatically after every message (eg after every event like OnClick). Any other sleep is almost always bad programming. This has a special meaning and means relinquish time slice. Application.ProcessMessages handles all waiting system messages in an application's message queue. You have to give the OS the time to process its message queue. In such a case use Application.ProcessMessages instead of sleep(n) which is blocking. Windows has a messaging system (see ) and uses messages to "talk" to all running applications. See Daemons and Services Using sleep(n) and Application.ProcessMessages Lazarus and FPC make writing Windows services easy. You can use ActiveX controls in recent Lazarus versions. See possible Windows implementation ActiveX controls Importtl.exe C:\Windows\system32\oleacc.dllĪnd it will generate the type library pascal unit Accessibility_1_1_TLB.pas in the folder where it is.Ĭreating a library which exports a COM objectĪvailable since Windows 7. You can call it, for example for MSAA like this: A pre-compiled binary of this program can be found here: Use the program importtl which is located in Free Pascal in fpc/utils/importtl. The first step to import and use a COM library is generating the interface definitions from it. See Windows specific issues for more details.ĬOM Programming Importing and using a COM library While you can use Windows-only code (such as the windows unit), with a little care you can often prepare for cross-platform use (e.g. Writing cross-platform code that works on Windows Omitting this option creates a console application (same as passing -WC). No console is shown, writeln and readln are not possible, you will get File not open errors. See Project Options / Compiler Options / Linking / Target OS Specific options / Win32 GUI application. The most prominent options are the -W flags. Inno Setup Usage - How to create setup files with File Association support.Windows Icon - How to design your icon with the right sizes.Aero Glass - How to apply Aero Glass effect in a Lazarus Form on Windows 7.High DPI - How to make your application DPI-aware on Windows 7.10.3 FPC 2.6.x/Lazarus warning (Missing support for SEH).10.2 Lazarus 32 bit: External SIGSEGV exception when running with debugging.10.1 A referral was returned from the server.9.16 Retrieving hard disk serial number etc.9.15 Task bar icon not showing on secondary monitor.9.9 Getting special folders (My documents, Desktop, local application data, etc).9.4 Using Windows native wininet for web retrieval.9.3 Showing Memory, Disk Space Information.9.2 Ensure only a single instance can run.7 Using sleep(n) and Application.ProcessMessages.4.2 Creating a library which exports a COM object.3 Writing cross-platform code that works on Windows.
0 Comments
Leave a Reply. |