To retrieve ComboBox information!

We know that a combobox is a combination of different controls. Well now the question is there an API to get ample information on these controls nested in a combo?  The answer is yes, use GetComboBoxInfo. Takes a COMBOBOXINFO pointer as parameter and on return will hold necessary information… Usage: [sourcecode language=’cpp’]COMBOBOXINFO CmbInfo = { […]
Continue reading…

 

How to get mouse movement history?

The GetMouseMovePointsEx function retrieves a history of up to 64 previous coordinates of the mouse or pen. Here is a demo that replays our mouse movements… [sourcecode language=’cpp’]void ReplayMouseMovements() {    // Current cursor position    POINT ptCurrentPoint = { 0 };    GetCursorPos( &ptCurrentPoint );    // Record marker, mouse co-ordinates prior(and including) to […]
Continue reading…

 

Changing the tab order of a control at runtime!

Follow these steps(Just a demo)… Add two buttons to a fresh dialog in a sequencial order, IDC_BUTTON1 and IDC_BUTTON2 Goto OnInitDialog(you are not restricted to OnInitDialog, you can also do this on a button click) and paste this line of code [sourcecode language=’cpp’]GetDlgItem( IDC_BUTTON1 )->SetWindowPos(GetDlgItem( IDC_BUTTON2 ), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | […]
Continue reading…

 

Dynamically determining the base class of a class using templates

Well nearly dynamically! When working on the ATL COM framework I came across a piece of framework code which makes a template parameter as the base class of a class which looked quite useful to me. Here is a demo… [sourcecode language=’cpp’]template class SomeWnd : public BaseClass {     public: LRESULT WindowProc(UINT uMessage, WPARAM wParam, […]
Continue reading…

 

WinAPI Wrapper for GetOpenFileName

Shell32.dll provides an undocumented API that wraps around a call to GetOpenFileName called GetFileNameFromBrowse we’ll have to get the call pointer using GetProcAddress, quite easy to use! 😉 Well I can see the documentation in MSDN but can’t find the prototype in any of the header file in my SDK folder, so till then GetProcAddress is […]
Continue reading…

 

Is a path shared?

ShGetFileInfo helps us in finding out whether a given path is shared or not. A wrapper function is given below… [sourcecode language=’cpp’]bool IsPathShared( LPCTSTR lpctszPath_i ) {    SHFILEINFO shFileInfo = { 0 };    return ( SHGetFileInfo( lpctszPath_i, 0, &shFileInfo, sizeof( shFileInfo ), SHGFI_ATTRIBUTES ) && ( shFileInfo.dwAttributes & SFGAO_SHARE ) == SFGAO_SHARE ); […]
Continue reading…

 

Is a given file shortcut to some other file?

ShGetFileInfo is the API that helps in finding out whether a file is a shortcut to some other file. Here is wrapper function… [sourcecode language=’cpp’]bool IsShortcut( LPCTSTR lpctszPath_i ) { SHFILEINFO shFileInfo = { 0 }; return (( SHGetFileInfo( lpctszPath_i, 0, &shFileInfo, sizeof( shFileInfo ), SHGFI_ATTRIBUTES )) && ( shFileInfo.dwAttributes & SFGAO_LINK ) == SFGAO_LINK […]
Continue reading…