sennaspy
asked on
CALLBACK .. URGENT .... PLEASE
Hi... In the microsoft website, has an example of List Process in Memory...
But this example, use CALLBACK... I don't know use this...
The Microsoft Example:
http://support.microsoft.com/support/kb/articles/Q175/0/30.asp
I need only show the EXE file name's in a MessageBox() only... using this microsoft example...
Excuse me for my bad english
Thanks
But this example, use CALLBACK... I don't know use this...
The Microsoft Example:
http://support.microsoft.com/support/kb/articles/Q175/0/30.asp
I need only show the EXE file name's in a MessageBox() only... using this microsoft example...
Excuse me for my bad english
Thanks
ASKER
Ok.. thanks...
But... Looking this:
http://support.microsoft.com/support/kb/articles/Q175/0/30.asp
I need show the EXE file name's in a MessageBox() only... using this microsoft example...
Please... thanks
But... Looking this:
http://support.microsoft.com/support/kb/articles/Q175/0/30.asp
I need show the EXE file name's in a MessageBox() only... using this microsoft example...
Please... thanks
ASKER
Ok.. thanks...
But... Looking this:
http://support.microsoft.com/support/kb/articles/Q175/0/30.asp
I need show the EXE file name's in a MessageBox() only... using this microsoft example...
Please... thanks
But... Looking this:
http://support.microsoft.com/support/kb/articles/Q175/0/30.asp
I need show the EXE file name's in a MessageBox() only... using this microsoft example...
Please... thanks
ASKER
Hi...
I need only list the process active in NT and 95/98, if you have other program, but without class or callback, send to me... thanks...
Excuse me for my bad english
I need only list the process active in NT and 95/98, if you have other program, but without class or callback, send to me... thanks...
Excuse me for my bad english
Are you asking how to use the code in the example?
If so, you just need to write a callback function like they show in the example and then call the EnumProcs() function specifying a pointer to that callback procedure. Then the callback procedure will be called repeatedly. Each time it is called it will be passed information for a different process.
Your callback procedure would look like
BOOL CALLBACK YourCallbackProc( DWORD dw, WORD w16, LPCSTR lpstr, LPARAM lParam )
{
// The lpstr parameter points to the EXE's name Add it to the messagebox.
return true; // return true to continue enumerating.
}
You would use it like
EnumProc(&YourCallbackProc ,NULL);
That's all there is to it. Let me know if you have any questions.
If so, you just need to write a callback function like they show in the example and then call the EnumProcs() function specifying a pointer to that callback procedure. Then the callback procedure will be called repeatedly. Each time it is called it will be passed information for a different process.
Your callback procedure would look like
BOOL CALLBACK YourCallbackProc( DWORD dw, WORD w16, LPCSTR lpstr, LPARAM lParam )
{
// The lpstr parameter points to the EXE's name Add it to the messagebox.
return true; // return true to continue enumerating.
}
You would use it like
EnumProc(&YourCallbackProc
That's all there is to it. Let me know if you have any questions.
ASKER
Hi.. Thanks again..
I make this example, but return this message error in line :
" EnumProcs(&YourCallbackPro c,NULL); "
[C++ Error] Unit1.cpp(27): E2034 Cannot convert 'int (__stdcall *)(unsigned long,unsigned short,const char *,long)' to 'int (__stdcall *)(unsigned long,unsigned short,char *,long)'.
[C++ Error] Unit1.cpp(27): E2343 Type mismatch in parameter 'lpProc' in call to '__stdcall EnumProcs(int (__stdcall *)(unsigned long,unsigned short,char *,long),long)'.
I make this example, but return this message error in line :
" EnumProcs(&YourCallbackPro
[C++ Error] Unit1.cpp(27): E2034 Cannot convert 'int (__stdcall *)(unsigned long,unsigned short,const char *,long)' to 'int (__stdcall *)(unsigned long,unsigned short,char *,long)'.
[C++ Error] Unit1.cpp(27): E2343 Type mismatch in parameter 'lpProc' in call to '__stdcall EnumProcs(int (__stdcall *)(unsigned long,unsigned short,char *,long),long)'.
Use LPSTR instead of LPCSTR for the 3rd parameter of YourCallbackProc. And
EnumProcs(YourCallbackProc , NULL);
EnumProcs(YourCallbackProc
Actually the change from LPSTR to LPCSTR should be all you need. The &before the function name in EnumProcs() is optional.
sennaspy,
Have you solved the problems? You should not have rejected nietod's answer since there is nothing wrong. You may ask him to answer again so that the question can be closed.
Have you solved the problems? You should not have rejected nietod's answer since there is nothing wrong. You may ask him to answer again so that the question can be closed.
nietod and chensu,
I feel only fair to warn you that this looks like someones homework...
I feel only fair to warn you that this looks like someones homework...
Homework? what course?
Better ask sennaspy.
But what evidence do you see that even suggests this? I have never heard of a course that would have students write OS-specific code, like windows programs, much less a course that would deal with such a non-accademic topic, like obtaining a list of running processes.
Why using ONLY this example?
Whatever, forget it, it's not such a big issue.
Whatever, forget it, it's not such a big issue.
ASKER
Ok... Thanks for all ... I resolved the problem...
But I send points to ... ?!?!?!
But I send points to ... ?!?!?!
sennaspy, You have to choose the expert that you think helped the most and ask then to submit an answer, then you can grade the answer.
shaig, It is a big issue for me. I don't like to help people cheat, even by accident. But I don't think that is the case here. sennaspy's profile is full of technical questions (and answers) that definitly suggests practical, real-life programming, not accademic programming.
shaig, It is a big issue for me. I don't like to help people cheat, even by accident. But I don't think that is the case here. sennaspy's profile is full of technical questions (and answers) that definitly suggests practical, real-life programming, not accademic programming.
ASKER
Ok...
thanks for all for help...
Nietod, send me again the answer "blank only"... I send point to you..
thanks
thanks for all for help...
Nietod, send me again the answer "blank only"... I send point to you..
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
#define CALLBACK _cdecl
And you would use it before a function defintion like
int CALLBACK f(int *IPtr);
something like that. You should use it before any function you declare that will be used as a windows callback function, for example if you were to write a procedure to be called by theEnumProcs() procedure in the example, you would declare it like
BOOL CALLBACK YourProcedure(DWORD, WORD, LPSTR, LPARAM )
{
};
Let me know if you have any questions.