Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Code Snippets

Contents:

DOS Stuff

Name Description
Toggling Lights This piece of code shows how to turn on/off drive's led, turn on/off keyboard leds, manipulating cursor in text mode and turn on/off monitor(not by power).

Internet & Networks

Name Description
Download a File from Inet One function call which will download a file from the Inet to a local file.
WinInet API Shows how to download a file over the Inet using the WinInet API.
IP or DN This snippet shows how to convert an IP address or a domain name (given in a char*) to an IP address so it would fit in the SOCKADDR_IN structure...
Connected to Inet Checks whether local computer is connected to the Internet.
Get Local IP Gets the local host IP.
Socket to IP Get the IP a socket connected to.

Miscellaneous

Name Description
Special case integer division A quick way to compute A/(K*2^N) when K is odd and known in advance and A/K is known to be whole.

Win32API

Name Description
Generate MD5 Checksum Using the CryptoAPI to generate an MD5 checksum for any data.
Handle Window Closing Event Shows how to handle the closing event of a window, asks a user if he wants to quit...
Window Draggable by Client Area This tiny snippet will make your window draggable by its client area, just like the dragging by caption.
Applying a Region for a Window Applying a round rectangle region to a normal window (for both clipping/painting).
This is a simple case, you might want to use polygons too.
Drawing a Picture With GDI+ it's very easy to load and draw any image format (BMP, ICON, GIF, JPEG, Exif, PNG, TIFF, WMF, and EMF).
Memory to IStream Sometimes you encounter functions which require an IStream instead of raw data. This snippet will show you how to convert raw data into an IStream.
Query Semaphore Shows how to query the count of aquires left on the Semaphore using an undocumented API.
Access Violation Exception Info Shows how to retrieve the failing address which caused to an AV exception.
Capture Desktop Captures the desktop (snapshot) and stores the canvas into the clipboard.
Full Screen Window Shows how to create a top most full screen window.
Disable Console X Button Shows how to disable the console Close button.
It simply removes it from the menu bar...
Hotkeys Set a system-wide hot key which upon pressing will notify you by sending a message to your window procedure.
CenterWindow Center the given (hWnd) window according to screen's resolution and window's size.
SetDefaultButton Remove the defaultness from the current default button
and set defaultness to the new wanted button in a given hwnd.
Delete File Delete a file, and send it to the Recycle-Bin, so you can undo the operation.
Console for Win32API App You may now add a console window to your (GUI!) application which in there you can show information (debugging/results...).
Alphablended|Transparent Window Shows you how to make your window alphablended or transparent. This technique is faster than regions. For WinNT.
Aux Volume Let your application adjust the master volume.
Raw Sectors Access Reading/Writing raw sectors under WinNt.
Simulate Key Press Simulate key press for a macro system or whatever.
Window from Point Gimme a point and I'll give you a handle.
File Save/Open Dialog Shows how to use the Save/Open file dialog.
Folder Dialog Calling up the folder dialog...
Subclassing Windows Shows how to subclass a window, so you can override its Window Procedure with your own.
Drive Volume Gets the volume of a specified drive.
WM_CTLCOLOR Color your controls...
Icon Changing Change your application's icon in runtime.
C++ Virtual Table Shows how to call a method of a class in C++ using directly the virtual pointers table of the class (Under Visual C++ 6 only).
The Date/Time It's time to get the time/date...
Windows Enumerator Gets the handles(HWND) of all running windows.
Fonts Enumerator Gets all fonts from the system, so you can use anything you like.
WM_USER & WM_COPYDATA An example which shows how to use WM_USER and WM_COPYDATA efficiently(?).
Multimedia Timers Forget about the crappy SetTimer/KillTimer functions, here are more accurate timers routines.
Small Console CRT Colors for text or background, clrscr and gotoxy... for console applications only.
Full Screen Console Send a message to a console application so it switches to full screen mode.
Disable Reboot Don't let the user reboot! Thanks goes to dLightSeeker@hotmail.com for the code snippet.
Font Faces It's time to use fonts in your application...It looks hard but it's not, fortunately.
Clipboard Sets/Gets clipboard's text.
DLL Class Exports This is a way to implement a really small COM like model, check it out! Shows how to "export" classes from DLLs.
Process Priority Changing process' priority so it runs faster...Usually not recommended but know it's possible.
Kondor Trainer This is a smiple trainer for our game Kondor, check it out! It shows how to write/read from proccess's memory.
Open Browser Opens the default browser with a given URL.
Create Blocking Process This shows how to execute a file and wait 'till it's finished.
Shutdown Reboot/shutdown or whatever your computer...
Process Linked Modules Retrieves information about the modules a proccess uses.
Drop Files A two steps guideline which shows how to use this neat feature in your own windows.
Logical Drives Retrieves logical drives and their type...
Simple WAV Player Playing a .wav file (file/resource).
Physical RAM Size Gets the size of the physical RAM in the computer.
Proccess Memory Size Calculates the memory size of a specified process.
onMouseLeave Well this is not HTML, but it's very close to it. Get notified when the mouse leaves a defined rectangular area.
Loading BMP Two ways (file/resource) for loading a .bmp and displaying.
Kill Proccess The bad(?) way to kill a process.
DIB Graphics Use DIB for quick and direct access to a back buffer where you use it for your graphics.
Back Buffer If you sick of the laggy Windows' drawing... then this is the time to use a back buffer for flicker free animation.
Get Application Directory Simply gets the application path.
One Instance Simultaneously A specific implementation using Mutex to limit an application to run only once at a time.
Change Resolution Shows how to change Windows' desktop resolution mode.
Balloon Tooltip This is the way to create a ballon tooltip in your applications.
Lock Workstation This is how you would lock up your workstation in WinNT.
::Top 5 Tutorials::
Embedded Python[116853]
2D Rotated Rectangles Collision Detection[88948]
Keyboard Hook[77243]
UDP[65799]
HTTP Proxy[41188]

::Top 5 Samples::
2D ColDet Rotated Rectangles[11557]
PS2 Mouse Driver[6953]
Wave Format Player[5788]
Reading FAT12[5615]
CodeGuru[5355]


All rights reserved to RageStorm © 2009