Code:
// Includes
#include <windows.h>
#include "menu.h"
// Function Declarations
LRESULT CALLBACK
WndProc( HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam );
// WinMain
int WINAPI
WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int iCmdShow )
{
WNDCLASS wc;
WNDCLASS tb;
HWND hWnd;
HDC hDC;
MSG msg;
BOOL bQuit = FALSE;
// register window class
wc.style = CS_OWNDC;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)GetStockObject( GRAY_BRUSH );
wc.lpszMenuName = "MAIN";
wc.lpszClassName = "Main";
RegisterClass( &wc );
//register tool box
tb.style = CS_OWNDC;
tb.lpfnWndProc = WndProc;
tb.cbClsExtra = 0;
tb.cbWndExtra = 0;
tb.hInstance = hInstance;
tb.hIcon = LoadIcon( NULL, IDI_APPLICATION );
tb.hCursor = LoadCursor( NULL, IDC_ARROW );
tb.hbrBackground = (HBRUSH)GetStockObject( LTGRAY_BRUSH );
tb.lpszMenuName = NULL;
tb.lpszClassName = "ToolBox";
RegisterClass( &tb );
// create main window
hWnd = CreateWindow(
"Main", "IGM | Insomniac Game Maker",
WS_TILEDWINDOW | WS_POPUPWINDOW | WS_VISIBLE,
0, 0, 800, 570,
NULL, NULL, hInstance, NULL );
//create tool box
HWND tool_box;
tool_box = CreateWindow(
"ToolBox", "Tools",
WS_CHILD | WS_BORDER | WS_VISIBLE,
592, 0, 200, 516,
hWnd, NULL, hInstance, NULL );
//create buttons
HWND button;
button = CreateWindow("BUTTON", "Sprites", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 616, 40, 64, 24, hWnd,(HMENU) 10, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE), NULL);
button = CreateWindow("BUTTON", "Objects", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 706, 40, 64, 24, hWnd,(HMENU) 20, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE), NULL);
BOOL EnableWindow(HWND button, BOOL bEnable);
// program main loop
while ( !bQuit ) {
// check for messages
if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) {
// handle or dispatch messages
if ( msg.message == WM_QUIT ) {
bQuit = TRUE;
} else {
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
}
// destroy the window explicitly
DestroyWindow( hWnd );
return msg.wParam;
}
// Window Procedure
LRESULT CALLBACK
WndProc( HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam )
{
switch ( message ) {
case WM_CREATE:
return 0;
case WM_CLOSE:
PostQuitMessage( 0 );
return 0;
case WM_DESTROY:
return 0;
case WM_KEYDOWN:
switch ( wParam ) {
case VK_ESCAPE:
PostQuitMessage( 0 );
return 0;
}
return 0;
default:
return DefWindowProc( hWnd,
message, wParam, lParam );
}
}
thanks ahead of time