Hi,
I want to use CreateWindowEx to create my dialog-boxes. I know that this is normaly done by CreateDialogParam or DialogBox but since my program will support multiple languages that can be loaded from a file, I have to create the dialog-boxes at runtime.

HWND CreateWindowEx(
DWORD dwExStyle,
LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);

call , 0, my_class, 0, WS_VISIBLE + WS_OVERLAPPEDWINDOW + WS_CHILD, 0, 0, 100, 100, , 20, ,0
mov ,eax

my_class is used by all my windows. It sends the messages to a function that filters them by their h_wnd param and passes them on to the real massage functions.

I can see the child-window and it can also be moved, however it's always inactive (grey taskbar). I also realize that my child-window can't be moved beyond the parent_windows' borders. Is there a trick to make the child-window free movable ?

thanks,
gaf
Posted on 2003-10-28 06:44:36 by gaf
just don't use WS_CHILD style in your newly created windows.
Posted on 2003-10-28 11:33:13 by decard

I want to use CreateWindowEx to create my dialog-boxes. I know that this is normaly done by CreateDialogParam or DialogBox but since my program will support multiple languages that can be loaded from a file, I have to create the dialog-boxes at runtime.

Why not compiling the same dialog box templates with different language settings? You can put them in DLL files.

Also you can assing an ID to every static box and set it's text on runtime. Make sure to leave enough room for the text in every language. This is the method used by most programs I've seen.

Anyway, as for the WS_CHILD problem, of course it's possible to create windows with that style. (decard, I hope you were joking! :grin: ). It's just that WS_OVERLAPPED (or WS_OVERLAPPEDWINDOW for that matter) cannot be used together with WS_CHILD, as they have opposite meanings. Read the API docs on CreateWindow carefully, specially the descriptions of WS_CHILD, WS_POPUP and WS_OVERLAPPED. Also taking a look at the actual values this equates have is helpful. :)

EDIT: Also remember that dialog boxes are a special kind of window. They can't be created with CreateWindowEx, you must use the dialog functions to do this.

BTW, happy birthday gaf! :alright:
Posted on 2003-10-28 18:38:12 by QvasiModo
Hi,

Are you sure you want WS_CHILD ? If I understand well what you are trying to achieve, you need WS_POPUP.

Regards,

akyprian
Posted on 2003-10-29 07:31:45 by akyprian
sorry, I didn't relly understood the topic ....:grin:
Posted on 2003-10-29 10:06:01 by decard
Hi,
first of all thanks for your answers.

I searched the m$ database and found this page http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/aboutwindow.asp wich says that there's a special WndClass for dialogboxes. The problem is that this class can only be used by the system itself.

I'll now use a templat to create the d-box and add the text at runtime as QvasiModo proposed.

Thanks to all,
gaf
Posted on 2003-10-31 06:20:58 by gaf