msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Constants for API functions

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI
Author Message
Brian Mitchell



Joined: 10 Dec 2007
Posts: 3

PostPosted: Mon Dec 10, 2007 12:53 am    Post subject: Constants for API functions Reply with quote

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!!

Archived from group: microsoft>public>vb>winapi
Back to top
View user's profile Send private message
MikeD



Joined: 04 Oct 2007
Posts: 3348

PostPosted: Mon Dec 10, 2007 3:31 am    Post subject: Re: Constants for API functions Reply with quote

"Brian Mitchell" wrote in message
news:%23zsi69sOIHA.1188@TK2MSFTNGP04.phx.gbl...
> 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.


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

--
Mike
Microsoft MVP Visual Basic
Back to top
View user's profile Send private message
Michael C



Joined: 04 Oct 2007
Posts: 335

PostPosted: Mon Dec 10, 2007 7:37 pm    Post subject: Re: Constants for API functions Reply with quote

"Brian Mitchell" wrote in message
news:%23zsi69sOIHA.1188@TK2MSFTNGP04.phx.gbl...
> 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.

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
Back to top
View user's profile Send private message
Brian Mitchell



Joined: 10 Dec 2007
Posts: 3

PostPosted: Mon Dec 10, 2007 2:47 am    Post subject: Re: Constants for API functions Reply with quote

Thank you for the replies, I am new to using the APIs and I appreciate the
point in the right direction.


"Brian Mitchell" wrote in message
news:%23zsi69sOIHA.1188@TK2MSFTNGP04.phx.gbl...
> 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!!
>
>
Back to top
View user's profile Send private message
DanS



Joined: 04 Oct 2007
Posts: 212

PostPosted: Tue Dec 11, 2007 2:40 am    Post subject: Re: Constants for API functions Reply with quote

"Brian Mitchell" wrote in
news:#zsi69sOIHA.1188@TK2MSFTNGP04.phx.gbl:

> 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!!

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.
Back to top
View user's profile Send private message
MikeD



Joined: 04 Oct 2007
Posts: 3348

PostPosted: Tue Dec 11, 2007 11:58 pm    Post subject: Re: Constants for API functions Reply with quote

"DanS" wrote in message @216.196.97.142...
> "Brian Mitchell" wrote in
> news:#zsi69sOIHA.1188@TK2MSFTNGP04.phx.gbl:
>
>> 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!!
>
> 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.

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.

--
Mike
Microsoft MVP Visual Basic
Back to top
View user's profile Send private message
Karl E. Peterson



Joined: 04 Oct 2007
Posts: 4836

PostPosted: Wed Dec 12, 2007 2:42 pm    Post subject: Re: Constants for API functions Reply with quote

MikeD wrote:
>> 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.
>
> 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...
--
..NET: It's About Trust!
http://vfred.mvps.org
Back to top
View user's profile Send private message
Gloops



Joined: 27 Jan 2008
Posts: 1

PostPosted: Sun Jan 27, 2008 11:42 pm    Post subject: Re: Constants for API functions Reply with quote

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?
>
> 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!!
>
>

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group