Neither getting error nor output in a basic program - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Neither getting error nor output in a basic program

AnoopAnandAnoopAnand Posts: 2Member
#include
char hot[]="anoop";
HWND hWnd;
LRESULT CALLBACK WndProc(HWND hWnd,UINT m, WPARAM wParam, LPARAM lParam)
{
switch(m)
{

case WM_CLOSE:
DestroyWindow(hWnd);
break;
case WM_QUIT:
PostQuitMessage(0);
break;
default:
DefWindowProc(hWnd,m,wParam,lParam);
break;
}
return 0;
}
int _stdcall WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
{
MSG m;
WNDCLASSEX w;
w.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
w.cbClsExtra=0;
w.cbSize = sizeof(WNDCLASSEX);
w.cbWndExtra=0;
w.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
w.hCursor=LoadCursor(NULL,IDC_ARROW);
w.hIcon=LoadIcon(NULL,IDI_APPLICATION);
w.hInstance=hInstance;
w.lpfnWndProc=WndProc;
w.lpszClassName=hot;
w.lpszMenuName=NULL;
w.style=0;


RegisterClassEx(&w);

hWnd=CreateWindowEx(WS_EX_WINDOWEDGE,hot,"Whats Going On",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);

ShowWindow(hWnd,nShowCmd);

while(GetMessage(&m,NULL,0,0)>0)
{
TranslateMessage(&m);
DispatchMessage(&m);
}
return(m.wParam);
}






Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    [code]
    : #include
    : char hot[]="anoop";
    : HWND hWnd;
    : LRESULT CALLBACK WndProc(HWND hWnd,UINT m, WPARAM wParam, LPARAM
    : lParam)
    : {
    : switch(m)
    : {
    :
    : case WM_CLOSE:
    : DestroyWindow(hWnd);
    : break;
    : case WM_QUIT:
    : PostQuitMessage(0);
    : break;
    : default:
    : [color=Red]return[/color] DefWindowProc(hWnd,m,wParam,lParam);
    : [color=Red]//break;[/color]
    : }
    : return 0;
    : }
    : int _stdcall WinMain(HINSTANCE hInstance,HINSTANCE
    : hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
    : {
    : MSG m;
    : WNDCLASSEX w;
    : w.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
    : w.cbClsExtra=0;
    : w.cbSize = sizeof(WNDCLASSEX);
    : w.cbWndExtra=0;
    : w.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
    : w.hCursor=LoadCursor(NULL,IDC_ARROW);
    : w.hIcon=LoadIcon(NULL,IDI_APPLICATION);
    : w.hInstance=hInstance;
    : w.lpfnWndProc=WndProc;
    : w.lpszClassName=hot;
    : w.lpszMenuName=NULL;
    : w.style=0;
    :
    :
    : RegisterClassEx(&w);
    :
    : hWnd=CreateWindowEx(WS_EX_WINDOWEDGE,hot,"Whats Going
    : On",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_
    : USEDEFAULT,NULL,NULL,hInstance,NULL);
    :
    : ShowWindow(hWnd,nShowCmd);
    :
    : while(GetMessage(&m,NULL,0,0)>0)
    : {
    : TranslateMessage(&m);
    : DispatchMessage(&m);
    : }
    : return(m.wParam);
    : }
    [/code]
Sign In or Register to comment.