Click to See Complete Forum and Search --> : Urgent: how to create a configurable dialog box by using mouse click


AceZhou
September 12th, 2003, 01:39 PM
Hi, there:

I am a new guy to Win32 API. Maybe my question sounds a little stupid.

I have built a display window, which use Win32 graphic API for graphic rendering. Now I need to create a configurable dialog box by using mouse click. By "configurable", I mean that dialog box will be created based on some information obtained from the mouse event, such as coordinates. But I have 2 problems:

1. in the WinProc function, inside the WM_LBUTTONDOWN message section. I use "DialogBox()" function call to generate the dialog box. I have a resource file built by using VC++ 6.0. Is it right way? Do I need to use "GetModuleHandle" function call first to generate hInstance before "DialogBox"? But it doesn't work. When I click the mouse left button. Nothing comes up.

2 in most of tutorials I read, diglog box generation highly depend on the resource file and is invoked by commands, processed in WM_COMMAND section. Are there any other ways to create and configure the dialog box? For example, by mouse clicking, I can have the coordinates. Now I want to create a dialog box, inside which there are a check box that use the coordinates as the caption name.

Thanks a lot! I am waiting online.:confused:

joscollin
September 13th, 2003, 03:10 AM
Hi,
Copy & paste the following code in corresponding switch cases
WM_CREATE:
hInst=((LPCREATESTRUCT) lParam)->hInstance;//hInst is a static variable.


WM_LBUTTONDOWN:
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hwnd, (DLGPROC) NULL);//to handle dialog messages specify a proc name instead of NULL


The dialog will not display without specifying program instance;