| h4344 (42) | |||
Not sure what im doing wrong but im getting the error below when i try to use Module32First() function.
Module32First(snapshot,mod32);error: cannot convert 'modentry32*' to 'tagMODULEENTRY32*' for argument '2' to 'BOOL Module32First(void*, tagMODULEENTRY32*)' | |||
|
|
|||
| Jackson Marie (462) | |
|
You should define a MODULEENTRY32 object instead of your "modentry32 mod32" Luckily, I'm writing a task manager project. So I recommend you use regular definition type instead of 'pointer'. (Your definition may cause 100% crash, for certain) HTH | |
|
|
|
| andywestken (1950) | |||||
|
Where is modentry32 defined? The Windows SDK header TlHelp32.h declares Module32First as
i.e. to use an LPMODULEENTRY32 and
Are you trying to declare your own version of the pre-existing struct? Andy | |||||
|
Last edited on
|
|||||
| h4344 (42) | |||
|
@Andy I have no idea what im doing here to be honest, i understand what a struct is and i understand the data that is inside of it but i have no idea why i need... why is "tag" here in the struct name? typedef struct tagMODULEENTRY32"typedef struct" something left over from C i read? typedef structThis looks like its just 2 separate objects of the same struct?
Im just learning this all now since i have to use this function. | |||
|
Last edited on
|
|||
| andywestken (1950) | |||||
|
The Microsoft definition is just to make the use of the structre more C friendly. as you know, in C you can't use just the name of a struct
to get round this, a typedef is provided. You're supposed to use the typedef name rather than the struct name, to avoid having to type struct all over the place.The name of the struct has "tag" prefixed to it so there is no name collision, but that it's obiously the struct definition used for the typedef. PMODULEENTRY32 and LPMODULEENTRY32 are identical. The L version is a hangover from the olden (Win16) days when there were near and far pointers. http://en.wikipedia.org/wiki/Near_pointer#Pointer_sizes http://en.wikipedia.org/wiki/Far_pointer In Win16 code it would have been
This is no longer needed with Win32, but the names have stayed. Same deal for LPSTR, which used to be CHAR FAR * (or just char far *) Andy | |||||
|
Last edited on
|
|||||