Solved

GetCurrentHwProfile, HW_PROFILE_INFO won't compile!

Posted on 2004-04-08
5
698 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
  • 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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now