EnumProcessModulesEx Not Declared In This Scope?

Not sure why but im getting 'EnumProcessModulesEx' was not declared in this scope.

This is what i have

#define LIST_MODULES_32BIT 0x01

EnumProcessModulesEx(hprocess,modulearray,sizeof(modulearray),modulenumber,LIST_MODULES_32BIT);
Last edited on
Are you #including Windows.h? Sounds like you aren't, at least not in the code file containing that function call. That would also explain why you are declaring the LIST_MODULES_32BIT constant, which is unnecessary as Windows.h would include a proper definition for it.
Put this at the top of the source file.

#include <Windows.h>
Ya i included windows.h, thats why im wondering whats going on with it. Are there any other possible causes?
No, that's pretty much it unless you go around #undef'ing stuff.

Are you using Visual Studio? If yes, are you using a precompiled header? Where, exactly do you have #include <Windows.h> ?
Forth line from the top of main.cpp, also im using CodeBlocks. windows.h is already being included correctly i know for a fact because im using other functions from the same header and they are working fine.

1
2
3
4
5
//Coded by h4344

#include <iostream>
#include <windows.h>
#include <string> 
Last edited on
Then you must be working with an old Windows SDK. You need the SDK v6.0 for Windows Vista as a minimum.

I only use Visual Studio so I am unsure as to where you can look up the version of your SDK. The one that is downloaded directly from Microsoft is installed in a folder with the version number in the folder's name. I guess the version is in the files themselves elsewhere, I just don't know where exactly.
I find a windows.h in C:\Program Files\CodeBlocks\MinGW\include , which is probably what Code::Blocks uses. The Code::Blocks version I have installed is pretty old as I currently use Visual Studio, but inside the file I read:

windows.h - main header file for the Win32 API

Written by Anders Norlander <anorland@hem2.passagen.se>

This file is part of a free library for the Win32 API.

It doesn't specify a version.

I guess you could get a newer version of the SDK (I currently have 7.1 in my system but 6.0 should be a minimum like webJose mentioned), manually add the path in your Code::Blocks project and include that instead.
Last edited on
Use Mingw-w64 from http://tdragon.net/recentgcc/ as your compiler, this came with latest version of windows sdk ported to MinGW.
Don't forget to add -m32 command line switch if you want x86 binaries.
And define WINVER and other necessary macros before including windows.h
Topic archived. No new replies allowed.