Click here to Skip to main content
15,901,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VC++.NET compiler running in VC++6 Errors Pin
Anonymous25-May-04 13:47
Anonymous25-May-04 13:47 
GeneralRe: VC++.NET compiler running in VC++6 Errors Pin
---Mark---25-May-04 13:53
---Mark---25-May-04 13:53 
GeneralExtracting files from resource Pin
Anonymous25-May-04 13:28
Anonymous25-May-04 13:28 
GeneralRe: Extracting files from resource Pin
gUrM33T25-May-04 18:04
gUrM33T25-May-04 18:04 
GeneralRe: Extracting files from resource Pin
Diddy26-May-04 0:20
Diddy26-May-04 0:20 
GeneralRe: Extracting files from resource Pin
Roger Allen26-May-04 2:41
Roger Allen26-May-04 2:41 
GeneralRe: Extracting files from resource Pin
David Crow26-May-04 3:33
David Crow26-May-04 3:33 
GeneralMake Window Stay On Top Pin
KingTermite25-May-04 12:56
KingTermite25-May-04 12:56 
I'm not too saavy in Visual C++ programming as most of my C/CPP has been in embedded platforms.

I'm working on a host application which is a VC++ window. Essentially, for this one particular window I want it to stay on top all the time. I have added some code that was given to me by someone who has done it in another application before, but it does not seem to be working in mine. Can anyone help?

Here is what I have:
<code>
				CWnd appWnd;    // the application CWnd
				CWnd *pAppWnd;  // a pointer to CWnd
				pAppWnd = & appWnd;
				pAppWnd = AfxGetMainWnd();

				if (NULL != pAppWnd)
				{
					HWND appHandle; // window handle
					appHandle = pAppWnd->GetSafeHwnd();

					if (NULL != appHandle)
					{
						targetObj.m_pAppWnd = pAppWnd;						
					}
				}

		// Cause window to stay on top
		targetObj.m_bWindowStayOnTop = TRUE;
</code>


targetObj is another class which is essentially being called by this (no "gui" elements in that class) and in that class, inside of a loop that he is in, I have this part:

<code>
						// Used to keep parent window (test module) on top
						if (TRUE == this->m_bWindowStayOnTop)
						{
							BOOL bReturn = FALSE; 

							if (NULL != this->m_pAppWnd)
							{
								bReturn = this->m_pAppWnd->SetForegroundWindow();
							}
						}

</code>


It seems that the return from SetForegroundWindow() is 0 which means it is failing. But I don't know why! Any ideas?



There are only 10 types of people in this world....those that understand binary, and those that do not.
GeneralRe: Make Window Stay On Top Pin
Christian Graus25-May-04 13:15
protectorChristian Graus25-May-04 13:15 
GeneralRe: Make Window Stay On Top Pin
KingTermite25-May-04 13:19
KingTermite25-May-04 13:19 
GeneralRe: Make Window Stay On Top Pin
Christian Graus25-May-04 13:22
protectorChristian Graus25-May-04 13:22 
GeneralVC7 compiler with VC6 IDE Pin
Jim A. Johnson25-May-04 8:19
Jim A. Johnson25-May-04 8:19 
GeneralRe: VC7 compiler with VC6 IDE Pin
Michael Dunn25-May-04 8:51
sitebuilderMichael Dunn25-May-04 8:51 
GeneralRe: VC7 compiler with VC6 IDE Pin
Jim A. Johnson25-May-04 11:55
Jim A. Johnson25-May-04 11:55 
GeneralRe: VC7 compiler with VC6 IDE Pin
Anonymous25-May-04 12:34
Anonymous25-May-04 12:34 
GeneralRe: VC7 compiler with VC6 IDE Pin
Jim A. Johnson25-May-04 15:08
Jim A. Johnson25-May-04 15:08 
GeneralRich Edit Control Pin
monrobot1325-May-04 7:29
monrobot1325-May-04 7:29 
GeneralRe: Rich Edit Control Pin
David Crow25-May-04 8:53
David Crow25-May-04 8:53 
GeneralRe: Rich Edit Control Pin
monrobot1325-May-04 10:47
monrobot1325-May-04 10:47 
GeneralRe: Rich Edit Control Pin
David Crow25-May-04 10:51
David Crow25-May-04 10:51 
GeneralRe: Rich Edit Control Pin
monrobot1325-May-04 12:13
monrobot1325-May-04 12:13 
QuestionMIDI file edition. how to do it? Pin
scoroop25-May-04 7:24
scoroop25-May-04 7:24 
AnswerRe: MIDI file edition. how to do it? Pin
Jim A. Johnson25-May-04 7:38
Jim A. Johnson25-May-04 7:38 
GeneralRe: MIDI file edition. how to do it? Pin
Jeremy Falcon25-May-04 9:17
professionalJeremy Falcon25-May-04 9:17 
AnswerRe: MIDI file edition. how to do it? Pin
David Crow25-May-04 10:35
David Crow25-May-04 10:35 

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.