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

C / C++ / MFC

 
Questionabout linker error in the C code of CSmtp_v1_5 (unable to compile the main.cpp file due to linker error) Pin
WindowsVsLinux6-Jun-09 4:32
WindowsVsLinux6-Jun-09 4:32 
AnswerRe: about linker error in the C code of CSmtp_v1_5 (unable to compile the main.cpp file due to linker error) Pin
Stuart Dootson6-Jun-09 7:06
professionalStuart Dootson6-Jun-09 7:06 
QuestionHow to upload multiple image? Pin
shyampasari6-Jun-09 3:28
shyampasari6-Jun-09 3:28 
AnswerRe: How to upload multiple image? Pin
Stuart Dootson6-Jun-09 3:48
professionalStuart Dootson6-Jun-09 3:48 
QuestionRe: How to upload multiple image? Pin
shyampasari6-Jun-09 3:52
shyampasari6-Jun-09 3:52 
AnswerRe: How to upload multiple image? Pin
Stuart Dootson6-Jun-09 7:02
professionalStuart Dootson6-Jun-09 7:02 
QuestionRe: How to upload multiple image? Pin
shyampasari7-Jun-09 0:06
shyampasari7-Jun-09 0:06 
QuestionSetWindowForeground Pin
sashoalm6-Jun-09 3:13
sashoalm6-Jun-09 3:13 
Hello,

I've been trying to solve that problem for some time now and I'll be very grateful to anyone who can suggest a solution. The problem is a little tricky but I hope I'll be able to explain it clearly.

I have an application which might need to notify the user of an event even if it's not focused at the moment or is minimized. Think of something along the lines of an app that copies files for 5-6 minutes and needs to say 'Your files were copied' at the end, but the user has switched to writing emails in the meantime. I don't want to grab the keyboard focus because he might be doing something like writing in notepad in which case he'll be randomly pressing hotkeys on my dialog instead of writing to notepad. But I can't figure out how to do this properly.

Right now I use this code (from my main dialog class):
//	if (IsIconic())
//		ShowWindow(SW_RESTORE);
	SetForegroundWindow();


By calling SetForegroundWindow() my dialog comes to the foreground (or flashes - but I don't know how Windows decides which of the two) and sometimes will steal focus which I don't want, but there are many problems if my dialog is also minimized. In this case the taskbar icon of my dialog will seem to become active on the taskbar, but my dialog won't show itself (it'll remain minimized but receive keyboard focus it seems). If I uncomment the other two lines, then it solves all problems with minimizing as it first unminimizes the dialog, but it _always_ steals focus which I don't want.

My second problem with the main dialog being minimized is I also create a dialog containing some information about the event and I display it with DoModal, and if I call DoModal while the main window was minimized, when the user switches to my program the new dialog created with DoModal is shown but the main dialog is not. Any way to fix that?

So it's all very complicated and I'm not sure how it's supposed to be implemented. Again, all I want is to notify the user without stealing keyboard focus, even if my dialog is minimized at the time. Do I unminimize my dialog? How do I prevent it from stealing focus then?

Any help will be greatly appreciated!

There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal

AnswerRe: SetWindowForeground Pin
Stuart Dootson6-Jun-09 3:46
professionalStuart Dootson6-Jun-09 3:46 
GeneralRe: SetWindowForeground Pin
sashoalm6-Jun-09 4:02
sashoalm6-Jun-09 4:02 
GeneralRe: SetWindowForeground Pin
sashoalm6-Jun-09 4:30
sashoalm6-Jun-09 4:30 
QuestionSwitch Pin
navneet19856-Jun-09 1:35
navneet19856-Jun-09 1:35 
AnswerRe: Switch Pin
Randor 6-Jun-09 4:57
professional Randor 6-Jun-09 4:57 
QuestionHow to drag and drop between CListView and CScrollView? Pin
akira325-Jun-09 23:54
akira325-Jun-09 23:54 
AnswerRe: How to drag and drop between CListView and CScrollView? Pin
molesworth6-Jun-09 2:37
molesworth6-Jun-09 2:37 
GeneralRe: How to drag and drop between CListView and CScrollView? Pin
akira326-Jun-09 3:51
akira326-Jun-09 3:51 
GeneralRe: How to drag and drop between CListView and CScrollView? Pin
molesworth6-Jun-09 7:16
molesworth6-Jun-09 7:16 
QuestionEffective tool for run-time errors and memory leaks detection Pin
SSDream5-Jun-09 16:50
SSDream5-Jun-09 16:50 
AnswerRe: Effective tool for run-time errors and memory leaks detection Pin
Cedric Moonen5-Jun-09 21:37
Cedric Moonen5-Jun-09 21:37 
AnswerRe: Effective tool for run-time errors and memory leaks detection Pin
The Yariv6-Jun-09 10:10
The Yariv6-Jun-09 10:10 
GeneralRe: Effective tool for run-time errors and memory leaks detection Pin
SSDream6-Jun-09 17:36
SSDream6-Jun-09 17:36 
QuestionChange dialog unit Pin
includeh105-Jun-09 16:14
includeh105-Jun-09 16:14 
AnswerRe: Change dialog unit Pin
enhzflep5-Jun-09 21:31
enhzflep5-Jun-09 21:31 
QuestionCDockablePane::Create Cant Find Defs for dwStyle, dwTabbedStyle, dwControlBarStyle Pin
dougwilliams5-Jun-09 10:32
dougwilliams5-Jun-09 10:32 
QuestionSoftware Integration Pin
CodingYoshi5-Jun-09 9:43
CodingYoshi5-Jun-09 9:43 

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.