?
Solved

GetCurrentHwProfile, HW_PROFILE_INFO won't compile!

Posted on 2004-04-08
5
Medium Priority
?
736 Views
Last Modified: 2013-12-03
Hi,

I tried to use GetCurrentHwProfile(&hwp) and HW_PROFILE_INFO hwp. I already included windows.h. But they just won't compile. The compiler tells:
'HW_PROFILE_INFO' : undeclared identifier
'GetCurrentHwProfile' : undeclared identifier

So what is the problem and how can I make them compile. Thanks a lot!
0
Comment
Question by:yeshengl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 7

Expert Comment

by:aib_42
ID: 10917581
Are you able to include windows.h without any problems? (You should be)
Are HW_PROFILE_INFO and GetCurrentHwProfile somehow defined in windows.h? (They should be)
The HW_PROFILE_INFO hwp; line is before GetCurrentHwProfile, right? (It should be)
0
 

Author Comment

by:yeshengl
ID: 10919498
Are you able to include windows.h without any problems? (You should be)
Yes, I am able to include windows.h

Are HW_PROFILE_INFO and GetCurrentHwProfile somehow defined in windows.h? (They should be)
No. Actually HW_PROFILE_INFO and GetCurrentHwProfile are defined in winbase.h. From the MSDN, you can see their including information as: Header: Declared in Winbase.h; include Windows.h.

And I included both windows.h and winbase.h, it still does not compile.

The HW_PROFILE_INFO hwp; line is before GetCurrentHwProfile, right? (It should be)
Yes. It is like this:

HW_PROFILE_INFO   HwProfInfo;
if (!GetCurrentHwProfile(&HwProfInfo))
{
    _tprintf(TEXT("GetCurrentHwProfile failed with error %lx\n"),
    GetLastError());
    return;
}

But it won't compile. The compile error:
    error C2065: 'HW_PROFILE_INFO' : undeclared identifier
    error C2146: syntax error : missing ';' before identifier 'HwProfInfo'
    error C2065: 'HwProfInfo' : undeclared identifier
    error C2065: 'GetCurrentHwProfile' : undeclared identifier
0
 
LVL 7

Accepted Solution

by:
aib_42 earned 200 total points
ID: 10947237
This is strange, very strange.

The SDK indeed says it is in winbase.h, but I have seen two implementations where in one, it is in windows.h and the other, winbase.h. Anyway, that should not be the problem.

Did you try manually defining the symbols? ie. Copy/Paste this from winbase.h:

typedef struct tagHW_PROFILE_INFOA {
    DWORD  dwDockInfo;
    CHAR   szHwProfileGuid[HW_PROFILE_GUIDLEN];
    CHAR   szHwProfileName[MAX_PROFILE_LEN];
} HW_PROFILE_INFOA, *LPHW_PROFILE_INFOA;

typedef HW_PROFILE_INFOA HW_PROFILE_INFO;
typedef LPHW_PROFILE_INFOA LPHW_PROFILE_INFO;

and

WINADVAPI
BOOL
WINAPI
GetCurrentHwProfileA (
    OUT LPHW_PROFILE_INFOA  lpHwProfileInfo
    );

#define GetCurrentHwProfile  GetCurrentHwProfileA

Assuming you are using the ANSI character set. (Else copy/paste the 'W' functions, or just copy paste everything)

I agree, these are strange 'solutions' or debugging steps, but your problem is strange as well.
I would also add a message, warning or error pragma to where the HWProfile stuff is being done in winbase.h:

#pragma message("OK, this part is being processed allright.")

typedef struct tagHW_PROFILE_INFOA {
...


Either that, or I am missing something very, very basic.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question