Pointer to class or object

K

Krish

Hi,

I have a question, if I have a global function that pointed to class
or object, then how do I pass arguments to that function.
I have CService *MyService; in my cpp
and in my header, i have
static DWORD CALLBACK function(CService*, DWORD, LPVOID);
DWORD func(CService*, DWORD);

then how do i pass argument for that pointer.
CNewServiceApp::function(-------, DWORD R, LPVOID arg);
what should I put in ----- above.

Please someone help me

Thanks,
Krish
 
V

Victor Bazarov

Krish said:
I have a question, if I have a global function that pointed to class

There is no way to "point to class" in C++, you might want to clarify
what you mean here.
or object, then how do I pass arguments to that function.
I have CService *MyService; in my cpp

What's CService?
and in my header, i have
static DWORD CALLBACK function(CService*, DWORD, LPVOID);
DWORD func(CService*, DWORD);

Stand-alone? Members?
then how do i pass argument for that pointer.
CNewServiceApp::function(-------, DWORD R, LPVOID arg);
what should I put in ----- above.

The statement two lines above is a declaration. You don't pass anything
there, you just declare that something can be passed. I probably don't
understand what you need. Try to follow the suggestions in FAQ 5.8 (you
can find the FAQ list here: http://www.parashift.com/c++-faq-lite/ )

If you decide to call 'CNewServiceApp::function', the first argument can
be 'MyService', but I'm shooting in the dark here.

Victor
 
J

John Harrison

Krish said:
Hi,

I have a question, if I have a global function that pointed to class
or object, then how do I pass arguments to that function.
I have CService *MyService; in my cpp
and in my header, i have
static DWORD CALLBACK function(CService*, DWORD, LPVOID);
DWORD func(CService*, DWORD);

then how do i pass argument for that pointer.
CNewServiceApp::function(-------, DWORD R, LPVOID arg);
what should I put in ----- above.

I would guess MyService. MyService is a pointer to CService, the function
expects a pointer to CService, what's the problem?

I'm guessing that there is a problem but perhaps it is in the code you
didn't show us. Post more code!

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top