I'm in XP machine and I'm trying to center, by hook, the Open file dialog....
Ok... It's suppose to be like this one:
http://msdn.microsoft.com/library/en...opendialog.gif
but, the result is the one that comes with Win98
Here's my short version of my code:
Code:
UINT APIENTRY OFNHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
RECT r;
int w, h, x, y;
GetWindowRect(GetParent(hWnd), &r);
w = r.right - r.left;
h = r.bottom - r.top;
GetWindowRect(GetDesktopWindow(), &r);
MoveWindow(GetParent(hWnd), (r.right-w)/2,(r.bottom-h)/2, w, h, TRUE);
return TRUE;
}
default:
{
break;
}
}
return FALSE;
}
// loading the struct
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWndParent;
ofn.nFilterIndex = iIndex;
ofn.lpstrFile = lpbuffer;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = "(*.*)\0*.*\0\0";
ofn.Flags = OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_ENABLEHOOK|OFN_EXPLORER|OFN_ENABLEHOOK;
ofn.lpfnHook = OFNHookProc;
GetOpenFileName(&ofn);
Any ideas?