GDI+ programming under VB.NET (2005+)

  • Thread starter Thread starter kimiraikkonen
  • Start date Start date
K

kimiraikkonen

Hi all,
I wondered what a code might look like for a screen capture software
then looked at some samples about GDI like screen capturing and
others, there are a lot of classes like CreateDC or a lot of
parameters like "hSDC or hMDC", "FW or FH..." which i don't know at
all. How will i know what arguements and classes are used for. Is MSDN
GDI+ API documentation good resource?
(Only found this page to begin: http://msdn2.microsoft.com/en-us/library/ms533798.aspx)

Thanks.
 
Hi all,
I wondered what a code might look like for a screen capture software
then looked at some samples about GDI like screen capturing and
others, there are a lot of classes like CreateDC or a lot of
parameters like "hSDC or hMDC", "FW or FH..." which i don't know at
all. How will i know what arguements and classes are used for. Is MSDN
GDI+ API documentation good resource?
(Only found this page to begin:http://msdn2.microsoft.com/en-us/library/ms533798.aspx)

Thanks.

See this:

http://www.bobpowell.net/capture.htm

and

http://www.bobpowell.net


Chris
 
Good thanks, but now i wonder how an "any active window(not my
project's window)" can be captured. I've done capturing entire screen
but i feel that i've to use a necessary user32 or gdi32 api call to
determine which window is active to be captured. (need VB.net code)

You would need to call the GetDC method with the handle of the window
in question. To get the handle use the FindWindow API function.

For the proper declares, go to www.pinvoke.net.

They have a plugin that allows you to get the proper signatures right
inside Visual Studio.

For example, for FindWindow it is:

<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function FindWindow( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As IntPtr
End Function

pinvoke.net also has examples for many of the functions.

Chris
 
You would need to call the GetDC method with the handle of the window
in question. To get the handle use the FindWindow API function.

For the proper declares, go towww.pinvoke.net.

They have a plugin that allows you to get the proper signatures right
inside Visual Studio.

For example, for FindWindow it is:

<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function FindWindow( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As IntPtr
End Function

pinvoke.net also has examples for many of the functions.

Chris

Hi Chris,
Thanks for the tip, but whenever i use "dllimport" i get error
message saying "dllimport not defined". After changing it to
"Runtime.InteropServices.DllImport" this time "charset" is not
declared.

On pinvoke.net there more than one declaration code blocks:
http://pinvoke.net/default.aspx/user32.FindWindow

Which is the correct one?

Thanks!
 
Hi Chris,
Thanks for the tip, but whenever i use "dllimport" i get error
message saying "dllimport not defined". After changing it to
"Runtime.InteropServices.DllImport" this time "charset" is not
declared.

Be sure to add Imports System.Runtime.InteropServices to the top of
your file.
On pinvoke.net there more than one declaration code blocks:http://pinvoke.net/default.aspx/user32.FindWindow

Which is the correct one?

There are three different ones: FindWindow, FindWindowByClass, and
FindWindowByCaption.

Use the one that is most appropriate for you.

Chris
 
Back
Top