Click to See Complete Forum and Search --> : Working with resource templates


Efitap
May 25th, 2006, 02:28 AM
I've created a win32 application, and successfully created a status bar at the bottom of it. Modal dialogs are not a problem either, I've made a login dialog box with little effort, as well as the standard about dialog box.

Thing is, in all that white area, I would like to include a couple of dialog resources. They're allready designed and saved in my project. A Treeview with a couple of textboxes and buttons on the left side of the application, and a listbox with a few sliders on the right side.

Now - question is. If I understand win32 correctly, I just need to figure out the syntax to add and position these two "forms" on my main application's painting area. I need help with this. If I understand it correctly, these should all be just dumb windows that get their own HWND so I can identify their messages with later on.

So, boiling down - this should be easy to answer:


HWND hTreeView = CreateWindowEx( 0, MAKEINTRESOURCE( IDD_TREE_TEST ), NULL, WS_CHILD | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hWnd, 0, hInst, NULL );


Is this proper syntax for placing my resource template named IDD_TREE_TEST on my main window? I cannot see it anywhere on my app. Is there somehting else I need to do in order to view it?

kkez
May 25th, 2006, 06:10 AM
I would rather use CreateDialog, which uses CreateWindowEx but does some other things for you, like sending a WM_INITDIALOG (instead of a WM_CREATE msg) and WM_SETFONT messages. Of course you need to specify a procedure for each dialog.
Then, all the resource dialogs should use WS_CHILD and one dialog that uses WS_VISIBLE, which is the first that gets displayed. CreateDialog just like CreateWindowEx returns a HWND, so you can do the same things you were doing with CreateWindowEx.

PS: i suppose you have more than one dialog to display (one at a time), if not why do you need this?