[C/C++] MEMORYSTATUSEX wird nicht erkannt?!

Dieses Thema im Forum "Programmierung & Entwicklung" wurde erstellt von cable, 16. Mai 2009 .

Status des Themas:
Es sind keine weiteren Antworten möglich.
  1. 16. Mai 2009
    MEMORYSTATUSEX wird nicht erkannt?!

    Hoi!

    Bin gerade an einem Pogramm dran, in dem ich ein paar Sachen über den Arbeitsspeicher abfragen will. Hab ert die Fkt "GlobalMemoryStatus()" beutzt, bis ich merkte, dass teilweise falsche Wert geliefert werden. Kurz darauf hab ich gesehen, dass in der MSDN stand:
    Dann hab ich versucht ein "MEMORYSTATUSEX" Objekt einzubauen, dabei kam aber dieser Fehler:
    Mit einem MEMORYSTATUS Objekt gabs keine Probleme, von daher liegt es wohl nicht an den libs oder der windows.h. Muss nämlich alles auf die selbe weise inkludiert werden.

    Hab auch mal versucht das Beispiel zu komplilieren, aber da kam der gleiche Fehler :/

    Weiß jemand, woran das liegen kann?

    greez
     
  2. 16. Mai 2009
    AW: MEMORYSTATUSEX wird nicht erkannt?!

    Die Funktionen und Typen sind ALLE in der "Winbase.h" deklariert.

    Da er ja die anderen Funktionen findet aber nur diesen Typ nicht denke ich mal das deine
    "Winbase.h" defekt ist, eventuell neu runterladen.

    Oder eine eher unschönere Lösung wäre den Typ neu zu deklarieren in deinem Header.

    Mfg Rushh0ur
     
  3. 17. Mai 2009
    AW: MEMORYSTATUSEX wird nicht erkannt?!

    Ich hab meine winbase.h schon durgeschaut und da ist "MEMORYSTATUSEX" auch vorhanden, trotzdem wird es nicht erkannt :/
    Ich hatte vorher lediglich die windows.h inkludiert, da die ja die winbase.h drin hat. Nun habe ich nochmal explizit die winbase.h rein gepackt, aber es hat nix geändert -.-

    Hab keine Ahnung woran das noch liegen kann!

    greez
     
  4. 18. Mai 2009
    AW: MEMORYSTATUSEX wird nicht erkannt?!

    What version is your windows?

    Have the program defined WINVER somewhere?

    It might be the macro switch problem here, I think
     
  5. 18. Mai 2009
    AW: MEMORYSTATUSEX wird nicht erkannt?!

    System is Win XP Sp2. I didn't define WINVER anywhere.

    Can u tell me something more about that "macro switch problem" and how to solve it?

    greez
     
  6. 18. Mai 2009
    AW: MEMORYSTATUSEX wird nicht erkannt?!

    Try to insert this code fragment on the top of the main file

    #define WINVER 0x0501
    #define _WIN32_WINNT 0x0501


    I am not sure whether it will work.

    What I mean by 'macro switch' is that using #if #endif macros in the header or source file to handle different environment compilation, in win32 sdk there are lots of these things so I think it might be the problem.
     
  7. 18. Mai 2009
    AW: MEMORYSTATUSEX wird nicht erkannt?!

    I tried it but then there appeared some warnings about redefining WINVER etc.

    It did not solve the problem. Thx anyway!

    Kann mir sonst keiner helfen?

    greez
     
  8. 19. Mai 2009
    AW: MEMORYSTATUSEX wird nicht erkannt?!

    Oh, than I think it may be the problem. You can find the position of the redefined WINVER and check the value or simply commented them. Also check the parameters in the compiler after /D, if you are using Visual Studio the item can be found at 'project property'->'C/C++'->'Preprocessor'

    Hope this will work.
     
  9. 19. Mai 2009
    AW: MEMORYSTATUSEX wird nicht erkannt?!

    Okay, i found the definition in the windef.h. There was a comment about the functions near the WINVER:
    So i declared WINVER (0x0501) BEFORE I included the windows.h. I even commented:
    Code:
    #define WINVER 0x0400
    but it didn't change anything. Now I'm really perplexed... dunno where the mistake could be?!

    greez
     
  10. 19. Mai 2009
    AW: MEMORYSTATUSEX wird nicht erkannt?!

    I SOLVED THE PROBLEM

    Thx zybzmhhj for ur hints. I read a long time about this topic in some forums and threads and finally noticed this:
    I pasted this definitions into the main.cpp file but it must be the class header. I'm sorry, that i did not give u some mre information. Could have been kinda helpful

    Okay, no questions anymore

    greez und close!
     
  11. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.