Re: WIN API example in C++

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Wayne <wayne_r@xxxxxxxxxxx> schrieb im Beitrag
<OcTLU1mSFHA.3088@xxxxxxxxxxxxxxxxxxxx>...
> I'm sorry to hear that!
> So neither of us knows?

a)
A very short introduction to the Visual Basic Declare statement:

Declare Function OSRegOpenKey _
Lib "advapi32" _
Alias "RegOpenKeyA" _
( _
ByVal hKey As Long, _
ByVal lpszSubKey As String, _
phkResult As Long _
) As Long

- "Declare" introduces the respective external function to the VB project
- "Function '...'" specifies that the respective external function '...'
will return a value
- "Lib '...'" names the library which provides the external function
(filename extensions like ".DLL" etc. are optional)
- "Alias '...'" gives the name of the external function by which it is
exported from the respective library (only needed if differemt from the
name given after 'Function')
- "(" and ")" hold the external function's parameters
- "ByVal" specifies that the respective parameter will be passed to the
external function as a value ("ByRef" (optional) specifies that a pointer
to the value will be passed)
- "As Long" specifies the VB data type "Long" as the data type of the
respective parameter
- "As String" specifies the VB data type "String" as the data type of the
respective parameter
- "(...) As Long" specifies the VB data type "Long" as the return value's
data type

The only thing that you need to now about this to use OSRegOpenKey() in C++
is
- that the name of the external function is not "OSRegOpenKey" but
"RegOpenKeyA",
- that the trailing "A" is just a suffix indicating that "RegOpenKeyA" is
the ANSI version of "RegOpenKey" and
- that the function RegOpenKeyA() is provided by the library ADVAPi32.DLL".

Although I haven't done this I am almost sure that Google will provide you
with hundreds of sample codes in C/C++ for RegOpenKey().

b) It is really ridiculous to ask participants in a Visual Basic newsgroup
to provide you with C++ code!! There are really enough C/C++ related
newsgroups on the web, and you can be sure that in at least one of these
newsgroups there is at least one person who knows RegOpenKey(A) and is able
to provide you with sample code.

--
----------------------------------------------------------------------
THORSTEN ALBERS Universität Freiburg
albers@
uni-freiburg.de
----------------------------------------------------------------------

.



Relevant Pages

  • Re: module problems
    ... You can *NOT* redeclare the information. ... double precision:: kbdoe,... ... There is no such external function; ... you need to declare the type like this. ...
    (comp.lang.fortran)
  • Re: External structure definitions
    ... > the external function I get errors due to the structure ... Is it similar to to using extern to declare ... The beauty of header files. ... int main ...
    (comp.lang.cpp)
  • External structure definitions
    ... the external function I get errors due to the structure being unknown. ... How should I go about telling the linker where the definition for the ... Is it similar to to using extern to declare functions ...
    (comp.lang.cpp)
  • Re: SQL function wont work
    ... I tried to create an external function to call the object description ... API QUSROBJD and return the OBJD0200 format. ... objtype varchar) ... declare object_info chardefault ' '; ...
    (comp.sys.ibm.as400.misc)