using Win32 Constants

  • Thread starter Thread starter Jarod_24
  • Start date Start date
J

Jarod_24

I've managed find out how to start using the Win32 API's

But some of these methods got constants that you should use when caling
them. for example
the LockSetForegroundWindow got a unsigned integer as a parameter that
either can be the value of "LSFW_LOCK" or "LSFW_UNLOCK"
How do i get hold of these constants?

Is there some <DllImport-thing that i can use to get hold of these
constants?
and what should i use instead of "UInt32" (wich VB.net dosent support) when
using the API's

http://msdn.microsoft.com/library/d.../Windows/WindowReference/WindowFunctions/Lock
SetForegroundWindow.asp
 
* "Jarod_24 said:
But some of these methods got constants that you should use when caling
them. for example
the LockSetForegroundWindow got a unsigned integer as a parameter that
either can be the value of "LSFW_LOCK" or "LSFW_UNLOCK"
How do i get hold of these constants?

Is there some <DllImport-thing that i can use to get hold of these
constants?
No.

and what should i use instead of "UInt32" (wich VB.net dosent support) when
using the API's

'UInt32' is available in VB.NET too.
 
Jarod_24,
In addition to the other comments.

I normally define constants such as "LSFW_LOCK" or "LSFW_UNLOCK" as part of
an enum, which then provides intellisense to the API itself.

Something like (untested):

Enum LockCode As Integer
Lock = 1
Unlock = 2
End Enum

Declare Auto Function LockSetForegroundWindow Lib "user32" (ByVal
lockCode As LockCode) As Boolean

As Herfried stated you can use UInt32 in the api declaration itself, however
I normally use an enum of the same size (32bit).
How do i get hold of these constants?
Of course finding the values for the Enum is the "challange". ;-) I normally
look at the C++ include files as I can read C/C++, For VS.NET 2003 the
include files are found in:

\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include

Otherwise you can use a tool such as the one Herfried identified.

Hope this helps
Jay
 
Back
Top