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
Solved

GetCurrentHwProfile, HW_PROFILE_INFO won't compile!

Posted on 2004-04-08
5
709 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

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.  …
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 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