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(CServi ce*, 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 2 1478
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(CServi ce*, 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
"Krish" <kr**********@y ahoo.ca> wrote in message
news:b8******** *************** ***@posting.goo gle.com... 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(CServi ce*, 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 items from the
database. I then get a count of the return, which correctly tells me
that I've got 3 items. I then go into a for loop which I expect to
loop 3 times and print out the 3 items. Here is where things get
strange: it loops 3 times and...
|
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 is
coming back true, so the next line runs, which attempts to get the
next row from the dataset. This brings back nothing. On the queries
I'm running right now, the first row will be fetched, but then no
further rows. If I expect 20 rows back, I...
|
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 14882:2003(E) §8.5 says:
To zero-initialize an object of type T means:
5
-- if T is a scalar type (3.9), the object is set to the value of 0 (zero)
converted to T;
|
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 actual counting. Here
is the latter's definition:
// --- Begin ReferenceCountable.h ----------
class ReferenceCountable
|
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 to functions are hard to
inline for the compiler, and so you won't be able to avoid function
call overhead.
This is an important aspect when you are calling a function very
frequently for evaluation reason: think of the problem of performing...
| |
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 implementation so the two can vary independently.
Handle classes usually contain a pointer to the object implementation. The Handle object is used rather than the implemented object. This leaves the implemented object free to change without affecting...
|
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 does this
pointer fit into aligment properties of an object (of the class) or
class itself?
Thanks
|
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
|
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 following operator in my smartpointer class:
....
operator ObjectType * () const
|
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):
//------------------------------------------------------------------
template<typename Data_t>
class SmartPointer
{
Data_t* data;
void(*deleterFunc)(Data_t*);
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |