473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Pointer to class or object

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
Jul 22 '05 #1
2 1463
Krish wrote:
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
Jul 22 '05 #2

"Krish" <kr**********@yahoo.ca> wrote in message
news:b8**************************@posting.google.c om...
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
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I had some code that worked fine for several weeks, and then yesterday it stopped working. I'm not sure what I did. Nor can I make out why it isn't working. I'm running a query that should return 3...
5
by: lawrence | last post by:
I posted before, but have now narrowed my problem down to this method. At the start of the method, I test to make sure that I have a resource, a pointer to data returned from a database. This test...
4
by: Steven T. Hatton | last post by:
I mistakenly set this to the comp.std.c++ a few days back. I don't believe it passed the moderator's veto - and I did not expect or desire anything different. But the question remains: ISO/IEC...
33
by: Ney André de Mello Zunino | last post by:
Hello. I have written a simple reference-counting smart pointer class template called RefCountPtr<T>. It works in conjunction with another class, ReferenceCountable, which is responsible for the...
5
by: StephQ | last post by:
This is from a thread that I posted on another forum some days ago. I didn't get any response, so I'm proposing it in this ng in hope of better luck :) The standard explanation is that pointer...
2
weaknessforcats
by: weaknessforcats | last post by:
Handle Classes Handle classes, also called Envelope or Cheshire Cat classes, are part of the Bridge design pattern. The objective of the Bridge pattern is to separate the abstraction from the...
6
by: puzzlecracker | last post by:
I am kind of confused with the vpointer. Assuming the class has a virtual function. Would ONE pointer (occupying 16 bits) to virtual table be create for the class or One for each object? How...
5
by: Tim Frink | last post by:
Hi, I'm experimenting with function pointers and found two questions. Let's assume this code: 1 #include <iostream> 2 class A; 3 4 //////////////////////////////////////////// 5 class B
8
by: mathieu | last post by:
Hi there I have implemented a very simple smartpointer class (invasive design). And I was wondering what should be the natural API when using those in a Container. I choose to define the...
50
by: Juha Nieminen | last post by:
I asked a long time ago in this group how to make a smart pointer which works with incomplete types. I got this answer (only relevant parts included): ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.