Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Win API / January 2008



Tip: Looking for answers? Try searching our database.

Constants for API functions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian Mitchell - 10 Dec 2007 01:53 GMT
Where is the best place to get the constant values for some of the API
functions?

For instance, using the GPO API I have some constants like
GPO_LIST_FLAG_MACHINE which I know is &H1 because I had to Google it. How
else would I get the &H1 value? It is not included in the MSDN
documentation.

Thanks!!
MikeD - 10 Dec 2007 03:31 GMT
> Where is the best place to get the constant values for some of the API
> functions?
[quoted text clipped - 3 lines]
> else would I get the &H1 value? It is not included in the MSDN
> documentation.

Your absolute best source of these constants are C++ header files (these are
files with a .h extension). The MSDN documentation will tell you (usually)
which header file.

Just for an example, in searching the Oct 2001 MSDN Library, I found
GPO_LIST_FLAG_MACHINE in the topic for the GetGPOList function. The docs
mention the header being Userenv.h. Looking in that file, I found this:

#define GPO_LIST_FLAG_MACHINE        0x00000001  // Return machine policy
information
#define GPO_LIST_FLAG_SITEONLY       0x00000002  // Return site policy
information only
#define GPO_LIST_FLAG_NO_WMIFILTERS  0x00000004  // Ignore WMI filters when
filtering GPO's
#define GPO_LIST_FLAG_NO_SECURITYFILTERS 0x00000008 // Ignore security
filters

Obviously, you need to convert this to VB syntax, so it helps to know at
least a little about C++.

Also, you should install the latest Platform SDK.  This will ensure you have
the latest .h files. Search Microsoft Downloads for various Platform SDKs:

http://www.microsoft.com/downloads/Search.aspx

Here's the link for the SDK to Windows Server 2008:
http://www.microsoft.com/downloads/details.aspx?FamilyID=3671e40c-d700-4509-9ed0
-30e00ea38a9c&DisplayLang=en


Here's the link to the SDK for Vista:
http://www.microsoft.com/downloads/details.aspx?FamilyID=c2b1e300-f358-4523-b479
-f53d234cdccf&DisplayLang=en


And here's the link to the SDK for Windows Server 2003 SP1:
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E
-40C0EC4F68E5&displaylang=en


Signature

Mike
Microsoft MVP Visual Basic

Michael C - 10 Dec 2007 03:37 GMT
> Where is the best place to get the constant values for some of the API
> functions?
[quoted text clipped - 3 lines]
> else would I get the &H1 value? It is not included in the MSDN
> documentation.

Where you find these things is variable depending on where that particular
manufacturer publishes them. As MikeD said for MS they are usually published
in SDKs which can be downloaded from Microsoft. For other manufacturers they
could be published in any way.

Michael
Brian Mitchell - 10 Dec 2007 03:47 GMT
Thank you for the replies, I am new to using the APIs and I appreciate the
point in the right direction.

> Where is the best place to get the constant values for some of the API
> functions?
[quoted text clipped - 5 lines]
>
> Thanks!!
DanS - 11 Dec 2007 03:40 GMT
> Where is the best place to get the constant values for some of the API
> functions?
[quoted text clipped - 5 lines]
>
> Thanks!!

Many times I've found constant values by way of Google using a quoted
phrase.

"const GPO_LIST_FLAG_MACHINE ="

That one only shows 4 hits, but the first 3 you could copy and paste right
from the results.
MikeD - 11 Dec 2007 23:58 GMT
>> Where is the best place to get the constant values for some of the API
>> functions?
[quoted text clipped - 13 lines]
> That one only shows 4 hits, but the first 3 you could copy and paste right
> from the results.

But that's relying on someone having asked for that particular const
declaration and gotten the declaration posted in a reply. It's certainly
possible one needs a constant that's never been asked about. If you have the
.h files, it's probably easier to just find it in them. Nothing difficult
about converting C++ constants to VB.

Signature

Mike
Microsoft MVP Visual Basic

Karl E. Peterson - 12 Dec 2007 17:42 GMT
>> Many times I've found constant values by way of Google using a quoted
>> phrase.
[quoted text clipped - 6 lines]
> But that's relying on someone having asked for that particular const
> declaration and gotten the declaration posted in a reply.

Or finding sample code posted, like at Randy's site.

> It's certainly possible one needs a constant that's never been asked about.

Definitely.

> If you have the
> .h files, it's probably easier to just find it in them. Nothing difficult
> about converting C++ constants to VB.

Yeah, I have TextPad setup to scan through them all, for me, when I need 'em.
Definitely best, but it can be frustrating at times.  In particular when you get
things with multiple indirections in the damned definitions... <grumble>
Signature

.NET: It's About Trust!
http://vfred.mvps.org

Gloops - 27 Jan 2008 17:42 GMT
Hello,

If you use the APIs in Visual Basic, this is an address to look at :

http://allapi.mentalis.org/

The main page says goodbye, but dated 2002 ...

They used to propose a download for an api viewer, here is one that
seems to stay updated -less documented with examples than the previous
one, but with the formats for more various languages :

http://www.activevb.de/rubriken/apiviewer/index-apiviewer.html

The site is german but it seems an English speaker can find one's way.

If you speak French, here is a very nice place to find info about APIs
-although I am less sure about the constants :

http://docvb.free.fr/api.php

_____________________________________________
Brian Mitchell a écrit, le 10/12/2007 02:53 :
> Where is the best place to get the constant values for some of the API
> functions?
[quoted text clipped - 5 lines]
>
> Thanks!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.