Hi,

does anybody know how to show a new window? (not a dialog) (I succeeded in dialog but I want a window :)). I use standard prototypes 'WinMain' and 'WndProc'. I have a button on a main window and when I click on it I want the button to show the new window.

Any help appreciated,
sF
Posted on 2002-01-28 15:41:39 by stealthFIGHTER
CreateWindow and CreateWindowEx is what you are looking for.
Posted on 2002-01-28 16:32:05 by CodeLover

CreateWindow and CreateWindowEx is what you are looking for.


I know, I know, but I don't know where to put the code with the CreateWindowEx function (WM_CREATE/WM_COMMAND) and don't know how the code should look like.

sF
Posted on 2002-01-28 17:09:43 by stealthFIGHTER
It would help if you posted some more details about exactly what you want to achieve. You can put CreateWindow* code anywhere, but that doesn't necessarily help you....
Posted on 2002-01-28 18:09:38 by sluggy
A control of class BUTTON will, when clicked, send a WM_COMMAND with a control ID and a notification code BN_CLICKED.

Each control ought to have a unique ID number defined in the hMenu argument of the call that creates the control. If you are actually using a dialog proc for your main window, define the control ID in the resource file (as well as in your program).

; in WM_COMMAND handler

mov eax, wParam
.if eax == (IDC_BUTTON_CTL_ID or (BN_CLICKED << 16))
; Create your new window
.endif
Posted on 2002-01-28 19:27:52 by tank
http://spiff.tripnet.se/~iczelion/tut9.html

And also tut 10, 11 and more. It might come in handy :)
Posted on 2002-01-28 23:28:22 by prana
Well, I want to create my own "About" window. What I want to do is similar to Iczelion's example (tut.) no. 11/1 (but I don't want to show a dialog window).

I use this code:


.if uMsg == WM_COMMAND
mov eax, wParam
.if eax == 87 ;my "About" button
CreateWindowEx, don't know how to continue... :(
.endif


Here is an example how I create a button:


INVOKE CreateWindowEx, 0, addr ButtClass, addr szAboutText,
WS_CHILD or WS_VISIBLE,
95, 175, 65, 20, hWin, 87, hInstance, 0


And I don't know what to change to show the new window (not a button).

sF
Posted on 2002-01-29 15:51:25 by stealthFIGHTER
The conventional way is to create a new window class, using a WNDCLASSEX, and use RegisterClassEx to register it at the same time you register your main window class.

You'll need a new WndProc to go with the new window.

In your CreateWindowEx invoke, use the window class you created and the window type (WS_OVERLAPPED, or WS_POPUP, or WS_CHILD). Do not use WS_CHILD if you want the box to work like a normal About box.

You'll either need to make a menu resource, or create a menu with the menu functions to use the hMenu argument. Otherwise, use NULL.

Everything else is pretty much the same. Read the docs and experiment!
Posted on 2002-01-29 20:40:02 by tank