Good question! The easiest and working method is to call GetVolumeInformation on a CD-Drive, this function call will fail if no valid volume information is available for a drive this means CD-ROM drive should be valid one too! So our next job is to find out whether we have a CD-Drive in our machine, for […]
Continue reading…
Monthly Archives: May 2008
Visual studio shortcuts that I use
Some useful shortcuts for development in different versions of visual studio for VC++… Ctrl + Alt + L – Solution explorer Alt + Enter – Properties window Works even on open files in the IDE. Lists the properties of files like full path etc. If in resource editor then it shows properties of controls Ctrl […]
Continue reading…
Download files from Internet through code
Use URLDownloadToFile. An article on this API is here, with a demo application.
Continue reading…
Performance measurement functions in windows
Sometimes it does become mandatory to check performance or log performance of certain function calls, something like mini profiling. There are some functions in windows which helps us in doing this. I will rank them in their importance… QueryPerformanceCounter GetTickCount clock Of these three QueryPerformanceCounter is the best providing us with a high resolution counter. […]
Continue reading…
Quick way to hash data using WinAPI
Use HashData. // Usage: [sourcecode language=’cpp’]// A magical string to get hashed TCHAR szDataToHash[] = _T( “Oobolooblahblah, abracadabra, ooboboblablah, get this string hashed” ); // Determines the size of hash value to be returned. DWORD HashVal = 0; // Hash now HRESULT hRes = HashData( LPBYTE( szDataToHash ), // Data to hash, can be of […]
Continue reading…
Move a window to foreground!
There are times when this feature is quite an annoyance! You are typing in a password and immediately this window pops up in front of you with the focus set on an edit control, so everybody sees your password as you are not aware that another window has come up. A good example would be […]
Continue reading…
Set/Get mouse double click time
To set double click time use SetDoubleClickTime Set time to zero to switch to default time of 500 milliseconds E.g. [sourcecode language=’cpp’]// If call succeeds return value is non zero VERIFY( SetDoubleClickTime( 200 )); // Set double click time to 200 milliseconds[/sourcecode] To get double click time use GetDoubleClickTime Returns double click time in milliseconds […]
Continue reading…
SystemParametersInfo
SystemParametersInfo is a powerful function which does and retrieves whole lot of things related to windows general behavior for eg: turning on and off certain features like mouse trails which we normally do via control panel->main.cpl Look up MSDN for more information on SystemParametersInfo. I’ll just show a demo on how to turn on and […]
Continue reading…