Click here to Skip to main content
15,914,924 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalchange property pages within property sheet dynamically Pin
rgchezhian17-Mar-05 0:11
rgchezhian17-Mar-05 0:11 
GeneralRe: change property pages within property sheet dynamically Pin
David Crow17-Mar-05 2:50
David Crow17-Mar-05 2:50 
GeneralRe: change property pages within property sheet dynamically Pin
rgchezhian17-Mar-05 4:26
rgchezhian17-Mar-05 4:26 
GeneralRe: change property pages within property sheet dynamically Pin
David Crow17-Mar-05 5:15
David Crow17-Mar-05 5:15 
GeneralRe: change property pages within property sheet dynamically Pin
rgchezhian17-Mar-05 5:30
rgchezhian17-Mar-05 5:30 
GeneralRe: change property pages within property sheet dynamically Pin
David Crow17-Mar-05 5:35
David Crow17-Mar-05 5:35 
GeneralRe: change property pages within property sheet dynamically Pin
rgchezhian17-Mar-05 5:47
rgchezhian17-Mar-05 5:47 
GeneralGetOpenFileName and CenterWindow Pin
Stu McGill16-Mar-05 23:54
Stu McGill16-Mar-05 23:54 
I am trying to centre the dialog launched by the GetOpenFileName API function. My hook function tries to centre the window in response to the WM_INITDIALOG but has no effect - the dialog still appears in the top-left corner. The hook function is definitely being called.

I've tried responding to all the messages that the hook function is called with and still nothing happens.

If anyone has any ideas what else I could try I'd be very grateful,

Thanks,

Stuart


UINT CALLBACK OFNHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
UINT uiRetCode = 0;

switch(uiMsg)
{
case WM_INITDIALOG:
CWnd* pWnd = CWnd::FromHandle(hdlg);
if(pWnd != NULL)
{
pWnd->CenterWindow();
}

uiRetCode = 1;
};

return uiRetCode;
}




// Display file selection box
OPENFILENAME ofn;
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);

// Define filters. Get all link files (shortcuts)
ofn.lpstrFilter = _T("Shortcuts (*.lnk)\0*.lnk\0");

// Set the dialog title
ofn.lpstrTitle = _T("Resource Finder");

// Set the initial directory to be the All users Start Menu
ofn.lpstrInitialDir = tempString;

// Specify a buffer to hold the file selections
ofn.lpstrFile = path;
ofn.nMaxFile = MAX_BUFFER;

ofn.Flags = OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_PATHMUSTEXIST
| OFN_FILEMUSTEXIST| OFN_HIDEREADONLY | OFN_ENABLEHOOK ;

ofn.lpfnHook = OFNHookProc; //Addr of callback

// Display the dialog
int nResult = ::GetOpenFileName(&ofn);

GeneralRe: GetOpenFileName and CenterWindow Pin
Mauro Leggieri17-Mar-05 2:13
Mauro Leggieri17-Mar-05 2:13 
GeneralRe: GetOpenFileName and CenterWindow Pin
Stu McGill17-Mar-05 3:10
Stu McGill17-Mar-05 3:10 
GeneralVC.NET Help with VC 6 Pin
Diddy16-Mar-05 23:46
Diddy16-Mar-05 23:46 
GeneralRe: VC.NET Help with VC 6 Pin
David Crow17-Mar-05 5:17
David Crow17-Mar-05 5:17 
Questionblinking cursor in resizable dialog? Pin
ThinkingPrometheus16-Mar-05 22:33
ThinkingPrometheus16-Mar-05 22:33 
QuestionHow to change the dimensions of a groupbox dynamically Pin
caykahve16-Mar-05 21:14
caykahve16-Mar-05 21:14 
AnswerRe: How to change the dimensions of a groubbox dynamically Pin
toxcct16-Mar-05 22:15
toxcct16-Mar-05 22:15 
GeneralRe: How to change the dimensions of a groupbox dynamically Pin
caykahve16-Mar-05 22:43
caykahve16-Mar-05 22:43 
GeneralRe: How to change the dimensions of a groupbox dynamically Pin
toxcct16-Mar-05 22:50
toxcct16-Mar-05 22:50 
GeneralRe: How to change the dimensions of a groupbox dynamically Pin
caykahve16-Mar-05 23:15
caykahve16-Mar-05 23:15 
GeneralRe: How to change the dimensions of a groupbox dynamically Pin
namaskaaram16-Mar-05 22:57
namaskaaram16-Mar-05 22:57 
AnswerRe: How to change the dimensions of a groupbox dynamically Pin
ThatsAlok16-Mar-05 23:35
ThatsAlok16-Mar-05 23:35 
Generalworks! Pin
caykahve17-Mar-05 0:26
caykahve17-Mar-05 0:26 
GeneralNew user interface issues for my application Pin
tim63516-Mar-05 21:13
tim63516-Mar-05 21:13 
GeneralRe: New user interface issues for my application Pin
John R. Shaw17-Mar-05 6:27
John R. Shaw17-Mar-05 6:27 
GeneralTCP/IP guru - please help Pin
eli1502197916-Mar-05 21:02
eli1502197916-Mar-05 21:02 
Questionremove system menu icon from dialog? Pin
ThinkingPrometheus16-Mar-05 20:57
ThinkingPrometheus16-Mar-05 20:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.