Code:
long room = 1;
long _north = 1;
long _south;
BOOL CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_NORTH:
room = _north;
break;
case IDC_SOUTH:
room = _south;
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
char buff[2560] = {0}; // A character string for "filling" with text to print
HDC hdc = NULL; // An hdc to be "filled" if printing text to screen
RECT rect = {0}; // This will be used to "paint the window" to white
// (we need a RECT defining the windows dimensions to do this)
switch(Message)
{
case WM_CREATE:
g_hToolbar = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_TOOLBAR),
hwnd, ToolDlgProc);
if(g_hToolbar != NULL)
{
ShowWindow(g_hToolbar, SW_SHOW);
}
else
{
MessageBox(hwnd, "CreateDialog returned NULL", "Warning!",
MB_OK | MB_ICONINFORMATION);
}
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_FILE_EXIT:
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
case ID_DIALOG_SHOW:
ShowWindow(g_hToolbar, SW_SHOW);
break;
case ID_DIALOG_HIDE:
ShowWindow(g_hToolbar, SW_HIDE);
break;
}
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
DestroyWindow(g_hToolbar);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
while (room != 0) {
if (room == 1) {
hdc = GetDC(hwnd);
GetClientRect(hwnd,&rect);
FillRect(hdc,&rect,(HBRUSH)GetStockObject(WHITE_BRUSH));
sprintf(buff,"Your head...\r\nIt hurts, you can\'t feel your fingers, everything feels so numb, so cold...\r\nYou feel dizzy and sick, you wonder where you are...\r\nAll around you is white, it\'s cold, is this snow? You\'re surrounded by snow!\r\nYou can\'t remember mutch, all you remember is pain, a powerful pain in your back.\r\nWhy do you hurt so much, where you left here? Or are you travelling on your own?\r\nBut now is not the time to ponder, perhaps you should travel somewhere...\r\n");
SetTextColor(hdc,RGB(0,0,0));
TextOut(hdc,0,0,buff,istrlen(buff));
ReleaseDC(hwnd,hdc);
}
room = 0;
}
return 0;
}