diff --git a/redo/windows/resources.rc b/redo/windows/resources.rc index 64b0e5f1..2470c797 100644 --- a/redo/windows/resources.rc +++ b/redo/windows/resources.rc @@ -1,14 +1,15 @@ // 30 may 2015 //TODO#include "winapi.h" #include +#include "resources.h" // this is a UTF-8 file #pragma code_page(65001) -// this is the dialog template used +// this is the dialog template used by tab pages; see windows/tabpage.c for details rcTabPageDialog DIALOGEX 0, 0, 100, 100 STYLE WS_CHILD | WS_VISIBLE -// TODO EXSTYLE WS_EX_CONTROLPARENT +EXSTYLE WS_EX_CONTROLPARENT BEGIN // nothing END diff --git a/redo/windows/tabpage.c b/redo/windows/tabpage.c index eb6e4272..89320f38 100644 --- a/redo/windows/tabpage.c +++ b/redo/windows/tabpage.c @@ -55,6 +55,14 @@ static void tabPageResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, uiFreeSizing(dchild); } +// dummy dialog function; see below for details +INT_PTR CALLBACK dlgproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (uMsg == WM_INITDIALOG) + return TRUE; + return FALSE; +} + uiControl *newTabPage(uiControl *child) { struct tabPage *t; @@ -62,11 +70,11 @@ uiControl *newTabPage(uiControl *child) t = (struct tabPage *) uiWindowsNewSingleHWNDControl(tabPageType()); - t->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CONTROLPARENT, - WC_DIALOG, L"", - 0, - hInstance, NULL, - FALSE); + // unfortunately this needs to be a proper dialog for EnableThemeDialogTexture() to work; CreateWindowExW() won't suffice + t->hwnd = CreateDialogW(hInstance, MAKEINTRESOURCE(rcTabPageDialog), + utilWindow, dlgproc); + if (t->hwnd == NULL) + logLastError("error creating tab page in newTabPage()"); // TODO figure out why this is not working hr = EnableThemeDialogTexture(t->hwnd, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB);