Windows Api Function Snippets


'The following code snippet displays the "Shut Down Windows" dialog. 'Is uses undocumented API function in shell32.dll

We can use the Windows API function GetDriveType() to test if the drive is a CD-ROM drive then use the Windows API function GetVolumeInformation() to test if the VolumeName is 'Audio CD'.

We can use the Windows API function GetDriveType() to test if the drive is a CD-ROM drive then use the Windows API function GetVolumeInformation() to test if the VolumeName is 'Audio CD'.

23 January, 2013   

Adjusted for daylight saving or standard time as appropriate.

It's an unfortunate necessity that you need to write different code for windows sometimes or at the very least load different libraries since there is no fork(), etc. This is how you can tell.

Shows how to focus a control in a Windows Form. If you are working with Web forms it is very simple, you just use "WebControl.Focus()" but this does not work for Windows Forms.

19 June, 2012   

Adjusts the brightness of a color by a specified amount in range -255..255.

06 July, 2013   

Draws angled text on a canvas at position X,Y.

28 March, 2011   

When you are writing dynamic link libraries and need to control the loading and unloading of a DLL, or if you want to initialize your DLL when it is loaded, you can have a function called DllMain do your initialization. Windows calls the DllMain function of a DLL in four instances: 1) When a process attaches the DLL 2) When a thread attaches...

24 August, 2011   

When you are writing dynamic link libraries and need to control the loading and unloading of a DLL, or if you want to initialize your DLL when it is loaded, you can have a function called DllMain do your initialization. Windows calls the DllMain function of a DLL in four instances: 1) When a process attaches the DLL 2) When a thread attaches...

03 January, 2013   

Choose a color scheme as found in the Display control panel applet

Many applications, such as CuteFTP and Outlook Express, allows you to enter a password and use it when it is needed. However, if you forget your password, you cannot see it, because it's hidden behind asterisks ('****') characters. The following code snippet scans all windows on the screen and reveals the passwords behind the asterisks...

Here's how to invoke a click on a Windows Start button from code.

Delphi snippet details dynamically calling windows apis with encryption.

10 December, 2013   

VB.Net code for Fullscreen

13 December, 2011   

You can use to find and replace text in a variable. This script created by Bruce Phillips, one of the leading posters at MacScripter.

This tip shows how to extract the associated icon and draw it into a small area of the form (e.g. Notepad icon)

You can use a url shortener with Twitter such as tinyurl.com

01 June, 2013   

How to Embed code for Windows Media

16 January, 2013   

Example for adding items into combo by using Win32 API. Written by Nir Sofer