Click here to Skip to main content
15,894,546 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDisplay Pictures Problem -- Again ;) Pin
bobber2051-May-08 18:46
bobber2051-May-08 18:46 
AnswerRe: Display Pictures Problem -- Again ;) Pin
bobber2051-May-08 19:07
bobber2051-May-08 19:07 
AnswerRe: Display Pictures Problem -- Again ;) Pin
Rajesh R Subramanian1-May-08 19:11
professionalRajesh R Subramanian1-May-08 19:11 
GeneralRe: Display Pictures Problem -- Again ;) Pin
Nelek1-May-08 22:34
protectorNelek1-May-08 22:34 
GeneralRe: Display Pictures Problem -- Again ;) Pin
Mark Salsbery2-May-08 5:39
Mark Salsbery2-May-08 5:39 
GeneralRe: Display Pictures Problem -- Again ;) Pin
bobber2052-May-08 12:23
bobber2052-May-08 12:23 
AnswerRe: Display Pictures Problem -- Again ;) Pin
Hamid_RT2-May-08 5:05
Hamid_RT2-May-08 5:05 
GeneralRe: Display Pictures Problem -- Again ;) Pin
bobber2052-May-08 12:25
bobber2052-May-08 12:25 
Edit. sorry for double posting. seems I posted my reply in the wrong spot.

Thanks for all the suggestions so far. I've tried doing it in WM_PAINT with just a little success.

Code is at end of post. I have a picture box control with type Bitmap on my control as position 0,0. I basically want a window where it just displays an image.
However with the current code below, I am unable to get the image to not "be covered up". If I take another window and cover up MY window and then move away, I can then see the image as I desire.

However this is not desired behavior. I have a function commented out called RepaintWindow. It's one of my custom functions. It gets the client rect of the window and calls invalidaterect for that section. A shortcut.

When that is not commented out, I get to see my image (again when moving another window onto MY window) for a brief second then it gets covered by up by gray again.

I am missing a small detail here and by god if I can't see what that is! Thanks for the help.

<br />
	case WM_PAINT:<br />
		{<br />
<br />
				if(firstTime)<br />
				{<br />
					<br />
					<br />
					if(status == Gdiplus::Ok)<br />
					{<br />
						HWND staticwindow = GetDlgItem(hwnd,IDC_STATIC);<br />
						HDC dc = GetDC(staticwindow);<br />
						<br />
						const int size = ad.message.size();<br />
						char* placeholder = new char[size+1];<br />
						strcpy(placeholder,ad.message.c_str());<br />
<br />
						placeholder[size+1] = '\0';<br />
						<br />
						WCHAR temp[100];<br />
						mbstowcs(temp, placeholder, size+1);<br />
						<br />
						Gdiplus::Bitmap srcBitmap(temp, FALSE);<br />
						Gdiplus::Graphics wndGraphics(dc);<br />
<br />
						Gdiplus::SizeF SIZE;<br />
						srcBitmap.GetPhysicalDimension(&SIZE);<br />
<br />
						int height = SIZE.Height;<br />
						int width = SIZE.Width;<br />
<br />
						wndGraphics.DrawImage(&srcBitmap, 0, 0);<br />
						<br />
						SetWindowPos(hwnd,HWND_BOTTOM,0,0,width,height,SWP_NOMOVE |SWP_NOZORDER );<br />
						SetWindowPos(staticwindow,HWND_BOTTOM,0,0,width,height,SWP_NOMOVE );<br />
<br />
						//SetWindowPos(hwnd,GetParent(hwnd),0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);<br />
					<br />
<br />
						<br />
						//RepaintWindow(hwnd);<br />
					<br />
						<br />
						<br />
						firstTime = true;<br />
						<br />
						//Gdiplus::GdiplusShutdown(dwToken);<br />
						<br />
					}//C:\\Documents and Settings\\Alex\\My Documents\\My Pictures\alex.jpg<br />
<br />
				}<br />

GeneralRe: Display Pictures Problem -- Again ;) Pin
bobber2052-May-08 14:17
bobber2052-May-08 14:17 
GeneralRe: Display Pictures Problem -- Again ;) Pin
Rajkumar R2-May-08 20:16
Rajkumar R2-May-08 20:16 
GeneralRe: Display Pictures Problem -- Again ;) Pin
bobber2052-May-08 20:48
bobber2052-May-08 20:48 
GeneralRe: Display Pictures Problem -- Again ;) Pin
Mark Salsbery3-May-08 7:34
Mark Salsbery3-May-08 7:34 
GeneralRe: Display Pictures Problem -- Again ;) [modified] Pin
bobber2053-May-08 7:44
bobber2053-May-08 7:44 
GeneralRe: Display Pictures Problem -- Again ;) [modified] Pin
Mark Salsbery3-May-08 8:15
Mark Salsbery3-May-08 8:15 
QuestionFind function in CTreeCtrl Pin
Anu_Bala1-May-08 18:45
Anu_Bala1-May-08 18:45 
QuestionRe: Find function in CTreeCtrl Pin
Rajesh R Subramanian1-May-08 18:51
professionalRajesh R Subramanian1-May-08 18:51 
AnswerRe: Find function in CTreeCtrl Pin
Anu_Bala1-May-08 19:00
Anu_Bala1-May-08 19:00 
QuestionRe: Find function in CTreeCtrl Pin
Rajesh R Subramanian1-May-08 19:10
professionalRajesh R Subramanian1-May-08 19:10 
AnswerRe: Find function in CTreeCtrl Pin
Anu_Bala1-May-08 19:41
Anu_Bala1-May-08 19:41 
AnswerRe: Find function in CTreeCtrl Pin
Rajesh R Subramanian1-May-08 20:19
professionalRajesh R Subramanian1-May-08 20:19 
QuestionWhy do i can not delete Registry Keys ? Pin
gabbana1-May-08 13:39
gabbana1-May-08 13:39 
AnswerRe: Why do i can not delete Registry Keys ? Pin
Randor 1-May-08 14:17
professional Randor 1-May-08 14:17 
GeneralRe: Why do i can not delete Registry Keys ? Pin
gabbana1-May-08 15:19
gabbana1-May-08 15:19 
AnswerRe: Why do i can not delete Registry Keys ? Pin
David Crow2-May-08 5:05
David Crow2-May-08 5:05 
AnswerRe: Why do i can not delete Registry Keys ? Pin
Hamid_RT2-May-08 5:06
Hamid_RT2-May-08 5:06 

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.