Delphi

How can I get the Name of the Program associated with a file extension using Delphi?

柔情痞子 提交于 2020-01-01 02:44:58
问题 I need to get the name of the program currently associated with a file extension for the current user. If you right-click on a file and select properties, then what I need is the program name that is to the right of the "Opens with" line. e.g. For ".xls", I want to be able to get the answer "Microsoft Office Excel", or whatever program the user has as their default program to open .xls files. I have determined it's not as easy as just going into HKEY_CLASSES_ROOT and picking it out, since it

Change icon for a Delphi console application

梦想与她 提交于 2020-01-01 02:35:15
问题 How do I change the program icon for a Delphi console application? The application settings is greyed in a console application. Bye. 回答1: According to a July 2007 blog article by Nibu Thomas, there seems to be a SetConsoleIcon WinAPI function. Alternatively just put the icon in a resource file. Windows should use the first icon it encounters in the application's resources as the application icon. 回答2: If the option to change the icon is disabled, then it is because you have deleted or

Writing a string to a TFileStream in Delphi 2010

烈酒焚心 提交于 2020-01-01 01:59:09
问题 I have Delphi 2007 code that looks like this: procedure WriteString(Stream: TFileStream; var SourceBuffer: PChar; s: string); begin StrPCopy(SourceBuffer,s); Stream.Write(SourceBuffer[0], StrLen(SourceBuffer)); end; I call it like this: var SourceBuffer : PChar; MyFile: TFileStream; .... SourceBuffer := StrAlloc(1024); MyFile := TFileStream.Create('MyFile.txt',fmCreate); WriteString(MyFile,SourceBuffer,'Some Text'); .... This worked in Delphi 2007, but it gives me a lot of junk characters in

Peter Below's Threaded Splash Screen and Modal Dialogs

ぐ巨炮叔叔 提交于 2020-01-01 00:53:06
问题 I'm using Peter Below's PBThreadedSplashForm to display during application startup. It gets updated as various databases are opened during the creation of the data module (just before the main form is created). The problem is that we have a check for the existence of certain things that is done during the creation of the data module. If any of those items are missing, a modal dialog is shown so that either the item can be created or the application closed. (The missing items are typically

Export a global symbol from a Delphi DLL

拥有回忆 提交于 2019-12-31 22:38:12
问题 I'm trying to create a Gecko 2.0-compatible DLL in Delphi. Previously (pre-Gecko 2.0) the DLL needed to export a NSGetModule() function. This worked flawlessly. Starting with Firefox 4, my DLL is getting loaded (I have verified this though a breakpoint in my initialization section), but my NSGetModule() function does not get called anymore. This is the designed behavior because starting with Gecko 2.0 (Firefox 4), a binary component is not supposed to export a NSGetModule() function: https:/

How to paint on a Canvas with Transparency and Opacity?

≯℡__Kan透↙ 提交于 2019-12-31 22:32:53
问题 Overview From the GR32 library, I am using TImgView32 to render a grid which will be my transparent background like so: Placed inside the TImgView32 I have a regular TImage, where I will be drawing onto the canvas, something like this: Task What I would like to achieve is the ability to set the opacity of the brush, allowing further possibilities for image editing in my program. Rather than have one flat color been drawn, setting the opacity of the brush allows different levels of color depth

Free a TThread either automatically or manually

柔情痞子 提交于 2019-12-31 22:27:10
问题 I have a main thread and a separate thread in my program. If the separate thread finishes before the main thread, it should free itself automatically. If the main thread finishes first, it should free the separate thread. I know about FreeOnTerminate, and I've read that you have to be careful using it. My question is, is the following code correct? procedure TMyThread.Execute; begin ... Do some processing Synchronize(ThreadFinished); if Terminated then exit; FreeOnTerminate := true; end;

Delphi GUI Design Specifications and Guidelines [closed]

烂漫一生 提交于 2019-12-31 22:26:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I was looking for a way to standardize my applications layout to boost my productivity since I am wasting too much time positioning visual elements on every form and dialog. I started looking around and found on MSDN Since Delphi VCL Designer use Pixels and all component Height and width are in pixels. I like to

Delphi GUI Design Specifications and Guidelines [closed]

北城以北 提交于 2019-12-31 22:25:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I was looking for a way to standardize my applications layout to boost my productivity since I am wasting too much time positioning visual elements on every form and dialog. I started looking around and found on MSDN Since Delphi VCL Designer use Pixels and all component Height and width are in pixels. I like to

Move() to Insert/Delete item(s) from a dynamic array of string

戏子无情 提交于 2019-12-31 21:54:29
问题 Using System.Move() to insert/delete item(s) from an array of string is not as easy as insert/delete it from other array of simple data types. The problem is ... string is reference counted in Delphi. Using Move() on reference-counted data types needs deeper knowledge on internal compiler behaviour. Can someone here explain the needed steps for me to achieve that, or better with some snippet codes, or direct me to a good reference on the internet? Oh, Please don't tell me to use the "lazy-but