🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Przemek Biernat Thu, 19 Jan 2017 13:04
Wśietlenie titlebar w oknie child
#308990
Author: Przemek Biernat
Date: Thu, 19 Jan 2017 13:04
89 lines
3882 bytes
Cześć

Mam problem z wyświetleniem okna dialogowego ale nie za pomocą template'ów w resource'ach tylko przez stworzenie okna i wywołanie Show Window. Problem polega na tym że kontrolki w oknie pojawiają się ale nie pojawia się Title Bar oraz tło okna.
Oto mój kod:

dialog_window::dialog_window(
              HWND parent,
              const mystl::mystring& wnd_name,
              unsigned int width,
              unsigned int height
            ):
            _parent(parent),
            _height(height),
            _width(width),
            _cols(5),
            _rows(5),
            _is_show(false)
    {
        _name = wnd_name;

        RECT rect;
        ZeroMemory(&rect, sizeof(rect));
        GetWindowRect(_parent, &rect);

        _y = abs(rect.bottom / 2) - abs(height / 2);
        _x = abs(rect.right / 2) - abs(width / 2);

        char* name = _name.c_str();

        _wndclass.style  = CS_HREDRAW | CS_VREDRAW;
        _wndclass.lpfnWndProc = &dialog_window::dialog_proc;
        _wndclass.cbClsExtra = 0;
        _wndclass.cbWndExtra = 0;
        _wndclass.hInstance  = application::instance()->hinstance();
        _wndclass.hIcon  = NULL;
        _wndclass.hCursor  = LoadCursor(NULL, IDC_ARROW);
        _wndclass.hbrBackground = (HBRUSH)GRAY_BRUSH;
        _wndclass.lpszMenuName = "";
        _wndclass.lpszClassName = name;

        if(RegisterClass(&_wndclass) == 0)
            throw "Throw window not registered";

        this->_handle = CreateWindowEx
        (
         WS_EX_WINDOWEDGE,
         name,
         "Title",
         WS_CAPTION
         | WS_BORDER
         | WS_MAXIMIZEBOX
         | WS_MINIMIZEBOX
         | WS_SIZEBOX
         | WS_VISIBLE
         | WS_TILEDWINDOW,
         _x,
         _y,
         _width,
         _height,
         _parent,
         NULL,
         application::instance()->hinstance(),
         NULL
        );
    }

    WPARAM show()
    {
        _is_show = true;

        MSG   msg;

        ShowWindow(_handle, SW_SHOWDEFAULT);
        UpdateWindow(_handle);

        //RedrawWindow(_handle, NULL, NULL, RDW_FRAME);

        while(GetMessage(&msg, NULL, 0, 0))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

        return msg.wParam;
    }

Pętla komunikatów zwraza False tylko dla komunikatu o numerze 799.
Dla pozostałych message'y  wywoływana jest pusta instrukcja.
Będę wdzięczny za jakąś wskazówkę bo już męczę się z tym od dłuższego czasu a chodzi mi tylko o wyświetlenie standawrdowego title bar'a i stworzenie okna dialogowego bez korzystania z resource.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads