Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-14-2005, 02:36 PM   #1 (permalink)
Joel
Registered User
 
Join Date: Mar 2005
Location: Tijuana, BC, México
Posts: 7
Joel is on a distinguished road
center the GetOpenFileName

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?
Joel is offline   Reply With Quote
Old 04-22-2005, 02:27 PM   #2 (permalink)
QUantumAnenome
Code Monkey
 
Join Date: Mar 2005
Posts: 55
QUantumAnenome is on a distinguished road
Send a message via Yahoo to QUantumAnenome
CenterWindow() should center a window. Usually put in your window's OnInit() or InitInstance() functions, but can be used anywhere.
QUantumAnenome is offline   Reply With Quote
Old 04-24-2005, 04:23 PM   #3 (permalink)
Joel
Registered User
 
Join Date: Mar 2005
Location: Tijuana, BC, México
Posts: 7
Joel is on a distinguished road
I try that
Joel is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 03:54 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting