Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Another API problem for you folks.

Why is it that when I use the GetCurrentHwProfile() I keep getting this error from my compiler. Incidentally, I am using Windows XP and the compiler is VS6.

error C2065: 'GetCurrentHwProfile' : undeclared identifier.

The same message also appears when I use the HW_PROFILE_INFO.

error C2065: 'HW_PROFILE_INFO' : undeclared identifier.

I have used the correct header files but still I keep getting the errors.

I then decided to declare both the structure and the function explicitly in the application and naturally enough the program compiled without any complaints but the output was pure gibberish.

What is happening and more importantly why?

Oh! yes, I did use the example in toto given by Microsoft with the same result.

Thanks.

Comments

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : Why is it that when I use the GetCurrentHwProfile() I keep getting
    : this error from my compiler. Incidentally, I am using Windows XP and
    : the compiler is VS6.
    :
    : error C2065: 'GetCurrentHwProfile' : undeclared identifier.
    :
    : The same message also appears when I use the HW_PROFILE_INFO.
    :
    : error C2065: 'HW_PROFILE_INFO' : undeclared identifier.
    :
    : I have used the correct header files but still I keep getting the
    : errors.
    :
    : I then decided to declare both the structure and the function
    : explicitly in the application and naturally enough the program
    : compiled without any complaints but the output was pure gibberish.
    :
    : What is happening and more importantly why?
    :
    : Oh! yes, I did use the example in toto given by Microsoft with the
    : same result.
    :
    : Thanks.
    :

    From what I can tell from http://msdn.microsoft.com/en-us/library/ms724311(VS.85).aspx you need to "(..) define the _WIN32_WINNT macro as 0x0400 or later." (last line of text before the example).
    I think they do this to make you aware that this is a highly version specific API.
    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : : Why is it that when I use the GetCurrentHwProfile() I keep getting
    : : this error from my compiler. Incidentally, I am using Windows XP and
    : : the compiler is VS6.
    : :
    : : error C2065: 'GetCurrentHwProfile' : undeclared identifier.
    : :
    : : The same message also appears when I use the HW_PROFILE_INFO.
    : :
    : : error C2065: 'HW_PROFILE_INFO' : undeclared identifier.
    : :
    : : I have used the correct header files but still I keep getting the
    : : errors.
    : :
    : : I then decided to declare both the structure and the function
    : : explicitly in the application and naturally enough the program
    : : compiled without any complaints but the output was pure gibberish.
    : :
    : : What is happening and more importantly why?
    : :
    : : Oh! yes, I did use the example in toto given by Microsoft with the
    : : same result.
    : :
    : : Thanks.
    : :
    :
    : From what I can tell from
    : http://msdn.microsoft.com/en-us/library/ms724311(VS.85).aspx you
    : need to "(..) define the _WIN32_WINNT macro as 0x0400 or later."
    : (last line of text before the example).
    : I think they do this to make you aware that this is a highly version
    : specific API.
    : Best Regards,
    : Richard
    :
    : The way I see it... Well, it's all pretty blurry
    [color=Blue]
    I tried to use that ID in both the source and compiler options, but VS kept this _WINNT... "unnoticed", so I used the brute force approach - simply open these compiler headers and copy/paste the definitions you need into your code. Protect with ifdef's for next compiler.
    [/color]
  • toddlerasimtoddlerasim Posts: 93Member
    : : : Why is it that when I use the GetCurrentHwProfile() I keep getting
    : : : this error from my compiler. Incidentally, I am using Windows XP and
    : : : the compiler is VS6.
    : : :
    : : : error C2065: 'GetCurrentHwProfile' : undeclared identifier.
    : : :
    : : : The same message also appears when I use the HW_PROFILE_INFO.
    : : :
    : : : error C2065: 'HW_PROFILE_INFO' : undeclared identifier.
    : : :
    : : : I have used the correct header files but still I keep getting the
    : : : errors.
    : : :
    : : : I then decided to declare both the structure and the function
    : : : explicitly in the application and naturally enough the program
    : : : compiled without any complaints but the output was pure gibberish.
    : : :
    : : : What is happening and more importantly why?
    : : :
    : : : Oh! yes, I did use the example in toto given by Microsoft with the
    : : : same result.
    : : :
    : : : Thanks.
    : : :
    : :
    : : From what I can tell from
    : : http://msdn.microsoft.com/en-us/library/ms724311(VS.85).aspx you
    : : need to "(..) define the _WIN32_WINNT macro as 0x0400 or later."
    : : (last line of text before the example).
    : : I think they do this to make you aware that this is a highly version
    : : specific API.
    : : Best Regards,
    : : Richard
    : :
    : : The way I see it... Well, it's all pretty blurry
    : [color=Blue]
    : I tried to use that ID in both the source and compiler options, but
    : VS kept this _WINNT... "unnoticed", so I used the brute force
    : approach - simply open these compiler headers and copy/paste the
    : definitions you need into your code. Protect with ifdef's for next
    : compiler.
    : [/color]
    :
    :I did what you suggested AsmGuru62 but to no avail. I opened winbase.h :and did a copy and paste of the relevant section in my application but to
    :no avail. I kept getting the same error messages. To cut a long story :short, I merely rewrote the application in Visual Studio 2008 and I had :it running with no hassle. That it worked is satisfying but I still would :like it to work in VSC++6. Hope I can manage that. Then my efforts would :indeed be satisfying.
  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : :I did what you suggested AsmGuru62 but to no avail. I opened
    : winbase.h :and did a copy and paste of the relevant section in my
    : application but to
    : :no avail. I kept getting the same error messages. To cut a long
    : story :short, I merely rewrote the application in Visual Studio 2008
    : and I had :it running with no hassle. That it worked is satisfying
    : but I still would :like it to work in VSC++6. Hope I can manage
    : that. Then my efforts would :indeed be satisfying.
    :

    Riiight... read over that part.
    The Visual C++ 6.0 'package' is meant for Windows 98 and NT 4.0 (I believe). It doesn't know about XP and certainly not about new features introduced later.
    Still, copying all the relevant code parts should do the trick. It should at the very least change the error message(s) to something else.
    Try copying all the relevant parts to your own include header, then try to compile and fix any errors the compiler gives you. If you need help, you can post the source code and error messages here.
    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • toddlerasimtoddlerasim Posts: 93Member
    : : :I did what you suggested AsmGuru62 but to no avail. I opened
    : : winbase.h :and did a copy and paste of the relevant section in my
    : : application but to
    : : :no avail. I kept getting the same error messages. To cut a long
    : : story :short, I merely rewrote the application in Visual Studio 2008
    : : and I had :it running with no hassle. That it worked is satisfying
    : : but I still would :like it to work in VSC++6. Hope I can manage
    : : that. Then my efforts would :indeed be satisfying.
    : :
    :
    : Riiight... read over that part.
    : The Visual C++ 6.0 'package' is meant for Windows 98 and NT 4.0 (I
    : believe). It doesn't know about XP and certainly not about new
    : features introduced later.
    : Still, copying all the relevant code parts should do the trick. It
    : should at the very least change the error message(s) to something
    : else.
    : Try copying all the relevant parts to your own include header, then
    : try to compile and fix any errors the compiler gives you. If you
    : need help, you can post the source code and error messages here.
    : Best Regards,
    : Richard
    :
    : The way I see it... Well, it's all pretty blurry
    :
    :What freaks me out with this API is that it is part of the compiler.
    :When I write the function it registers and shows the parameters that are :needed. But it comes up with the "undefined identifier" when I attempt to compile it.
  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : What freaks me out with this API is that it is part of the compiler.
    : When I write the function it registers and shows the parameters
    : that are :needed. But it comes up with the "undefined identifier"
    : when I attempt to compile it.
    :

    You're in luck: I happen to be behind a computer with VC++ 6.0 installed.
    It took a bit of trying, and some weird weird errors... but this approach worked for me:

    In stdafx.h:
    [code]
    #define WIN32_LEAN_AND_MEAN
    //For GetCurrentHwProfile
    #define _WIN32_WINNT 0x0500
    #include
    [/code]

    Then you might need to force it to recompile all. I got the impression from the weird errors I got that later disappeared that some things are less smooth than they should be. After this change, recompile the entire project (possibly force Rebuild All) and it should work. It did for me.
    Good luck
    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : : What freaks me out with this API is that it is part of the compiler.
    : : When I write the function it registers and shows the parameters
    : : that are :needed. But it comes up with the "undefined identifier"
    : : when I attempt to compile it.
    : :
    :
    : You're in luck: I happen to be behind a computer with VC++ 6.0
    : installed.
    : It took a bit of trying, and some weird weird errors... but this
    : approach worked for me:
    :
    : In stdafx.h:
    : [code]:
    : #define WIN32_LEAN_AND_MEAN
    : //For GetCurrentHwProfile
    : #define _WIN32_WINNT 0x0500
    : #include
    : [/code]:
    :
    : Then you might need to force it to recompile all. I got the
    : impression from the weird errors I got that later disappeared that
    : some things are less smooth than they should be. After this change,
    : recompile the entire project (possibly force Rebuild All) and it
    : should work. It did for me.
    : Good luck
    : Best Regards,
    : Richard
    :
    : The way I see it... Well, it's all pretty blurry

    [color=Blue]
    That ...LEAN_AND_MEAN... thing is not good. Using it excludes some low level (or maybe rarely used, like that hardware profile function) stuff from Win32 headers. I remember, when creating projects with VC++ 6.0 - the first thing I was doing was opening stdafx.h and deleting that line.
    [/color]
  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member

    : [color=Blue]
    : That ...LEAN_AND_MEAN... thing is not good. Using it excludes some
    : low level (or maybe rarely used, like that hardware profile
    : function) stuff from Win32 headers. I remember, when creating
    : projects with VC++ 6.0 - the first thing I was doing was opening
    : stdafx.h and deleting that line.
    : [/color]

    In this case LEAN_AND_MEAN does n
  • toddlerasimtoddlerasim Posts: 93Member
    :
    : : [color=Blue]
    : : That ...LEAN_AND_MEAN... thing is not good. Using it excludes some
    : : low level (or maybe rarely used, like that hardware profile
    : : function) stuff from Win32 headers. I remember, when creating
    : : projects with VC++ 6.0 - the first thing I was doing was opening
    : : stdafx.h and deleting that line.
    : : [/color]
    :
    : In this case LEAN_AND_MEAN does n
Sign In or Register to comment.