Click here to Skip to main content
16,016,894 members
Home / Discussions / C#
   

C#

 
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 
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 
Thanks for the input...I ended up using a different method to capture the screenshot. It worked perfectly, so it must have been something with the process I was using? I'm running a dual display (stretched desktop) for this application and wanted to make sure it worked across both screens...and it does indeed. Thanks again for the suggestions!!

For anyone interested...here was the solution I found on the net that worked great...though I modified it a little to fit in my project.

<br />
using System;<br />
using System.Drawing;<br />
using System.Drawing.Imaging;<br />
using System.Runtime.InteropServices;<br />
<br />
<br />
class GDI32<br />
{<br />
	[DllImport("GDI32.dll")]<br />
	public static extern bool BitBlt(int hdcDest,int nXDest,int nYDest,<br />
		int nWidth,int nHeight,int hdcSrc,<br />
		int nXSrc,int nYSrc,int dwRop);<br />
	[DllImport("GDI32.dll")]<br />
	public static extern int CreateCompatibleBitmap(int hdc,int nWidth,<br />
		int nHeight);<br />
	[DllImport("GDI32.dll")]<br />
	public static extern int CreateCompatibleDC(int hdc);<br />
	[DllImport("GDI32.dll")]<br />
	public static extern bool DeleteDC(int hdc);<br />
	[DllImport("GDI32.dll")]<br />
	public static extern bool DeleteObject(int hObject);<br />
	[DllImport("GDI32.dll")]<br />
	public static extern int GetDeviceCaps(int hdc,int nIndex);<br />
	[DllImport("GDI32.dll")]<br />
	public static extern int SelectObject(int hdc,int hgdiobj);<br />
 <br />
}<br />
class User32<br />
{<br />
	[DllImport("User32.dll")]<br />
	public static extern int GetDesktopWindow();<br />
	[DllImport("User32.dll")]<br />
	public static extern int GetWindowDC(int hWnd);<br />
	[DllImport("User32.dll")]<br />
	public static extern int ReleaseDC(int hWnd,int hDC);<br />
}<br />
<br />
<br />
namespace Example<br />
{<br />
	public class capture<br />
	{<br />
		public capture()<br />
		{<br />
		}<br />
<br />
		public void CaptureScreen(string fileName,ImageFormat imageFormat)<br />
		{<br />
			int hdcSrc = User32.GetWindowDC(User32.GetDesktopWindow()),<br />
				hdcDest = GDI32.CreateCompatibleDC(hdcSrc),<br />
				hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc,<br />
				GDI32.GetDeviceCaps(hdcSrc,8),GDI32.GetDeviceCaps(hdcSrc,10));<br />
			GDI32.SelectObject(hdcDest,hBitmap);<br />
			GDI32.BitBlt(hdcDest,0,0,GDI32.GetDeviceCaps(hdcSrc,8),<br />
				GDI32.GetDeviceCaps(hdcSrc,10),<br />
				hdcSrc,0,0,0x00CC0020);<br />
			SaveImageAs(hBitmap,fileName,imageFormat);<br />
			Cleanup(hBitmap,hdcSrc,hdcDest);<br />
<br />
			return image;<br />
		}<br />
<br />
		private void Cleanup(int hBitmap,int hdcSrc,int hdcDest)<br />
		{<br />
			User32.ReleaseDC(User32.GetDesktopWindow(),hdcSrc);<br />
			GDI32.DeleteDC(hdcDest);<br />
			GDI32.DeleteObject(hBitmap);<br />
		}     <br />
<br />
		private void SaveImageAs(int hBitmap,string fileName,ImageFormat imageFormat)<br />
		{<br />
			Bitmap image =<br />
				new Bitmap(Image.FromHbitmap(new IntPtr(hBitmap)),<br />
				Image.FromHbitmap(new IntPtr(hBitmap)).Width,<br />
				Image.FromHbitmap(new IntPtr(hBitmap)).Height);<br />
			image.Save(fileName,imageFormat);<br />
		}<br />
	}<br />
}<br />

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 
QuestionDocumentation Pin
Anonymous29-Aug-05 1:33
Anonymous29-Aug-05 1:33 
AnswerRe: Documentation Pin
Dario Solera29-Aug-05 4:09
Dario Solera29-Aug-05 4:09 

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.