c++ api32 dispplayDialog

hallo, C++(ers)

I have a problem after making the main int window.
the I wane whit a pus of a a button display a other window but is don't show up.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
LRESULT CALLBACK DiallogProcedure(HWND hWnd, UINT msg , WPARAM wp , LPARAM lp )
{
    switch (msg)
    {

    case WM_CLOSE:
        DestroyWindow(hWnd);
        break;
    default:
        return DefWindowProc(hWnd, msg, wp, lp);
    }

}


void registerDialogClass(HINSTANCE HInst)
{
    WNDCLASSW dialog = { 0 };

        dialog.hbrBackground = (HBRUSH)COLOR_WINDOW;
        dialog.hCursor = LoadCursor(NULL, IDC_CROSS);
        dialog.hInstance = HInst;
        dialog.lpszClassName = L"myDialogClass";
        dialog.lpfnWndProc = DiallogProcedure;

        RegisterClassW(&dialog);

}


void dispplayDialog(HWND hWnd)
{
    CreateWindowW(L"myDaillogClass", L"Diallog", WS_VISIBLE | WS_OVERLAPPEDWINDOW, 400, 400, 200, 200, hWnd, NULL, NULL, NULL);

}
Last edited on
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
the I wane whit a pus of a a button display a other window but is don't show up

Huh?

1.
Please learn to use code tags, they make reading and commenting on source code MUCH easier.

How to use code tags: http://www.cplusplus.com/articles/jEywvCM9/

There are other tags available.

How to use tags: http://www.cplusplus.com/articles/z13hAqkS/

HINT: you can edit your post and add code tags.

Some formatting & indentation would not hurt either

2. Dialog boxes are specialized WinAPI entities, they are not created and displayed as you would your main window.
https://docs.microsoft.com/en-us/windows/win32/dlgbox/dialog-box-overviews

3. The easiest way to create a dialog box is using a template in a resource script. Creating and using dialog boxes:
http://www.winprog.org/tutorial/dialogs.html

Dialog templates can be created in memory:
https://docs.microsoft.com/en-us/windows/win32/dlgbox/using-dialog-boxes#creating-a-template-in-memory

4. A Message Box is a pre-designed dialog box that is easy to manage and display:
https://docs.microsoft.com/en-us/windows/win32/dlgbox/using-dialog-boxes#displaying-a-message-box
is ok now

the window Class name was not Correctly spelled


1
2
3
4
    hWnd = CreateWindowW(L"myDialogClass", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
        CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
        NULL, NULL, NULL, 0);
Last edited on
Topic archived. No new replies allowed.