المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Using an API



C++ Programming
09-30-2009, 03:30 PM
Hello

I am working on Visual Studio 2003 with WIN32 API's.

I want to use a Non-Win API inside my project. It's not a complex API and i already have the libraries linked into my project.

Below is the description of the API,

-------------------------------------------------------------------------
Function:

Void GetImageVersion(TCHAR *imageVersion, DWORD *size);

Parameters:

imageVersion -
[out] Pointer to an array in which the image version string is returned.

size -
[in/out] Pointer to a variable that specifies the size, in TCHAR, of the array pointed to by the BIOSVersion parameter. If BIOSVersion is given as NULL, when the function returns, the variable will contain the array size required for the BIOS version.

Remarks:

Call the function twice, first by giving imageVersion as NULL to get the array size required for the string. Then allocate a TCHAR array with the size required and give the array with its size as parameters to get the image version.
-------------------------------------------------------------------------

I am having little bit difficulty in understanding the implementation of this function. Especially with declaring a TCHAR and then calling this function twice, as described in "remarks" section.

Can anyone write a sample peiece of code and explain how to use this API function?

Thanks in advance.