|
-
Aug 5th, 2000, 05:15 PM
#1
I am making a program for my friend in C++ using MSVC++ 6.0.
it is not a MFC(he doesnt want runtimes) app.
how do I get the hWnd of an item in a resource file I have.
it is called
res.rc it has an Icon and a Dialog box,
how would I get the hWnd of this??
I am pretty sure I can show it using ShowWindow, but I just dont know how to get the hWnd,
Thanks,
Dennis Wrenn
-
Aug 6th, 2000, 07:50 AM
#2
Monday Morning Lunatic
When you create the window using CreateDialog or equiv., it returns the hWnd of the window. You need to keep this in a global variable of something like that.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 6th, 2000, 09:36 AM
#3
huh?
what do you mean?
I made the dialog and added it to a resource file,
how do I get the hWnd of that and show it?(the window)
-
Aug 6th, 2000, 12:21 PM
#4
Monday Morning Lunatic
The resource file only stores a template for a window. You have to create a new window for it. MSDN has a full example project, but this is the gist of it: Create a WndProc, with format
Code:
BOOL CALLBACK WndProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
Then, create the dialogue box:
Code:
INT_PTR DialogBox(
HINSTANCE hInstance, // handle to module
LPCTSTR lpTemplate, // dialog box template
HWND hWndParent, // handle to owner window
DLGPROC lpDialogFunc // dialog box procedure
);
For the template, use MAKEINTRESOURCE(IDD_YOUR_DIALOG_ID). Pass the WndProc for the dialogue box procedure.
Here's a full sample project: http://msdn.microsoft.com/library/de...in_generic.exe
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|