Click here to Skip to main content
15,919,132 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: MSFLXGRD problem in 64bit machine (MFC/C++) Pin
«_Superman_»28-Jan-09 22:17
professional«_Superman_»28-Jan-09 22:17 
GeneralRe: MSFLXGRD problem in 64bit machine (MFC/C++) Pin
raesa28-Jan-09 22:22
raesa28-Jan-09 22:22 
GeneralRe: MSFLXGRD problem in 64bit machine (MFC/C++) Pin
«_Superman_»28-Jan-09 22:32
professional«_Superman_»28-Jan-09 22:32 
GeneralRe: MSFLXGRD problem in 64bit machine (MFC/C++) Pin
raesa28-Jan-09 23:13
raesa28-Jan-09 23:13 
GeneralRe: MSFLXGRD problem in 64bit machine (MFC/C++) Pin
«_Superman_»28-Jan-09 23:50
professional«_Superman_»28-Jan-09 23:50 
GeneralRe: MSFLXGRD problem in 64bit machine (MFC/C++) Pin
raesa29-Jan-09 0:35
raesa29-Jan-09 0:35 
GeneralRe: MSFLXGRD problem in 64bit machine (MFC/C++) Pin
«_Superman_»29-Jan-09 1:28
professional«_Superman_»29-Jan-09 1:28 
GeneralRe: MSFLXGRD problem in 64bit machine (MFC/C++) Pin
raesa29-Jan-09 18:21
raesa29-Jan-09 18:21 
Hi.....

Thnx for the reply.I have pasted the code below from dlgcore.cpp.The code fails at function CreateDlgIndirect.Do have a look.

If possible plse create an MFC Application in VS 2005 and insert an active x control (MS FLEX GRD) and execute it.i think you might get the error "Debug Assertion failed", while executing the dialog.to remind, my system is a 64bit system .Thnx once again.Please do let me know if you get to know the problem.
thnx.



INT_PTR CDialog::DoModal()
{
// can be constructed with a resource template or InitModalIndirect
ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
m_lpDialogTemplate != NULL);

// load resource as necessary
LPCDLGTEMPLATE lpDialogTemplate = m_lpDialogTemplate;
HGLOBAL hDialogTemplate = m_hDialogTemplate;
HINSTANCE hInst = AfxGetResourceHandle();
if (m_lpszTemplateName != NULL)
{
hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
hDialogTemplate = LoadResource(hInst, hResource);
}
if (hDialogTemplate != NULL)
lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);

// return -1 in case of failure to load the dialog template resource
if (lpDialogTemplate == NULL)
return -1;

// disable parent (before creating dialog)
HWND hWndParent = PreModal();
AfxUnhookWindowCreate();
BOOL bEnableParent = FALSE;
#ifndef _AFX_NO_OLE_SUPPORT
CWnd* pMainWnd = NULL;
BOOL bEnableMainWnd = FALSE;
#endif
if (hWndParent && hWndParent != ::GetDesktopWindow() && ::IsWindowEnabled(hWndParent))
{
::EnableWindow(hWndParent, FALSE);
bEnableParent = TRUE;
#ifndef _AFX_NO_OLE_SUPPORT
pMainWnd = AfxGetMainWnd();
if (pMainWnd && pMainWnd->IsFrameWnd() && pMainWnd->IsWindowEnabled())
{
//
// We are hosted by non-MFC container
//
pMainWnd->EnableWindow(FALSE);
bEnableMainWnd = TRUE;
}
#endif
}

TRY
{
// create modeless dialog
AfxHookWindowCreate(this);
if (CreateDlgIndirect(lpDialogTemplate,
CWnd::FromHandle(hWndParent), hInst))
{
if (m_nFlags & WF_CONTINUEMODAL)
{
// enter modal loop
DWORD dwFlags = MLF_SHOWONIDLE;
if (GetStyle() & DS_NOIDLEMSG)
dwFlags |= MLF_NOIDLEMSG;
VERIFY(RunModalLoop(dwFlags) == m_nModalResult);
}

// hide the window before enabling the parent, etc.
if (m_hWnd != NULL)
SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|
SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
}
}
CATCH_ALL(e)
{
DELETE_EXCEPTION(e);
m_nModalResult = -1;
}
END_CATCH_ALL

#ifndef _AFX_NO_OLE_SUPPORT
if (bEnableMainWnd)
pMainWnd->EnableWindow(TRUE);
#endif
if (bEnableParent)
::EnableWindow(hWndParent, TRUE);
if (hWndParent != NULL && ::GetActiveWindow() == m_hWnd)
::SetActiveWindow(hWndParent);

// destroy modal window
DestroyWindow();
PostModal();

// unlock/free resources as necessary
if (m_lpszTemplateName != NULL || m_hDialogTemplate != NULL)
UnlockResource(hDialogTemplate);
if (m_lpszTemplateName != NULL)
FreeResource(hDialogTemplate);

return m_nModalResult;
}
QuestionCalling a function from another program Pin
Tom Hubin28-Jan-09 21:17
Tom Hubin28-Jan-09 21:17 
AnswerRe: Calling a function from another program Pin
Stuart Dootson28-Jan-09 22:14
professionalStuart Dootson28-Jan-09 22:14 
GeneralRe: Calling a function from another program Pin
Tom Hubin29-Jan-09 19:06
Tom Hubin29-Jan-09 19:06 
GeneralRe: Calling a function from another program Pin
Tom Hubin29-Jan-09 19:25
Tom Hubin29-Jan-09 19:25 
GeneralRe: Calling a function from another program Pin
Stuart Dootson29-Jan-09 23:22
professionalStuart Dootson29-Jan-09 23:22 
GeneralRe: Calling a function from another program Pin
Tom Hubin30-Jan-09 11:18
Tom Hubin30-Jan-09 11:18 
GeneralRe: Calling a function from another program Pin
Stuart Dootson31-Jan-09 0:00
professionalStuart Dootson31-Jan-09 0:00 
AnswerRe: Calling a function from another program Pin
«_Superman_»28-Jan-09 22:14
professional«_Superman_»28-Jan-09 22:14 
QuestionHow can set UP and DOWN arrow in header of CListCtrl? [modified] Pin
Le@rner28-Jan-09 19:39
Le@rner28-Jan-09 19:39 
AnswerRe: How can set UP and DOWN arrow in sorted column in CListCtrl? Pin
SandipG 28-Jan-09 19:45
SandipG 28-Jan-09 19:45 
AnswerRe: How can set UP and DOWN arrow in header of CListCtrl? Pin
Stuart Dootson28-Jan-09 21:57
professionalStuart Dootson28-Jan-09 21:57 
Questionhow to force paint a view in MFC. Pin
VC++Maniac28-Jan-09 19:24
VC++Maniac28-Jan-09 19:24 
AnswerRe: how to force paint a view in MFC. Pin
SandipG 28-Jan-09 19:42
SandipG 28-Jan-09 19:42 
AnswerRe: how to force paint a view in MFC. Pin
CPallini28-Jan-09 21:08
mveCPallini28-Jan-09 21:08 
GeneralRe: how to force paint a view in MFC. Pin
nitin328-Jan-09 21:53
nitin328-Jan-09 21:53 
QuestionRe: how to force paint a view in MFC. Pin
Nishad S28-Jan-09 22:16
Nishad S28-Jan-09 22:16 
GeneralRe: how to force paint a view in MFC. Pin
Hamid_RT29-Jan-09 1:03
Hamid_RT29-Jan-09 1:03 

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.