API for Visual C++ Log Out | Topics | Search
Moderators | Edit Profile

X-Ways Support Forum » Advanced Features » API for Visual C++ « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Dave Witten (Wittend)
Posted on Monday, Jul 21, 2003 - 22:17:   

The WinHex program has proved very useful to me, and the API looks very promising for certain projects I would like to pursue. Unfortunately, I have the following problems/requests:

1) The "LONGLONG" and related types in the .h file are meaningless to Visual C++ 6.0. What is intended by this?

2) Are there any C/C++ examples available to help getting started?

3) There is no accompanying import library, and the accompanying whxapi.def appears to be incompatible or at least unuseful to both the VC++ IDE and link/lib. I attempted to create an import library using the LIB /DEF: option, but even using the library produced I get 'unresolved external symbol' errors for every API call I
include.


A typical error message indicates:

unresolved external symbol "int __stdcall WHX_Init(int)" (?WHX_Init@@YGHH@Z)

I have added:

#ifdef __cplusplus
extern "C" {
#endif

....

#ifdef __cplusplus
}
#endif

as a wrapper around the API calls, but I still recieve:

unresolved external symbol _WHX_Init@4

Can you provide any suggestions?
Top of pagePrevious messageNext messageBottom of page Link to this message

Stefan Fleischmann (Admin)
Posted on Monday, Jul 21, 2003 - 22:37:   

1) LONGLONG is a data type used by Microsoft in the Windows API, a 64-bit integer. http://msdn.microsoft.com/library/en-us/winprog/winprog/windows_data_types.asp

Also see http://msdn.microsoft.com/library/en-us/winprog/winprog/large_integers.asp .

2) No, sorry.

3) I suggest you take the import libraries of the Windows API used by your compiler as an example, or see your compiler's documentation on how to import and call functions in DLLs.
Top of pagePrevious messageNext messageBottom of page Link to this message

Dave Witten (Wittend)
Posted on Monday, Jul 21, 2003 - 23:13:   

Concerning point 1 - is this considered signed or unsigned?

Concerning point 2 - I am very familiar with all of the mechanisms that Visual C++ 6.0 uses to import DLL functions, and I have reviewed it again to be certain. An import library is not absolutely essential, but the lack of it makes your API cumbersome and unattractive. I only require a few minor pieces of correct information to understand how to make this workable. Items such as:

1) Was the library compiled using someone's (Borland's Delphi?) name mangling convention, or are they clean cdecl or 'pascal' calls with no parameter decoration?

2) Accurate parameter document information for the calls - for instance the WHX_Init() call wants the API version as an int. Fine, but the current version seems to be 10.92. I can't do that as an int in any language. Should it be something like 1092? or as the VB example seems to imply, just a 1?

Delphi, in spite of its merits, is not widely used by production programmers in the US. While I was an enthusiastic user of Borland products from their introduction on CPM, I do not have the option of using those products now. And VB is completely inappropriate for the work that I am asked to do.

The resources provided for C of any sort do not appear to be useable without assistance from you, and I will simply look to other approaches if you don't wish to be helpful.
Top of pagePrevious messageNext messageBottom of page Link to this message

Stefan Fleischmann (Admin)
Posted on Monday, Jul 21, 2003 - 23:32:   

Signed.

1) The function names are not decorated. They work with just the same standard calling conventions as Win32 API functions (WINAPI = __stdcall), as you see in the header file. More on this here: http://www.codeproject.com/cpp/calling_conventions_demystified.asp

2) The documentation should be very accurate already. From the documentation: "APIVersion currently must be 1." That's it. Not the WinHex version.

> The resources provided for C of any sort do not
> appear to be useable without assistance from you

As far as I can tell, they contain all the required information. The function documentation is even written in C notation.

> I will simply look to other approaches if you
> don't wish to be helpful.

I personally find my prompt assistance during night time not too bad.
Top of pagePrevious messageNext messageBottom of page Link to this message

Dave Witten (Wittend)
Posted on Tuesday, Jul 22, 2003 - 0:01:   

I DO appreciate your prompt assistance. I apologize for my tone - that is not what I intended.

I misread the info about the API version. That was an error. And I did see the WINAPI declaration in the header file, but due to the 'LONGLONG' types in the declarations, I found it difficult to trust. Without a #define for that type, I assumed it had never been tested. I have edited the LONGLONG and LONGLONG* references be __int64 or __int64*, as appropriate.

Knowing that these are indeed declared __stdcall should help a lot. If I work out the details I will let you know.

Thanks...
Top of pagePrevious messageNext messageBottom of page Link to this message

nisha ratti
Username: nisharatti

Registered: N/A
Posted on Monday, Apr 7, 2008 - 9:56:   

plz help me in accessing system services, their versions no. etc in VC++ using API calls

Add Your Message Here
Post:
Username: Posting Information:
Only registered users may post messages here, i.e. you need to have an account.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:
Forum operated by X-Ways Software Technology AG.