Getting the desktop screenshot

  • Thread starter Thread starter Rory Becker
  • Start date Start date
R

Rory Becker

Hi all
I need to get the desktop screenshot.
I use vb.net 2005
The function/sub should run in a DLL and not a form (I cannot use
"Imports
System.Drawing" because of that..)---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Please advise - I googled already...

Sorry, I don't have an answer to your question

However I must call you on
 
Sorry, I don't have an answer to your question,

but I have to call you on...
-----------------------------------------
The function/sub should run in a DLL and not a form (I cannot use
"Imports
System.Drawing" because of that..)
-----------------------------------------

Why does the fact that this must run in a dll prevent you from importing
system.drawing?

You can import references to any dll or namespace from either a .dll or an
..exe.

In 2005 you can even reference an .exe and import from that into a dll.
 
Hi all
I need to get the desktop screenshot.
I use vb.net 2005
The function/sub should run in a DLL and not a form (I cannot use "Imports
System.Drawing" because of that..)
Please advise - I googled already...

TIA
Guy
 
I would agree with Rory's point/question.

One way however with your constraint, would be to use SendKeys, sending the
key to copy the screen to the clipboard, then grab the contents from the
clipboard.
 
Did you add a reference to System.Drawing? You'll need that in addition
to the import line.
 
Thanks all for the reply..

Ok then why cannot I use:

Dim picScreen As System.drawing.image

Not to mention that I have an error here already :

Imports System.Drawing




TIA
Guy
 
AHAAAAAA
So that solved it :)

Thanks a lot Steve!
(Is there a logic behind adding both a Reference and Import?

;)
Guy
 
Adding a reference to a dll lets you call a dll. Adding an import lets you
put it on speed dial (or at least omit the first part of the assembly name).
 
Back
Top