GetCurrentHwProfile( ) api usage

i have made a programe to know the current hardware profile of the system using GetCurrentHwProfile api,At first it does not does not recognize the function in the window.h.And
when i write #define _WIN32_WINNT 0x4000; it gives error in the winbase.h. Please help me out....

I want to know the device information of a client system If there any other api which full fills the purpose

#define _WIN32_WINNT 0x4000;
#include
#include
#include

const int HW_PROFILE_GUIDLEN=100;
const int MAX_PROFILE_LEN=100;

typedef struct HW_PROFILE_INFO {
DWORD dwDockInfo;
TCHAR szHwProfileGuid[HW_PROFILE_GUIDLEN];
TCHAR szHwProfileName[MAX_PROFILE_LEN];
} HW_PROFILE_INFO, *LPHW_PROFILE_INFO;

int WINAPI WinMain(HINSTANCE h,HINSTANCE p,LPSTR l,int n)
{
TCHAR szBuffer1[1000];
TCHAR szBuffer2[1000];
TCHAR szBuffer3[1000];
HW_PROFILE_INFO HwProfInfo;
GetCurrentHwProfile(&HwProfInfo) ;

sprintf(szBuffer1, "DockInfo: %s", HwProfInfo.dwDockInfo);
MessageBox(0, szBuffer1, "Dock Info", 0);

sprintf(szBuffer2, "Profile Guid: %s", HwProfInfo.szHwProfileGuid);

MessageBox(0, szBuffer2, "Profile Guid", 0);

sprintf(szBuffer3, "Friendly Name: %s", HwProfInfo.szHwProfileName);

MessageBox(0, szBuffer3, "Friendly Name", 0);
return 0;
}
[1377 byte] By [motivatedlad] at [2007-11-19 6:41:34]
# 1 Re: GetCurrentHwProfile( ) api usage
If you have precomplied headers turned on then make sure the #define is not before your include of the stdafx.h. If it is defined before the include of the pch file it will be ignored. Put it in your preprocessor under the project settings or in your stdafx.h itself. And show what you are including...

#define _WIN32_WINNT 0x0400;
#include
#include
#include
Mick at 2007-11-9 13:14:47 >
# 2 Re: GetCurrentHwProfile( ) api usage
Please debug this simple code about the getcurrentHwProfile().It dose not recognize the fn name although windows.h is included

Do i have to include things like
( #define _WIN32_WINNT 0x4000; )

#include
#include
#include

const int HW_PROFILE_GUIDLEN=100;
const int MAX_PROFILE_LEN=100;

typedef struct HW_PROFILE_INFO {
DWORD dwDockInfo;
TCHAR szHwProfileGuid[HW_PROFILE_GUIDLEN];
TCHAR szHwProfileName[MAX_PROFILE_LEN];
} HW_PROFILE_INFO, *LPHW_PROFILE_INFO;

int WINAPI WinMain(HINSTANCE h,HINSTANCE p,LPSTR l,int n)
{
TCHAR szBuffer1[1000];
TCHAR szBuffer2[1000];
TCHAR szBuffer3[1000];
HW_PROFILE_INFO HwProfInfo;
GetCurrentHwProfile(&HwProfInfo) ;

sprintf(szBuffer1, "DockInfo: %s", HwProfInfo.dwDockInfo);
MessageBox(0, szBuffer1, "Dock Info", 0);

sprintf(szBuffer2, "Profile Guid: %s", HwProfInfo.szHwProfileGuid);

MessageBox(0, szBuffer2, "Profile Guid", 0);

sprintf(szBuffer3, "Friendly Name: %s", HwProfInfo.szHwProfileName);

MessageBox(0, szBuffer3, "Friendly Name", 0);
return 0;
}
motivatedlad at 2007-11-9 13:15:48 >
# 3 Re: GetCurrentHwProfile( ) api usage
< merged threads >

Please do not create new threads for an existing question.
Mick at 2007-11-9 13:16:56 >
# 4 Re: GetCurrentHwProfile( ) api usage
Read my previous response.

#include <WHAT ARE YOU INCLUDING>
Mick at 2007-11-9 13:17:50 >
# 5 Re: GetCurrentHwProfile( ) api usage
I am including windows.h, stdio.h , winbase.h

Mick now please slove my problem and make it in running condition :) :)
motivatedlad at 2007-11-9 13:19:01 >
# 6 Re: GetCurrentHwProfile( ) api usage
Dear Mick,
Please post the full code that is in running condition
Thanks
motivatedlad at 2007-11-9 13:20:00 >
# 7 Re: GetCurrentHwProfile( ) api usage
Dear Mick,
Please post the full code that is in running condition
Thanks

#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <stdio.h>

Those are your includes and your macro setting.

Here is a link describing the use of the macros:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/using_the_windows_headers.asp

You need to remove this code.

const int HW_PROFILE_GUIDLEN=100;
const int MAX_PROFILE_LEN=100;

typedef struct HW_PROFILE_INFO {
DWORD dwDockInfo;
TCHAR szHwProfileGuid[HW_PROFILE_GUIDLEN];
TCHAR szHwProfileName[MAX_PROFILE_LEN];
} HW_PROFILE_INFO, *LPHW_PROFILE_INFO;
Mick at 2007-11-9 13:20:53 >
# 8 Re: GetCurrentHwProfile( ) api usage
Thanks a lot Mick, with ur guaidence the code now complies and links but still it does not executes... giving "access violation" saying that it cannot read the particular memory address... although i am the administrator and i have full rights on this windows 2000 system. Can you please remove the error so that it can give output.... Please do it in code like the previous message thanks a lot buddy.

define _WIN32_WINNT 0x0400
#include <windows.h>
#include <stdio.h>

int WINAPI WinMain(HINSTANCE h,HINSTANCE p,LPSTR l,int n)
{
TCHAR szBuffer1[1000];
TCHAR szBuffer2[1000];
TCHAR szBuffer3[1000];
HW_PROFILE_INFO HwProfInfo;
GetCurrentHwProfile(&HwProfInfo) ;

sprintf(szBuffer1, "DockInfo: %s", HwProfInfo.dwDockInfo);
MessageBox(0, szBuffer1, "Dock Info", 0);

sprintf(szBuffer2, "Profile Guid: %s", HwProfInfo.szHwProfileGuid);

MessageBox(0, szBuffer2, "Profile Guid", 0);

sprintf(szBuffer3, "Friendly Name: %s", HwProfInfo.szHwProfileName);

MessageBox(0, szBuffer3, "Friendly Name", 0);
return 0;
}
motivatedlad at 2007-11-9 13:21:54 >
# 9 Re: GetCurrentHwProfile( ) api usage
dwDockInfo is a DWORD not a string.

sprintf(szBuffer1, "DockInfo: %d", HwProfInfo.dwDockInfo);
Mick at 2007-11-9 13:23:03 >