Click here to Skip to main content
15,912,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Reproducing key events Pin
Taka Muraoka6-Sep-03 23:28
Taka Muraoka6-Sep-03 23:28 
GeneralWM_KEYDOWN Pin
Minoo_Sh6-Sep-03 22:12
Minoo_Sh6-Sep-03 22:12 
GeneralRe: WM_KEYDOWN Pin
imsniper8-Sep-03 4:00
imsniper8-Sep-03 4:00 
GeneralRe: WM_KEYDOWN Pin
Minoo_Sh8-Sep-03 19:00
Minoo_Sh8-Sep-03 19:00 
GeneralRe: WM_KEYDOWN Pin
imsniper8-Sep-03 21:23
imsniper8-Sep-03 21:23 
GeneralCFileDialog, just thought I should share this Pin
Abin6-Sep-03 21:56
Abin6-Sep-03 21:56 
GeneralRe: CFileDialog, just thought I should share this Pin
Michael Dunn7-Sep-03 8:22
sitebuilderMichael Dunn7-Sep-03 8:22 
GeneralI'm afraid you are incorrect Pin
Abin7-Sep-03 14:24
Abin7-Sep-03 14:24 
First of all, I must apologize for the lack of detailed explanation in my original post,it was not an article but some little piece of information so I was trying to keep things as simple as possible, but as a result it may confuse or mislead the readers due to the over-simplicity.

So, while having a good point on "safety emphasis", Dear Michael Dunn, your comments were not entirely correct, here's why.

When we use a CFileDialog, an important step is to initialize its member data m_ofn, which is a instance of OPENFILENAME struct, whose definition is as below:
typedef struct tagOFN {  
// Other data members here
DWORD lStructSize;// OPENFILENAME struct size 
DWORD Flags; 
// ... More data members ...
// Total size of other data members is 76 bytes 
#if (_WIN32_WINNT >= 0x0500) 
void * pvReserved; // Data member reserved for Win2000/XP 4 bytes
DWORD dwReserved;  // Data member reserved for Win2000/XP 4 bytes
DWORD FlagsEx;     // Data member reserved for Win2000/XP 4 bytes
#endif // (_WIN32_WINNT >= 0x0500) 
} OPENFILENAME, *LPOPENFILENAME; 

The Flags is where we specify dialog styles and lStructSize is where we specify the struct instance size. The total size of data member before #if (_WIN32_WINNT >= 0x0500) is 76 bytes, of data reserved for Win2000/XP is 12 bytes (4 bytes* 3), so total size of each instance of OPENFILENAME is 88 bytes in Win2000/XP, and 76 bytes otherwise.

In my original post, before I actually changing the m_ofn size, I did carefully verify the OS version using ::GetVersion, I change the size to 88 if and only if the OS is Win2000/XP, so I don't see why my code would crash my customer's system.
GeneralRe: I'm afraid you are incorrect Pin
Michael Dunn7-Sep-03 20:08
sitebuilderMichael Dunn7-Sep-03 20:08 
Generalok Pin
Abin8-Sep-03 0:45
Abin8-Sep-03 0:45 
GeneralRe: CFileDialog, just thought I should share this Pin
PJ Arends7-Sep-03 8:34
professionalPJ Arends7-Sep-03 8:34 
GeneralEditable ListBox Pin
ben26-Sep-03 18:38
ben26-Sep-03 18:38 
GeneralRe: Editable ListBox Pin
Neville Franks6-Sep-03 22:22
Neville Franks6-Sep-03 22:22 
GeneralRe: Editable ListBox Pin
ben26-Sep-03 22:52
ben26-Sep-03 22:52 
Generalhelp with algorithm Pin
coda_x6-Sep-03 17:24
coda_x6-Sep-03 17:24 
GeneralRe: Need help with idea Pin
Andrew Walker6-Sep-03 14:45
Andrew Walker6-Sep-03 14:45 
GeneralRe: Need help with idea Pin
Steven M Hunt6-Sep-03 15:57
Steven M Hunt6-Sep-03 15:57 
GeneralNeed help doing a simple game, ttt Pin
Snyp6-Sep-03 13:15
Snyp6-Sep-03 13:15 
GeneralRe: Need help doing a simple game, ttt Pin
Steven M Hunt6-Sep-03 13:30
Steven M Hunt6-Sep-03 13:30 
GeneralSocks Sock Socks! Pin
ez_way6-Sep-03 10:34
ez_way6-Sep-03 10:34 
GeneralRe: Socks Sock Socks! Pin
Jörgen Sigvardsson6-Sep-03 11:31
Jörgen Sigvardsson6-Sep-03 11:31 
Generalprocessing headers more efficiently Pin
Jim Crafton6-Sep-03 8:13
Jim Crafton6-Sep-03 8:13 
GeneralRe: processing headers more efficiently Pin
Andrew Walker6-Sep-03 15:07
Andrew Walker6-Sep-03 15:07 
GeneralRe: processing headers more efficiently Pin
Jim Crafton7-Sep-03 6:17
Jim Crafton7-Sep-03 6:17 
GeneralRe: processing headers more efficiently Pin
Serge Krynine8-Sep-03 0:18
Serge Krynine8-Sep-03 0:18 

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.