|
Thank you very much
Thank you masters!
|
|
|
|
|
Hi masters!
--------------
Say we wanna call SetTimer(); As you know (or had better to know ), one of Its parameters is pointer to a function to be called after a certain time is elapsed (that's a call-back function).
how can I define a member function to pass to it?
I tried the following methods, but I got an/some error/s in both cases:
1- SetTimer( ..., &CMyclass::MemberFunction);
2- SetTimer( ..., Memberfunction);
unfortunatly I don't remember the exact error/s now and I'm not home to reffer to my project ...
I'm using VS 2005
Thanks in advanced ...
|
|
|
|
|
Jusef Marzbany wrote: how can I define a member function to pass to it?
By making it static .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
thank you
Thank you masters!
|
|
|
|
|
You can't, except if the function is a static function. Because member functions and non-member functions do not have the same prototype (for the member functions, there's an implicit 'this' parameter).
|
|
|
|
|
Thank you for your reply But I got another question:
You meant static functions doesn't have this within them?
Thank you masters!
|
|
|
|
|
Because they're class methods (instead of instance ones). Since a static method cannot access instance data, it does NOT need the this pointer.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Ur a hereo
Thank you masters!
|
|
|
|
|
Jusef Marzbany wrote: Ur a hereo
Thank you, whatever it means
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I need to be able to toggle the handshaking lines on the serial port.
Can anyone help with this.
I am using vc6 on XP.
Cheers
Jim
|
|
|
|
|
|
Thanks for that, I'll give it a go.
I'll let you know how I get on.
Cheers
Jim
|
|
|
|
|
I need some help creating a unix shell using c++. Can anyone help me out here. Starting from scratch.
#include <iostream>
using namespace std:
Are the only includes I have so far. Code wise I have started it but no clue where should I end up.
|
|
|
|
|
crain1981 wrote: #include <iostream>
using namespace std:
Are the only includes I have so far. Code wise I have started...
Wow. Other than the syntax error, you're almost done!
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
lol.... glad you pointed that out...
so:
#include <iostream>
using namespace std;
Is this better.
Anyhow I'm trying to code the unix command cd in C++. Any pointers.
|
|
|
|
|
crain1981 wrote: Anyhow I'm trying to code the unix command cd in C++. Any pointers.
Try SetCurrentDirectory() .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
hmmm... do I need the #include <winsock2.h> for that command?
|
|
|
|
|
SetCurrentDirectory() does not require the iostream file.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
thanks man...
Sorry for being annoying...
And I'm just asking... can you do that for all commands.
|
|
|
|
|
crain1981 wrote: can you do that...
Do what?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Use something like setDirectory() for all the unix commands.
|
|
|
|
|
crain1981 wrote: Use something like setDirectory() for all the unix commands.
Uh, no. You would only use that if you wanted to set the directory of the FileDialog object's window to be the specified directory, and only if you were using Java.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
What you mean by creating a shell ? I would suppose that almost (or maybe even all) commands in the shell are just different executables.
|
|
|
|
|
that could be true... but i want to do it manually... and not by executables. I know they can but I choose to do it the other way so that I know how the command is implemented.
|
|
|
|
|
Cedric Moonen wrote: I would suppose that almost (or maybe even all) commands in the shell are just different executables.
Back in DOS days, it had internal (i.e., those contained within command.com) and external commands (i.e., separate executables).
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|