Home > Archive > C# > March 2004 > obtain win desktop picture
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
obtain win desktop picture
|
|
| MuZZy 2004-03-28, 10:28 pm |
| Hello,
How do i get Windows Desktop picture to further put it into pictureBox
component?
Thank you,
Andrey
| |
| Craig 2004-03-28, 10:28 pm |
| Xref: kermit microsoft.public.dotnet.csharp.general:2334 microsoft.public.dotnet.languages.csharp:253725
The path used for the current wallpaper is stored in the registry, I don't
remember the exact key, you'll have to search for it.
So, read this key and then assign it to the pictureBox.Image property...
"MuZZy" <leyandrew@yahoo.com> wrote in message
news:tpu_b.110880$uV3.598285@attbi_s51...
> Hello,
>
> How do i get Windows Desktop picture to further put it into pictureBox
> component?
>
> Thank you,
> Andrey
>
>
| |
| MuZZy 2004-03-28, 10:28 pm |
| Well, I didn't men wallpaper, i meant everything you see on the screen.
On Delphi i've done it this way:
Class Procedure TMuzzyServer.getScreen( ABitmap : TBitmap );
Var
dc : Integer;
srect : TRect;
scanvas : TCanvas;
Begin
// get desktop HDC
dc := GetWindowDC(0);
// Create a rectangle with screen size
srect := Rect(0, 0, Screen.Width, Screen.Height);
// Create a canvas for desktop HDC
scanvas := TCanvas.Create();
scanvas.Handle := dc;
ABitmap.Height := srect.Bottom;
ABitmap.Width := srect.Right;
ABitmap.Canvas.CopyRect(srect, scanvas, srect);
ReleaseDC(0, dc);
scanvas.Free;
End;
/////
So i obtained HDC of desktop window which has HANDLE = 0, and then played
around.
How do i do in .NET?
Thank you,
Andrey
"Craig" <cscheets@remoovdis.kc.rr.com> wrote in message
news:uNY6wYl%23DHA.3032@TK2MSFTNGP10.phx.gbl...
> The path used for the current wallpaper is stored in the registry, I don't
> remember the exact key, you'll have to search for it.
>
> So, read this key and then assign it to the pictureBox.Image property...
>
>
> "MuZZy" <leyandrew@yahoo.com> wrote in message
> news:tpu_b.110880$uV3.598285@attbi_s51...
>
>
| |
| MuZZy 2004-03-28, 10:28 pm |
|
"MuZZy" <leyandrew@yahoo.com> wrote in message
news:97v_b.111251$uV3.598257@attbi_s51...[color=darkred]
> Well, I didn't men wallpaper, i meant everything you see on the screen.
>
> On Delphi i've done it this way:
>
> Class Procedure TMuzzyServer.getScreen( ABitmap : TBitmap );
> Var
> dc : Integer;
> srect : TRect;
> scanvas : TCanvas;
> Begin
> // get desktop HDC
> dc := GetWindowDC(0);
> // Create a rectangle with screen size
> srect := Rect(0, 0, Screen.Width, Screen.Height);
> // Create a canvas for desktop HDC
> scanvas := TCanvas.Create();
> scanvas.Handle := dc;
> ABitmap.Height := srect.Bottom;
> ABitmap.Width := srect.Right;
> ABitmap.Canvas.CopyRect(srect, scanvas, srect);
> ReleaseDC(0, dc);
> scanvas.Free;
> End;
>
> /////
>
> So i obtained HDC of desktop window which has HANDLE = 0, and then played
> around.
>
> How do i do in .NET?
>
> Thank you,
> Andrey
>
> "Craig" <cscheets@remoovdis.kc.rr.com> wrote in message
> news:uNY6wYl%23DHA.3032@TK2MSFTNGP10.phx.gbl...
don't[color=darkred]
Basicly what i want to do is to capture screen images in certain intervals
of time or on certain event, and put it in a database. So i need a screen
image, same as if i pressed [PrintScreen] button.
| |
| chris 2004-03-28, 10:28 pm |
| MuZZy wrote:
> Hello,
>
> How do i get Windows Desktop picture to further put it into pictureBox
> component?
>
> Thank you,
> Andrey
>
>
Hi -
Check out "Screen Capture using C# and GDI+" here:
http://www.c-sharpcorner.com/Code/2...reenCapture.asp
Good luck.
--
chris
| |
| MuZZy 2004-03-28, 10:28 pm |
| "chris" <newsgroups@boxfrog.com> wrote in message
news:pe-dnVpnkoi_F6fdRVn-tw@comcast.com...
> MuZZy wrote:
>
> Hi -
>
> Check out "Screen Capture using C# and GDI+" here:
>
> http://www.c-sharpcorner.com/Code/2...reenCapture.asp
>
> Good luck.
>
> --
> chris
Thanks a lot, Chris!
|
|
|
|
|