Delphi chkdsk ShellExecute GetPort GetDriveType Windows API TPicture GetTempPath GetProcAddress InetIsOffline kbdevent How to show application property dialog TOSVERSIONINFO PostMessage DragQueryFile ShowWindow ShellAPI DelTree BrowseDialog CreateProcess SHELL32.DLL GetFileType Get Available System Memory Information Get System Information Get System Memory Status BM_SetImage Get Windows OS Version GetClassName GetClipboardData BlockInput FILE_TYPE_UNKNOWN AuxSetVolume AuxGetVolume GetStdHandle AssignFile GetWinVersion HasFormat Hide from Taskbar How To Install Device Driver? How to know country by remote IP address Animation Dialog DRIVE_FIXED Device Driver Installation Method Disable ALT+TAB Disable CTRL+ALT+DEL DefaultInstall Disable Keyboard Disable Mouse DOS Command Capture Drive Type Detection DRIVE_CDROM FlashWindow DRIVE_RAMDISK CreateDirectory Close Application Extract Filenames from Clipboard 시스템 메모리 정보 가져오기 ClipboardTxtToFile FILE_TYPE_DISK FILE_TYPE_PIPE

CHKDSK.ZIP

Window flashing   (created at Sep 25, 2007)   36  

Flashing a window means changing the appearance of its caption bar as if the window were changing from inactive to active status, or vice versa.Typically, a window is flashed to inform the user that the window requires attention but that it does not curren...

How to use TTF Font Without Installing   (created at Sep 25, 2007)   39  

Here's how to use a TTF (true type font) in your Delphi application without having to install it in Windows:1. In the OnCreate event for the main form in your Delphi application call the AddFontResource API function. The AddFontResource function adds the f...

How to show window contents while dragging   (created at Sep 25, 2007)   53  

Here's how to enable or disable the "Show window contents while dragging" Windows fature from Delphi code://To Show window contents while dragging:SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 1, nil, 0) ;//To disable this option call the function:SystemPar...

How to save text from Clipboard to a file   (created at Sep 25, 2007)   42  

If you want to save the text data contained in the Clipboard to a text file on a disk, use the next code:{Usage:ClipboardTxtToFile(c:dircliptext.txt)}uses Clipbrd;function ClipboardTxtToFile         (sFileTXT : string) : boolean;va...

How to send char as message to another application   (created at Sep 25, 2007)   42  

