Skip to content

Instantly share code, notes, and snippets.

Created December 28, 2017 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4a10643f1cf7d06594781a22f1ff8a5c to your computer and use it in GitHub Desktop.
Save anonymous/4a10643f1cf7d06594781a22f1ff8a5c to your computer and use it in GitHub Desktop.
DialogBoxIndirectParamW (programmatic dialog creation)
// I think I'm getting closer, but I still get 1813: (Resource Type Not Found)
typedef struct ControlData_Wine_s
{
WORD DlgVer;
WORD Signature;
DWORD Style;
DWORD ExStyle;
WORD NbItems;
WORD PosX;
WORD PosY;
WORD SizeX;
WORD SizeY;
WORD Menu;
WORD Class;
LPWSTR TitleText;
// I'm writing this assuming a single control, need to extend to multiple controls
DWORD ControlStyle;
DWORD ControlExStyle;
WORD ControlPosX;
WORD ControlPosY;
WORD ControlSizeX;
WORD ControlSizeY;
WORD ControlID;
WORD ControlTypeCategory;
WORD ControlType;
LPWSTR ControlInitialText;
WORD InitialData;
} ControlData_Wine_t;
ControlData_Wine_t ControlData = { 0 };
ControlData.DlgVer = 0x0000; // not extended
ControlData.Signature = 0x0000; // not extended
ControlData.Style = WS_VISIBLE | WS_CHILD | DS_MODALFRAME;
ControlData.ExStyle = 0;
ControlData.NbItems = 1; // 1 control
ControlData.PosX = 0;
ControlData.PosY = 0;
ControlData.SizeX = 200;
ControlData.SizeY = 200;
ControlData.Menu = 0x0000; // no menu
ControlData.Class = 0x0000; // use builtin dialog class
ControlData.TitleText = L"Testing Title";
ControlData.ControlStyle = WS_VISIBLE | WS_CHILD;
ControlData.ControlExStyle = 0;
ControlData.ControlPosX = 15;
ControlData.ControlPosY = 15;
ControlData.ControlSizeX = 100;
ControlData.ControlStyle = 100;
ControlData.ControlID = 75; // button ID
ControlData.ControlTypeCategory = 0xFFFF; // use builtin type
ControlData.ControlType = 0x0080; // button control
ControlData.ControlInitialText = L"Button Text";
ControlData.InitialData = 0x0000;
INT_PTR result = DialogBoxIndirectParamW(myInstance, &ControlData, hwnd, DlgProc, NULL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment