changing the position of CFileDialog
-
Hi How can I change the position of the dialog box which is created from CFileDialog? This is not work;
TCHAR strFilter[] = { TEXT("Files (*.*)|*.*||") }; CFileDialog dlg(TRUE, TEXT(".*"), NULL, 0, strFilter,this); dlg.SetWindowPos(&wndTop,0,0,20,30,SWP_SHOWWINDOW);Thanks -
Hi How can I change the position of the dialog box which is created from CFileDialog? This is not work;
TCHAR strFilter[] = { TEXT("Files (*.*)|*.*||") }; CFileDialog dlg(TRUE, TEXT(".*"), NULL, 0, strFilter,this); dlg.SetWindowPos(&wndTop,0,0,20,30,SWP_SHOWWINDOW);Thanksiayd wrote:
This is not work;
Because, you are using API, on uninitialized window. Try to create it modelles. If you want it modal, then derive a class from CFileDialog and use
SetWindowPosorMoveWindowinOnInitDialog.
Prasad MS MVP - VC++
-
iayd wrote:
This is not work;
Because, you are using API, on uninitialized window. Try to create it modelles. If you want it modal, then derive a class from CFileDialog and use
SetWindowPosorMoveWindowinOnInitDialog.
Prasad MS MVP - VC++
But still I cannot change the width of dialog box.I want a narrower diialog box.I used SetwindowPos in OnInitDialog.Is there a solution for this problem.
-
Hi How can I change the position of the dialog box which is created from CFileDialog? This is not work;
TCHAR strFilter[] = { TEXT("Files (*.*)|*.*||") }; CFileDialog dlg(TRUE, TEXT(".*"), NULL, 0, strFilter,this); dlg.SetWindowPos(&wndTop,0,0,20,30,SWP_SHOWWINDOW);ThanksModeless or modal, this will not work. You'll need to provide a hook (
OFN_ENABLEHOOK). In that hook procedure, respond to theWM_INITDIALOGmessage, and callSetWindowPos().
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
But still I cannot change the width of dialog box.I want a narrower diialog box.I used SetwindowPos in OnInitDialog.Is there a solution for this problem.
As told earlier,
MoveWindowor API mentioned by you can be used. Make sure, you are using these API's after initialization of window handle.
Prasad MS MVP - VC++
-
Modeless or modal, this will not work. You'll need to provide a hook (
OFN_ENABLEHOOK). In that hook procedure, respond to theWM_INITDIALOGmessage, and callSetWindowPos().
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
I'm pretty sure MFC hooks the dialog for you. Why not just derive a class from CFileDialog and call MoveWindow() in a WM_INITDIALOG handler? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: