Click here to Skip to main content
15,917,005 members
Home / Discussions / C#
   

C#

 
GeneralRe: showDialog Pin
xilefxilef29-Aug-05 10:15
xilefxilef29-Aug-05 10:15 
AnswerRe: showDialog Pin
Stefan Troschuetz29-Aug-05 21:25
Stefan Troschuetz29-Aug-05 21:25 
GeneralRe: showDialog Pin
xilefxilef30-Aug-05 5:53
xilefxilef30-Aug-05 5:53 
GeneralRe: showDialog Pin
Stefan Troschuetz30-Aug-05 7:31
Stefan Troschuetz30-Aug-05 7:31 
QuestionHow to avoid getting code when decompile exe? Pin
pubududilena29-Aug-05 6:48
pubududilena29-Aug-05 6:48 
AnswerRe: How to avoid getting code when decompile exe? Pin
Dan Neely29-Aug-05 7:03
Dan Neely29-Aug-05 7:03 
AnswerRe: How to avoid getting code when decompile exe? Pin
Marcello Cantelmo29-Aug-05 11:37
Marcello Cantelmo29-Aug-05 11:37 
QuestionTroubles Capturing a Screen Shot - 'Print Screen' key functionality Pin
rcurrie29-Aug-05 6:13
rcurrie29-Aug-05 6:13 
Well I've gone through numerous examples and code samples here on the Code project as well as other places on the net and I just can't seem to get them to work properly. All I am trying to do is capture a screen shot of the entire desktop...INCLUDING all windows, programs & applications open on the desktop. The problem I am having is that whenever I take a screen shot, not all applications are captured. Currently I have an application that opens up several forms internally...as well as several IE Browsers. When I capture the screen the application is captured, but all of the forms and IE browsers that are overlaying the application are NOT captured. Almost as if they were all 'hidden' the screen shot was captured, then they were displayed again. Could someone please please help?? I'm just thoroughly confussed. Whenever I use the 'Print Screen' button the entire screen(s) contents are all captured perfectly, what am I doing wrong? Any and all help would be greatly appreciated, thanks so much. The code I am using is as follows...

public static Bitmap GetDesktopWindowCaptureAsBitmap()<br />
		{<br />
			Rectangle rcScreen = Rectangle.Empty;<br />
			Screen[] screens = Screen.AllScreens;<br />
 <br />
			// Create a rectangle encompassing all screens...<br />
			foreach(Screen screen in screens)<br />
				rcScreen = Rectangle.Union(rcScreen, screen.Bounds);<br />
     <br />
			// Create a composite bitmap of the size of all screens...<br />
			Bitmap finalBitmap = new Bitmap(rcScreen.Width, rcScreen.Height);<br />
 <br />
			// Get a graphics object for the composite bitmap and initialize it...<br />
			Graphics g = Graphics.FromImage(finalBitmap);<br />
			g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;<br />
			g.FillRectangle(<br />
				SystemBrushes.Desktop,<br />
				0,<br />
				0, <br />
				rcScreen.Width - rcScreen.X, <br />
				rcScreen.Height - rcScreen.Y);<br />
     <br />
			// Get an HDC for the composite area...<br />
			IntPtr hdcDestination = g.GetHdc();<br />
 <br />
			// Now, loop through screens, <br />
			// Blting each to the composite HDC created above...<br />
			foreach(Screen screen in screens)<br />
			{<br />
				// Create DC for each source monitor...<br />
				IntPtr hdcSource = Win32.CreateDC(<br />
					IntPtr.Zero,<br />
					screen.DeviceName,<br />
					IntPtr.Zero,<br />
					IntPtr.Zero);<br />
 <br />
				// Blt the source directly to the composite destination...<br />
				int xDest = screen.Bounds.X - rcScreen.X;<br />
				int yDest = screen.Bounds.Y - rcScreen.Y;<br />
 <br />
				bool success = Win32.StretchBlt(<br />
					hdcDestination,<br />
					xDest,<br />
					yDest, <br />
					screen.Bounds.Width, <br />
					screen.Bounds.Height, <br />
					hdcSource, <br />
					0, <br />
					0, <br />
					screen.Bounds.Width, <br />
					screen.Bounds.Height, <br />
					(int)Win32.TernaryRasterOperations.SRCCOPY);<br />
            <br />
				if (!success)<br />
				{<br />
					System.ComponentModel.Win32Exception win32Exception =<br />
						new System.ComponentModel.Win32Exception();     <br />
					System.Diagnostics.Trace.WriteLine(win32Exception);<br />
				}<br />
 <br />
				// Cleanup source HDC...<br />
				Win32.DeleteDC(hdcSource);    <br />
			}<br />
 <br />
			// Cleanup destination HDC and Graphics...<br />
			g.ReleaseHdc(hdcDestination);<br />
			g.Dispose();<br />
     <br />
			// Return composite bitmap which will become our Form's PictureBox's image...<br />
			return finalBitmap;<br />
		}

AnswerRe: Troubles Capturing a Screen Shot - 'Print Screen' key functionality Pin
Rei Miyasaka29-Aug-05 12:40
Rei Miyasaka29-Aug-05 12:40 
GeneralRe: Troubles Capturing a Screen Shot - 'Print Screen' key functionality Pin
rcurrie30-Aug-05 6:58
rcurrie30-Aug-05 6:58 
AnswerRe: Troubles Capturing a Screen Shot - 'Print Screen' key functionality Pin
Mohamad Al Husseiny29-Aug-05 13:04
Mohamad Al Husseiny29-Aug-05 13:04 
QuestionDubbging using JIT Debugger Pin
LiamD29-Aug-05 5:16
LiamD29-Aug-05 5:16 
QuestionHighlight office area in the map? Pin
BEXPERT29-Aug-05 5:12
BEXPERT29-Aug-05 5:12 
AnswerRe: Highlight office area in the map? Pin
Dave Kreskowiak29-Aug-05 13:22
mveDave Kreskowiak29-Aug-05 13:22 
GeneralRe: Highlight office area in the map? Pin
BEXPERT29-Aug-05 20:00
BEXPERT29-Aug-05 20:00 
GeneralRe: Highlight office area in the map? Pin
Dave Kreskowiak30-Aug-05 2:21
mveDave Kreskowiak30-Aug-05 2:21 
QuestionSystem.Net.Sockets class delay Pin
Jason Weibel29-Aug-05 4:54
Jason Weibel29-Aug-05 4:54 
QuestionHow to send clicks Pin
Dario Solera29-Aug-05 4:52
Dario Solera29-Aug-05 4:52 
AnswerRe: How to send clicks Pin
Daniel Turini29-Aug-05 7:53
Daniel Turini29-Aug-05 7:53 
AnswerRe: How to send clicks Pin
Mohamad Al Husseiny29-Aug-05 8:21
Mohamad Al Husseiny29-Aug-05 8:21 
GeneralRe: How to send clicks Pin
Dario Solera29-Aug-05 8:55
Dario Solera29-Aug-05 8:55 
QuestionDetermining Enter events cause Pin
Member 197725229-Aug-05 3:39
Member 197725229-Aug-05 3:39 
AnswerRe: Determining Enter events cause Pin
Dave Kreskowiak29-Aug-05 4:50
mveDave Kreskowiak29-Aug-05 4:50 
QuestionString Size Problem Pin
wasife29-Aug-05 3:21
wasife29-Aug-05 3:21 
AnswerRe: String Size Problem Pin
occcy29-Aug-05 3:46
occcy29-Aug-05 3:46 

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.