Tag: WinAPI

  • Creating a Tabbed Dialog using the Windows API

    An example demonstrating how to create and display a tab common control using WinAPI (Win32) C++ programming.

    Much credit needs to go to Ken Fitlike’s excellent WinAPI site, from which I orginally learned how to do stuff like this. I don’t think the site has been updated for a number of years but it contains a ton of useful material on showing you how to create various things using the WinAPI.

    All that is required to create a Tabbed Dialog is some small modifications to the Simple Window example: the WndProc function handles WM_CREATE and WM_SIZE messages in addition to WM_DESTROY:

    LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
    {
    	switch (uMsg)
    	{
    		case WM_CREATE:
    		{
    			return OnCreate(hwnd,reinterpret_cast<CREATESTRUCT*>(lParam));
    		}
    		case WM_DESTROY:
    		{
    			OnDestroy(hwnd);
    			return 0;
    		}
    		case WM_SIZE:
    		{
    			OnSize(hwnd,LOWORD(lParam),HIWORD(lParam),static_cast<UINT>(wParam));
    			return 0;
    		}
    		default:
    			return DefWindowProc(hwnd,uMsg,wParam,lParam);  
    	}
    }
    

    (more…)