help in dialog box

hy everybody
i want to make a dialog box only (with no menu )
i try with this source code
/////////////
#include
#include
#include
#include
#include
#include
#include"resource.h"


long WINAPI WndProc(HWND,UINT,WPARAM,LPARAM);
BOOL CALLBACK DlgProc(HWND hdlg,UINT mid,WPARAM wp,LPARAM lp);

HINSTANCE hInst;
HWND hwnd;
int APIENTRY WinMain(HINSTANCE hi,HINSTANCE pi,LPSTR cline,int scmd)
{ WNDCLASS wc;
hInst=hi;
wc.style= CS_HREDRAW| CS_VREDRAW;
wc.lpszClassName="myclass";
wc.lpfnWndProc=WndProc ;
wc.hbrBackground= (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
wc.hIcon=LoadIcon(NULL,IDI_WINLOGO);
wc.hInstance=hi;
wc.lpszMenuName=NULL;
wc.cbWndExtra=0;
wc.cbClsExtra=0;
RegisterClass(&wc);
//HWND hwnd;
hwnd=CreateWindow("myclass","Prescreen VIEWER",WS_OVERLAPPEDWINDOW,0,0,600,500,NULL,NULL,hi,0);
ShowWindow(hwnd,scmd);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,hwnd,0,0)>0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}

long WINAPI WndProc(HWND hwnd ,UINT mid,WPARAM wp,LPARAM lp)
{
HWND hdlg;
switch(mid)
{

case WM_COMMAND:
switch(wp)
{
case WM_INITDIALOG:

hdlg=CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOG1),hwnd,DlgProc);
//DialogBox(hInst,MAKEINTRESOURCE(IDD_DIALOG1),hwnd,DlgProc,0);

ShowWindow(hdlg,1);
break;



}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:return DefWindowProc(hwnd,mid,wp,lp);
}
return 0;
}


BOOL CALLBACK DlgProc(HWND hdlg,UINT mid,WPARAM wp,LPARAM lp)
{ switch(mid)
{

case WM_CLOSE:
EndDialog(hdlg,0);
break;

case WM_COMMAND:
switch(wp)
{

case IDCANCEL:
EndDialog(hdlg,0);
break;

case IDOK:
MessageBox(hwnd,"hello","hy",MB_OK);
break;

} break;

}
return 0;

}





//////////
but it can not work
can anyone helpme?
many thanks in advance.

Sign In or Register to comment.

Howdy, Stranger!

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

Categories