The following code is used to insert a character into another application - Notepad.procedure TForm1.Button1Click(Sender: TObject) ;var g,d:integer;begin  {Find the main window of the Application}  g:=FindWindow('Notepad',nil) ;  {Find the w...

Get system info (free memory, etc)   (created at Sep 19, 2007)   42  

Put a TMemo (Memo1) and a TButton (Button1) in your form. Put this code into OnClick of Button1:procedure TForm1.Button1Click(Sender: TObject) ; var MemoryStatus: TMemoryStatus; begin   Memo1.Lines.Clear;   MemoryStatus.dwLength := SizeOf(MemoryS...

How to restrict mouse movement   (created at Sep 25, 2007)   33  

Here's how to restrict the mouse movement to a form and release this restriction after a click on a form:procedure TForm1.FormCreate(Sender: TObject) ;var r : TRect;begin   

List Devices (LPT, COM ports, ...)   (created at Sep 25, 2007)   63  

The following procedure will list all the devices on your computer. You can then extract the com ports and printer ports by looking for the 'COM' and 'LPT' characters in the list.Add a Memo and a Button and place this code in the OnClick of a button...proc...

How to know whether the font is TrueTypeFont or not   (created at Sep 25, 2007)   48  

Given a font's name (such as Arial,Verdana, Times New Roman, etc), function returns a boolean value indicating whether the font is or isn't a True Type font.function IsTrueTypeFont(FontName : string):boolean;const  PITCH_MASK: byte = $0F;var  TxM...

How to track a user's idle time   (created at Sep 25, 2007)   50  

Suppose you have a data-critical type of application where you would not want a non-authored user to work with the data. Such an application could automatically log out the current user if no user activity has taken place in a lengthy time.To track a user'...

How to remove your application from TaskBar   (created at Sep 25, 2007)   43  

If you need to hide your application from the Windows TaskBar, you can use the following trick:procedure TForm1.FormCreate(Sender: TObject) ;begin   ShowWindow(Application.Handle, SW_HIDE) ;   SetWindowLong(Application.Handle, GWL_EXSTY...

How to play sounds on the PC Speaker ?   (created at Sep 19, 2007)   69  

Here's an example of how to play simple sounds on the PC speaker procedure SetPort(address, Value: Word) ; var   bValue: Byte; begin   bValue := trunc(Value and 255) ;   asm     mov dx, address     mov al, bValue   &...

How to install an INF file using Delphi ?   (created at Sep 19, 2007)   46  

If you need to install an "inf" file using Delphi, you could use the next code: { Usage:   InstallINF('C:XYZ.inf', 0) ; } uses   ShellAPI; function InstallINF(const PathName: string; hParent: HWND): Boolean; var   instance: HINST; begin &nbs...

How to determine the output of a console application ?   (created at Sep 19, 2007)   38  

When you write a console mode application (no GUI), the output by default goes to the screen, but this can be overridden by the process starting the app (see: How to capture the output from a console mode application).Use the code below to find where the o...

Get text from the control at pos x,y on screen   (created at Sep 19, 2007)   99  

This form has 3 labels and a timer component:unit unit1; interface uses   Windows, Messages, SysUtils, Classes, Graphics,   Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type   TForm1 = class(TForm)     Timer1: TTimer;    ...

Get dimensions of usable space on monitor (work area)   (created at Sep 19, 2007)   52  

If you need to find the dimensions of user's screen in pixels, after subtracting any space occupied by the task bar and any tool bars that sit on the desktop, use the WorkAreaHeight adnd WorkAreaWidth properties of the TScreen object. The following code de...

How to Get Filenames from Clipboard ?   (created at Sep 19, 2007)   711  

"If I use the Windows Explorer to copy a file, how can I use the paste function in my application?" This code retrieves the filenames from the clipboard to a memo component. Drop a memo and a button on a form and set the OnClick of a button to: uses  ...

How to Get Windows OS Version ?   (created at Sep 19, 2007)   36  

Here's how to get the Windows version from Delphi code:type TWinVersion = (wvUnknown, wvWin95, wvWin98, wvWin98SE, wvWinNT, wvWinME, wvWin2000, wvWinXP, wvWinVista) ; ... function GetWinVersion: TWinVersion; var   osVerInfo: TOSVersionInfo;   maj...

Get Windows Temp directory   (created at Sep 19, 2007)   67  

thePath holds the Windows Temp directory:var   lng: DWORD;   thePath: string; begin   SetLength(thePath, MAX_PATH) ;   lng := GetTempPath(MAX_PATH, PChar(thePath)) ;   SetLength(thePath, lng) ; end;

Disable ALT+TAB, CTRL+ESC, CTRL+ALT+DEL   (created at Sep 18, 2007)   99  

If you wish to disable those key combinations while your application is running call SystemKeys. When you call SystemKeys, if Disable is True, the keys will be disabled, False otherwise.Note: the code does NOT work under Win NT systems (XP, 2000)procedure ...

Display Standard Windows Properties dialog   (created at Sep 18, 2007)   644  

Here's the code that will display the standard Windows Properties dialog for a specified file (object) name.Usage:ShowProperties(Application.Handle, 'c:autoexec.bat')Here's the function source.function ShowProperties(hWndOwner: HWND; const FileName: string...

Disable Mouse and Keyboard from Delphi Code   (created at Sep 18, 2007)   60  

The BlockInput API function blocks keyboard and mouse input events from reaching applications. Place a Button (name: "Button1") on a form (name: "Form1") and use this code for the button's OnClick event handler. Once you click the button your mouse and key...

Detecting Drive Types   (created at Sep 18, 2007)   96  

Here's how to get the types of drives on your computer:

Detecting and preventing Windows shut down   (created at Sep 18, 2007)   74  

When Windows is about to shut down, it sends a WM_QueryEndSession to all open applications. To detect (and prevent shutdown) , we must define a message handler to this message. Put this definition on the private section of the main form:procedure WMQueryEn...

Copying Group of Files using Delphi with Standard Animation Dialog (SHFileOperation)   (created at Sep 18, 2007)   74  

The following example demonstrates using the SHFileOperation function to copy a group of files and display a progress dialog. You can also use the following flags to delete, move and rename a group of files. FO_COPY FO_DELETE FO_MOVE FO_RENAME Note: The bu...

How to Activate/Deactivate the Screen Saver   (created at Sep 18, 2007)   77  

Sometimes you want to deactivate the current screensaver when performing some very long process. You can use this function to activate or deactivate the screensaver. Pass True to activate it, or False to deactivate it.function ActivateScreenSaver(Activate:...

Controling sound volume from code   (created at Sep 18, 2007)   71  

Here's an example of controling the sound volume from Delphi: uses MMSystem; type   TVolumeRec = record     case Integer of       0: (LongVolume: Longint) ;       1: (LeftVolume, RightVolume : Word) ;   &nb...

How to Close Another Application by Windows Caption   (created at Sep 18, 2007)   63  

To programmatically close another application, send to the application a WM_QUIT message. "Window caption" is the caption of the window that you are sending the message to. Usage: if not KillApp('Window caption') then ShowMessage('App not closed') ;Here's ...

How to Change the Windows Start button bitmap   (created at Sep 18, 2007)   36  

Here's how to chane the bitmap on the Windows Start button:{We'll need several global variables}var    Form1: TForm1;    StartButton : hWnd;    OldBitmap : THandle;    NewImage : TPicture;...{Now, we put this code in...

How to capture the output from a DOS (command/console) Window   (created at Sep 18, 2007)   35  

The example runs 'chkdsk.exe c:' and displays the output to Memo1.Put a TMemo (Memo1) and a TButton (Button1) on your form. Put this code in the OnCLick event procedure for Button1:procedure TForm1.Button1Click(Sender: TObject) ;  procedure RunDosInMe...


Page: 1  2