Click here to Skip to main content
15,899,314 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How ActiveX works? Pin
Cedric Moonen25-Jan-06 21:33
Cedric Moonen25-Jan-06 21:33 
QuestionHow do we make curved 3d buttons? Pin
waxie25-Jan-06 21:15
waxie25-Jan-06 21:15 
AnswerRe: How do we make curved 3d buttons? Pin
khan++25-Jan-06 21:24
khan++25-Jan-06 21:24 
QuestionWhat is the quick way to add a file browser dialog Pin
the Jimmy25-Jan-06 18:35
the Jimmy25-Jan-06 18:35 
AnswerRe: What is the quick way to add a file browser dialog Pin
khan++25-Jan-06 20:05
khan++25-Jan-06 20:05 
GeneralRe: What is the quick way to add a file browser dialog Pin
the Jimmy26-Jan-06 6:59
the Jimmy26-Jan-06 6:59 
GeneralRe: What is the quick way to add a file browser dialog Pin
Owner drawn26-Jan-06 18:32
Owner drawn26-Jan-06 18:32 
GeneralRe: What is the quick way to add a file browser dialog Pin
the Jimmy27-Jan-06 10:26
the Jimmy27-Jan-06 10:26 
Hi,
I have used this as suggested by Khan:

CFileDialog fd(TRUE);
int nResult = fd.DoModal();
if (nResult == IDOK)
{
CString strPath = fd.GetPathName();
}

as soon as it hits the line CFileDialog fd(TRUE), then it goes into
CFileDialog::CFileDialog(BOOL bOpenFileDialog,
LPCTSTR lpszDefExt, LPCTSTR lpszFileName, DWORD dwFlags,
LPCTSTR lpszFilter, CWnd* pParentWnd) : CCommonDialog(pParentWnd)
{
memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL
m_szFileName[0] = '\0';
m_szFileTitle[0] = '\0';
m_pofnTemp = NULL;

m_bOpenFileDialog = bOpenFileDialog;
m_nIDHelp = bOpenFileDialog ? AFX_IDD_FILEOPEN : AFX_IDD_FILESAVE;

m_ofn.lStructSize = sizeof(m_ofn);
m_ofn.lpstrFile = m_szFileName;
m_ofn.nMaxFile = _countof(m_szFileName);
m_ofn.lpstrDefExt = lpszDefExt;
m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle;
m_ofn.nMaxFileTitle = _countof(m_szFileTitle);
m_ofn.Flags |= dwFlags | OFN_ENABLEHOOK | OFN_ENABLESIZING;
if (!afxData.bWin4 && AfxHelpEnabled())
m_ofn.Flags |= OFN_SHOWHELP;
if (afxData.bWin4)
{
m_ofn.Flags |= OFN_EXPLORER;
--> problem here m_ofn.hInstance = AfxGetResourceHandle();
}
m_ofn.lpfnHook = (COMMDLGPROC)_AfxCommDlgProc;



The problem is in m_ofn.hInstance = AfxGetResourceHandle();
// Global helper functions
_AFXWIN_INLINE CWinApp* AFXAPI AfxGetApp()
{ return afxCurrentWinApp; }
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()
{ ASSERT(afxCurrentInstanceHandle != NULL);
return afxCurrentInstanceHandle; }

/* problem in the following Aserttion */
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
--->>>> { ASSERT(afxCurrentResourceHandle != NULL); <<<<<<<---------PROBLEM
return afxCurrentResourceHandle; }


_AFXWIN_INLINE void AFXAPI AfxSetResourceHandle(HINSTANCE hInstResource)
{ ASSERT(hInstResource != NULL); afxCurrentResourceHandle = hInstResource; }
_AFXWIN_INLINE LPCTSTR AFXAPI AfxGetAppName()
{ ASSERT(afxCurrentAppName != NULL); return afxCurrentAppName; }
_AFXWIN_INLINE COleMessageFilter* AFXAPI AfxOleGetMessageFilter()
{ ASSERT_VALID(AfxGetThread()); return AfxGetThread()->m_pMessageFilter; }
_AFXWIN_INLINE CWnd* AFXAPI AfxGetMainWnd()
{ CWinThread* pThread = AfxGetThread();
return pThread != NULL ? pThread->GetMainWnd() : NULL; }



Jim
QuestionMaking DlgBox without its class..... Pin
minguy25-Jan-06 14:48
minguy25-Jan-06 14:48 
AnswerRe: Making DlgBox without its class..... Pin
Vipin Aravind25-Jan-06 18:52
Vipin Aravind25-Jan-06 18:52 
QuestionCSpiltterWnd Pin
LeeeNN25-Jan-06 14:30
LeeeNN25-Jan-06 14:30 
QuestionReturning data from VC++(DLL) to VB Client Pin
techratna25-Jan-06 13:52
techratna25-Jan-06 13:52 
AnswerRe: Returning data from VC++(DLL) to VB Client Pin
Stephen Hewitt25-Jan-06 20:51
Stephen Hewitt25-Jan-06 20:51 
AnswerRe: Returning data from VC++(DLL) to VB Client Pin
Phil J Pearson25-Jan-06 23:29
Phil J Pearson25-Jan-06 23:29 
Questionchild frame fills main frame? Pin
LeeeNN25-Jan-06 13:38
LeeeNN25-Jan-06 13:38 
AnswerRe: child frame fills main frame? Pin
Owner drawn26-Jan-06 17:04
Owner drawn26-Jan-06 17:04 
QuestionMember Get/Set methods? Pin
Rob Caldecott25-Jan-06 11:55
Rob Caldecott25-Jan-06 11:55 
AnswerRe: Member Get/Set methods? Pin
Maximilien25-Jan-06 16:45
Maximilien25-Jan-06 16:45 
AnswerRe: Member Get/Set methods? Pin
Bob Stanneveld25-Jan-06 21:07
Bob Stanneveld25-Jan-06 21:07 
Questionhow to define the customer paper type Pin
yujia12025-Jan-06 8:15
yujia12025-Jan-06 8:15 
AnswerRe: how to define the customer paper type Pin
Phil J Pearson25-Jan-06 23:32
Phil J Pearson25-Jan-06 23:32 
QuestionRe: how to define the customer paper type Pin
yujia12026-Jan-06 5:38
yujia12026-Jan-06 5:38 
QuestionHow to obtain the current directory pidl of a windows explorer window? Pin
z530025-Jan-06 6:21
z530025-Jan-06 6:21 
QuestionRe: How to obtain the current directory pidl of a windows explorer window? Pin
David Crow25-Jan-06 6:27
David Crow25-Jan-06 6:27 
AnswerRe: How to obtain the current directory pidl of a windows explorer window? Pin
z530025-Jan-06 14:20
z530025-Jan-06 14:20 

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.