Jabberwocky
Jabberwocky

Reputation: 50882

Specifying the width of a TaskDialog

I'm using a task dialog via the TaskDialogIndirect function.

Everything works as expected except that the width of the dialog is exactly twice of what I specified in the cxWidth field of the TASKDIALOGCONFIG structure.

Relevant code:

  TASKDIALOGCONFIG tdc;
  ZeroMemory(&tdc, sizeof(tdc));
  tdc.cbSize = sizeof(TASKDIALOGCONFIG);
  tdc.hwndParent = hwndParent;
  tdc.hInstance = NULL;
  tdc.pszWindowTitle = L"Title";
  tdc.pszMainInstruction = L"Foo";
  tdc.pszContent = L"Bar";
  tdc.dwFlags = TDF_POSITION_RELATIVE_TO_WINDOW;
  tdc.cxWidth = 150;
  int result;
  HRESULT hr = TaskDialogIndirect(&tdc, &result, NULL, NULL);

The documentation says that the cxWidth is the width in dialog units.

With the code above the width of the dialog is 300 pixels instead of 150 which means that one horizontal dialog unit is 2 which seems really small.

If I want to specify the width of the task dialog explicitely, how should I proceed? Is suppose I cannot rely on the fact that one horizontal dialog unit is always 2 in this case.

Upvotes: 0

Views: 608

Answers (0)

Related Questions