Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hey i have this code: (got it from Darc)

 

[color=#0000ff]Public[/color] [color=#0000ff]Function[/color] GetScreenCapture([color=#0000ff]ByVal[/color] FileName [color=#0000ff]As[/color] [color=#0000ff]String[/color], [color=#0000ff]Optional[/color] [color=#0000ff]ByVal[/color] FullScreen [color=#0000ff]As[/color] [color=#0000ff]Boolean[/color] = [color=#0000ff]False[/color]) [color=#0000ff]As[/color] Image

[color=#008000]' Captures the current screen and returns as an Image

[/color][color=#008000]' object

[/color][color=#0000ff]Dim[/color] objSK [color=#0000ff]As[/color] SendKeys

[color=#0000ff]Dim[/color] imgCapture [color=#0000ff]As[/color] Image

[color=#0000ff]If[/color] FullScreen = [color=#0000ff]True[/color] [color=#0000ff]Then

[/color][color=#008000]' Print Screen pressed twice here as some systems

[/color][color=#008000]' grab active window "accidentally" on first run

[/color]objSK.SendWait("{PRTSC 2}")

[color=#0000ff]Else

[/color]objSK.SendWait("%{PRTSC}")

[color=#0000ff]End[/color] [color=#0000ff]If

[/color][color=#0000ff]Dim[/color] objData [color=#0000ff]As[/color] IDataObject = Clipboard.GetDataObject()

[color=#0000ff]Return[/color] [color=#0000ff]CType[/color](objData.GetData(DataFormats.Bitmap), Bitmap)

[color=#0000ff]End[/color] [color=#0000ff]Function[/color]

[color=#0000ff]

[/color]

 

well,

here's how you use it

GetScreenCapture(True).Save(Application.StartupPath & "\ScreenShot.png")

 

that's the only way i know of to use it,

what happened to the FileName as String argument?

was it hidden text like my other post i made a while ago(actually, that one i fixed by restarting .net o_O)

but this one seems to be 'permanent'.

why is it that the STRING is optional but not the boolean?

 

pent

 

edit: and i can just delete the string argument in the function and it'll work.. i never use FileName anyways ;) im just wondering why it doesnt require me to enter the string

 

pent

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...