Click here to Skip to main content
15,888,802 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Convert raw image data to PNG Pin
Don Guy24-Sep-13 5:41
Don Guy24-Sep-13 5:41 
GeneralRe: Convert raw image data to PNG Pin
Don Guy24-Sep-13 6:04
Don Guy24-Sep-13 6:04 
SuggestionRe: Convert raw image data to PNG Pin
Randor 24-Sep-13 7:29
professional Randor 24-Sep-13 7:29 
GeneralRe: Convert raw image data to PNG Pin
Don Guy24-Sep-13 11:07
Don Guy24-Sep-13 11:07 
QuestionHow to check if popup a Modal Window? Pin
yu-jian23-Sep-13 6:12
yu-jian23-Sep-13 6:12 
AnswerRe: How to check if popup a Modal Window? Pin
«_Superman_»23-Sep-13 6:40
professional«_Superman_»23-Sep-13 6:40 
GeneralRe: How to check if popup a Modal Window? Pin
yu-jian23-Sep-13 7:42
yu-jian23-Sep-13 7:42 
AnswerRe: How to check if popup a Modal Window? Pin
pasztorpisti23-Sep-13 9:17
pasztorpisti23-Sep-13 9:17 
Normally from the taskbar close menus you should send only WM_CLOSE to the main window and you should handle the program exit and "exit possible" flag from the WM_CLOSE handler of your main window. I would extend Superman's solution by using a counter instead of a bool, everytime a modal dialog opens increase the counter and everytime a modal dialog closes decrease the counter. If you have a lot of modal dialogs then you could automatize this by inheriting your dialog classes from a common class and you could implement this feature only once for all dialogs in the base class. So it is OK to close the main window only if your dialog counter is zero. Optionally you can grey out the close buttons/menuitems when the counter is nozero.

EDIT: Here is an alternative solution that MAY WORK, I haven't tried it: Usually when at least one modal dialog is active all other windows/dialogs in the background are disabled (with EnableWindow()[^]). So if the main window is disabled we can suspect that it is disabled because of a modal window (unless you are disabling it manually that I doubt). In this case you could use the IsWindowEnabled()[^] function on the main window to detect whether it is enabled or disabled. So all you have to do is cancelling the main window close (from your WM_CLOSE handler) if the main window is disabled (plus all you should do from your context menu close command is sending a WM_CLOSE to the main window so your WM_CLOSE handler will handle the main window close command regardless of the source of the command). CWnd also has an IsWindowEnabled()[^] method besides the winapi IsWindowEnabled().

modified 23-Sep-13 15:33pm.

AnswerRe: How to check if popup a Modal Window? Pin
Randor 23-Sep-13 18:26
professional Randor 23-Sep-13 18:26 
QuestionCreateFile on HBITMAP Pin
Don Guy20-Sep-13 11:41
Don Guy20-Sep-13 11:41 
AnswerRe: CreateFile on HBITMAP Pin
Richard MacCutchan20-Sep-13 21:34
mveRichard MacCutchan20-Sep-13 21:34 
AnswerRe: CreateFile on HBITMAP Pin
«_Superman_»21-Sep-13 21:05
professional«_Superman_»21-Sep-13 21:05 
AnswerRe: CreateFile on HBITMAP Pin
Chris Losinger23-Sep-13 9:28
professionalChris Losinger23-Sep-13 9:28 
QuestionFont Color Pin
Richard Andrew x6420-Sep-13 5:59
professionalRichard Andrew x6420-Sep-13 5:59 
AnswerRe: Font Color Pin
Richard MacCutchan20-Sep-13 7:28
mveRichard MacCutchan20-Sep-13 7:28 
GeneralRe: Font Color Pin
Richard Andrew x6420-Sep-13 8:43
professionalRichard Andrew x6420-Sep-13 8:43 
GeneralRe: Font Color Pin
Chris Losinger20-Sep-13 9:10
professionalChris Losinger20-Sep-13 9:10 
GeneralRe: Font Color Pin
«_Superman_»21-Sep-13 21:18
professional«_Superman_»21-Sep-13 21:18 
GeneralRe: Font Color Pin
koll Zhu25-Sep-13 0:53
koll Zhu25-Sep-13 0:53 
Questionsynchronous Communication between 2 applications in separate machines in LAN Pin
manoharbalu20-Sep-13 1:52
manoharbalu20-Sep-13 1:52 
SuggestionRe: synchronous Communication between 2 applications in separate machines in LAN Pin
Richard MacCutchan20-Sep-13 3:19
mveRichard MacCutchan20-Sep-13 3:19 
QuestionCan we place MFC Controls in RunningObjectTable? Pin
Rajendarmanda19-Sep-13 22:41
Rajendarmanda19-Sep-13 22:41 
SuggestionRe: Can we place MFC Controls in RunningObjectTable? Pin
Richard MacCutchan19-Sep-13 23:17
mveRichard MacCutchan19-Sep-13 23:17 
GeneralRe: Can we place MFC Controls in RunningObjectTable? Pin
Rajendarmanda20-Sep-13 1:42
Rajendarmanda20-Sep-13 1:42 
GeneralRe: Can we place MFC Controls in RunningObjectTable? Pin
Richard MacCutchan20-Sep-13 1:50
mveRichard MacCutchan20-Sep-13 1:50 

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.