Hi guys!
I got a problem in vc++ 2010. I tried a sample program to test the ide. But it compiles successfully without showing any window(which is the desired output). Could you help me debug it?
I am posting my code here!
I got a problem in vc++ 2010. I tried a sample program to test the ide. But it compiles successfully without showing any window(which is the desired output). Could you help me debug it?
I am posting my code here!
#include<Windows.h>
HRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hprevInstance,LPWSTR cmdline,int cmdshow)
{
UNREFERENCED_PARAMETER(hprevInstance);
UNREFERENCED_PARAMETER(cmdline);
HWND hwnd;
MSG msg;
WNDCLASS wc;
wc.hInstance=hInstance;
wc.lpszClassName=TEXT("Window");
wc.style=CS_VREDRAW | CS_HREDRAW;
wc.hCursor=LoadCursor(0,IDC_ARROW);
wc.hbrBackground=GetSysColorBrush(COLOR_3DFACE);
wc.lpfnWndProc=WndProc;
wc.lpszMenuName=NULL;
RegisterClass(&wc);
hwnd=CreateWindow(wc.lpszClassName,TEXT("Test Window"),WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,600,480,0,0,hInstance,0);
ShowWindow(hwnd,cmdshow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
HRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam, LPARAM lparam)
{
switch(msg)
{
case WM_CREATE:
{
break;
}
case WM_LBUTTONDBLCLK:
{
MessageBox(hwnd,TEXT("You are not allowed to double click"),TEXT("Info"),MB_OK);
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
}
return DefWindowProc(hwnd,msg,wparam,lparam);
}
HRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hprevInstance,LPWSTR cmdline,int cmdshow)
{
UNREFERENCED_PARAMETER(hprevInstance);
UNREFERENCED_PARAMETER(cmdline);
HWND hwnd;
MSG msg;
WNDCLASS wc;
wc.hInstance=hInstance;
wc.lpszClassName=TEXT("Window");
wc.style=CS_VREDRAW | CS_HREDRAW;
wc.hCursor=LoadCursor(0,IDC_ARROW);
wc.hbrBackground=GetSysColorBrush(COLOR_3DFACE);
wc.lpfnWndProc=WndProc;
wc.lpszMenuName=NULL;
RegisterClass(&wc);
hwnd=CreateWindow(wc.lpszClassName,TEXT("Test Window"),WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,600,480,0,0,hInstance,0);
ShowWindow(hwnd,cmdshow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
HRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam, LPARAM lparam)
{
switch(msg)
{
case WM_CREATE:
{
break;
}
case WM_LBUTTONDBLCLK:
{
MessageBox(hwnd,TEXT("You are not allowed to double click"),TEXT("Info"),MB_OK);
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
}
return DefWindowProc(hwnd,msg,wparam,lparam);
}