Click here to Skip to main content
15,900,676 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: problem resoting DB using VC++!! Pin
David Crow6-Dec-04 2:20
David Crow6-Dec-04 2:20 
Generaladding bitmap to a cbutton Pin
prateekkathuria3-Dec-04 5:47
prateekkathuria3-Dec-04 5:47 
GeneralRe: adding bitmap to a cbutton Pin
David Crow3-Dec-04 6:01
David Crow3-Dec-04 6:01 
GeneralRe: adding bitmap to a cbutton Pin
prateekkathuria3-Dec-04 6:08
prateekkathuria3-Dec-04 6:08 
GeneralRe: adding bitmap to a cbutton Pin
Ravi Bhavnani3-Dec-04 6:24
professionalRavi Bhavnani3-Dec-04 6:24 
GeneralRe: adding bitmap to a cbutton Pin
prateekkathuria3-Dec-04 8:53
prateekkathuria3-Dec-04 8:53 
GeneralRe: adding bitmap to a cbutton Pin
prateekkathuria3-Dec-04 9:25
prateekkathuria3-Dec-04 9:25 
Questionmigrating MFC 6.0 app to 7.0; gotchas ? Pin
dvolpe3-Dec-04 5:07
dvolpe3-Dec-04 5:07 
AnswerRe: migrating MFC 6.0 app to 7.0; gotchas ? Pin
Chris Meech3-Dec-04 6:49
Chris Meech3-Dec-04 6:49 
AnswerRe: migrating MFC 6.0 app to 7.0; gotchas ? Pin
john john mackey3-Dec-04 8:44
john john mackey3-Dec-04 8:44 
AnswerRe: migrating MFC 6.0 app to 7.0; gotchas ? Pin
Kevin McFarlane4-Dec-04 4:18
Kevin McFarlane4-Dec-04 4:18 
GeneralMS VC++ & Flash Pin
Serg314163-Dec-04 4:07
Serg314163-Dec-04 4:07 
Generalmaybe a stupid Question,but need help! Pin
josephvan3-Dec-04 3:22
josephvan3-Dec-04 3:22 
GeneralRe: maybe a stupid Question,but need help! Pin
Mike Danberg3-Dec-04 9:32
Mike Danberg3-Dec-04 9:32 
GeneralRe: maybe a stupid Question,but need help! Pin
Mike O'Neill3-Dec-04 14:06
Mike O'Neill3-Dec-04 14:06 
GeneralReadFile(), what is wrong?!! Pin
tswan3-Dec-04 3:17
tswan3-Dec-04 3:17 
GeneralRe: ReadFile(), what is wrong?!! Pin
Blake Miller3-Dec-04 4:04
Blake Miller3-Dec-04 4:04 
GeneralRe: ReadFile(), what is wrong?!! Pin
tswan5-Dec-04 2:48
tswan5-Dec-04 2:48 
GeneralOn-Screen Keyboard Pin
Tripura.K3-Dec-04 2:36
Tripura.K3-Dec-04 2:36 
GeneraldwLastChange - Connection Time Pin
adriano_alvarez3-Dec-04 2:34
adriano_alvarez3-Dec-04 2:34 
GeneralRe: dwLastChange - Connection Time Pin
David Crow3-Dec-04 5:40
David Crow3-Dec-04 5:40 
GeneralCFileDialog crashes in Platform SDK Pin
Marius Bancila3-Dec-04 1:59
professionalMarius Bancila3-Dec-04 1:59 
I have installed Platform SDK Windows Server 2003 (I work in VS 6.0 on WinXP) and I have a problem with CFileDialog.

This code

<br />
void CFileTestView::OnViewFile() <br />
{<br />
  CFileDialog dlg(TRUE);<br />
  dlg.DoModal();<br />
}<br />

worked just fine before defining _WIN32_WINNT, which I need to use different functions and constants. Now, when I define it

<br />
#ifndef _WIN32_WINNT<br />
#define _WIN32_WINNT  0x0501  // can be 0x0500 as well<br />
#endif<br />

my code just crashes in ~CFileDialog (when dlg does out of scope and is destroyed). Since m_ofn member of CFileDialog depends on this _WIN32_WINT:

<br />
typedef struct tagOFN { <br />
// ...<br />
#if (_WIN32_WINNT >= 0x0500)<br />
  void *        pvReserved;<br />
  DWORD         dwReserved;<br />
  DWORD         FlagsEx;<br />
#endif // (_WIN32_WINNT >= 0x0500)<br />
} OPENFILENAME<br />

I rewrote the code this way:

<br />
void CFileTestView::OnViewFile() <br />
{<br />
 CFileDialog dlg(TRUE);<br />
 dlg.m_ofn.lStructSize = sizeof(OPENFILENAME); // 88 bytes<br />
<br />
#if (_WIN32_WINNT >= 0x0500)<br />
	dlg.m_ofn.pvReserved = NULL;<br />
	dlg.m_ofn.dwReserved = 0;<br />
	dlg.m_ofn.FlagsEx = 0;<br />
#endif<br />
<br />
 dlg.DoModal(); // can also miss<br />
}<br />

but I still get a first-chance exception in FileTest.Exe (KERNEL32.dll) 0xC0000005: Access Violation (the usual stuff).

Now, I found out that if I declare dlg dinamically it doesn't crash:
<br />
void CFileTestView::OnViewFile() <br />
{<br />
 CFileDialog* dlg = new CFileDialog*(TRUE);<br />
 dlg.m_ofn.lStructSize = sizeof(OPENFILENAME); // 88 bytes<br />
<br />
 #if (_WIN32_WINNT >= 0x0500)<br />
	dlg.m_ofn.pvReserved = NULL;<br />
	dlg.m_ofn.dwReserved = 0;<br />
	dlg.m_ofn.FlagsEx = 0;<br />
 #endif<br />
<br />
 delete dlg; // OK<br />
}<br />


But If I derive CFileDialog to CMyFileDialog the program still crashes at delete:
<br />
void CFileTestView::OnViewFile() <br />
{<br />
 CMyFileDialog* dlg = new CMyFileDialog*(TRUE);<br />
 dlg.m_ofn.lStructSize = sizeof(OPENFILENAME); // 88 bytes<br />
<br />
 #if (_WIN32_WINNT >= 0x0500)<br />
	dlg.m_ofn.pvReserved = NULL;<br />
	dlg.m_ofn.dwReserved = 0;<br />
	dlg.m_ofn.FlagsEx = 0;<br />
 #endif<br />
<br />
 delete dlg; // crash boom boom<br />
}<br />


Any ideas? Thanks!
GeneralRe: CFileDialog crashes in Platform SDK Pin
David Crow3-Dec-04 2:16
David Crow3-Dec-04 2:16 
GeneralRe: CFileDialog crashes in Platform SDK Pin
Blake Miller3-Dec-04 4:11
Blake Miller3-Dec-04 4:11 
GeneralRe: CFileDialog crashes in Platform SDK Pin
Marius Bancila3-Dec-04 4:29
professionalMarius Bancila3-Dec-04 4:29 

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.