|
Mark Salsbery wrote: Where is pCmdAction declared? I don't see relevant code in your post
that would cause the error.
<br />
class CCmdLineParserApp;
typedef BOOL (CCmdLineParserApp::*PFN_CMDLINE_ACTION)(LPCSTR pAction=NULL);<br />
<br />
typedef struct {<br />
char Switch[16];<br />
PFN_CMDLINE_ACTION pCmdAction; <----HERE!<br />
BOOL bIsTerminal;<br />
}CMD_LINE_ENTRY,*LP_CMD_LINE_ENTRY;<br />
pCmdAction is a member of structure CMD_LINE_ENTRY. CCmdLineParserApp, which is derrived from CWinApp, contains a static array of these. pE is a pointer into that array, and hence points to a structure of type CMD_LINE_ENTRY.
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: (pE ->*pCmdAction)(ResultString);
You need to precede this with an instance of CCmdLineParserApp , like:
CCmdLineParserApp c;
(c.*(pE->pCmdAction))(ResultString);
"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
|
|
|
|
|
DavidCrow wrote: You need to precede this with an instance of CCmdLineParserApp, like:
No, I forgot to tell, the code snippet is called from within a memberfunction of CCmdLineParserApp.
however I tried :(this->*(pE ->pCmdAction))(ResultString) and it worked. Have no Idea why.
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: I tried :(this->*(pE ->pCmdAction))(ResultString) and it worked. Have no Idea why.
Because you were trying to call a CCmdLineParserApp method using a pointer
to a CMD_LINE_ENTRY as the CCmdLineParserApp object.
In your fixed version, "this" is the CCmdLineParserApp object the method is being
called in the context of, and "pE->pCmdAction" is the pointer to the method.
Much better
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark.
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: I tried :(this->*(pE ->pCmdAction))(ResultString) and it worked. Have no Idea why.
When you call through a pointer-to-member, you have to say which object the function should get as its this pointer. If you want the function to get the current this pointer as its own this pointer, you have to say so. That's why the version with this->* works.
|
|
|
|
|
Thanks Mike.
Bram van Kampen
|
|
|
|
|
In my app, main frame has 5 child windows (base class is CWnd), the 5 children fully occupy client area of main frame and overlapped each others - similar to 5 property pages.
every time,only one of them is visible.
the 5 children are heavily painted in OnPaint().
problem is that when one is shown by ShowWindow(SW_SHOW) and others are hidden by ShowWindow(SW_HIDE), there is always some annoying visible flash at page changing time.
the reason I guess is that the paint is too heavy, so I use memory DC and disable OnEraseBkgnd() - howerver, the urgly flash still can be seen.
Do you have idea to kill the annoying flash?
Do I have to use ShowWindow() function to make one visible and others invisible?
Any suggestions are highly appreciated.
Thanks
|
|
|
|
|
What order are you making the ShowWindow(SW_SHOW) and ShowWindow(SW_HIDE)
calls in?
Try showing a child window before hiding the previous child window.
Also, if the main frame is always covered by one of the children, then
disable the main frame's OnEraseBkgnd.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
This apppears to be a problem with single threaded programs doing a lot of work! I consider it a design flaw in WINDOWS, and have been fighting with it for several years now. When the window you are working with gets a heavy task, and you send prior to that a SW_HIDE message, it hides your window. XP in particular (I Don't know about vista) seems will paint the most previous window immediately below it that it can find a thread for. This just could be the spreadsheet in which you were working out Staff Redundancies, or an email to the mistress. The only reason I can see behind this is that it avoids 'Blackness', and people thinking the machine crashed. A solution would be if the OS would show some non-descript blank screen (Nice Picture etc) instead of the last window of the previous app.
The only way I found out of this is by doing anything timeconsuming on a different thread, and show a 'wait box' This will even cure the short flashes you complain about.
Hope this is helpfull
Bram van Kampen
|
|
|
|
|
|
Hey,
What I'm trying to do is get the ip address that a program is attempting to connect to. I can't use microsoft detours because if there is a similar application running the ip address will get modified before my program receives the data. At the moment I am codecaving on the connect statement below, from there I store the second argument (pSockAddr, EDI + 4) into a DWORD variable. I'm told that it's possible to get the address that the program is trying to connect to from pSockAddr, but I'm not too sure how. I've tried a reinterpret_cast statement, but of course that would be too simple :P
PUSH 10 ; /AddrLen = 10 (16.)
PUSH EDI ; |pSockAddr
PUSH ECX ; |Socket
CALL DWORD PTR DS:[<&WS2_32.#4>] ; \connect
Could anybody guide me in the right direction? I've searched around this site and googled for about half an hour, without any luck. I'd really appreciate some help with this.
Thank you for your time,
urbanyoung.
|
|
|
|
|
If EDI is the address of a sockaddr, then at EDI+4 is a in_addr structure,
which is the 4 bytes of the IP address.
Once you get those 4 bytes into a DWORD, what do you want to do with them?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey everybody
I've been looking for a way to do that for a while, and right before I'm starting to go through the routing table and figure out the packet's trace I am turning to you...
Once a user connects to a VPN it receives an IP inside the organization he/she connected to.
Is there a way to get that IP? (I know it is in the routing table, but I don't know how to recognize that specific IP instead of others that might be...)
Thanks a lot in advance!
|
|
|
|
|
Hi,
I am working on an MFC Application in which there is chat option with sending emoticons/smiley features.
I am having the codes for each emoticons. When the emoticons button is clicked i want its code to de added in the EditBox.
Now the problem i am facing that I am unable to put the code of smiley at the cursor position. Rather I am able to put it either at the begining of the text or at the end of the text.
please help me.
Thanks In Advance.
Dhiraj Kumar Saini
|
|
|
|
|
|
Thanks a lot for the help. It solved my problem.
|
|
|
|
|
Hello,
I am developing a client and server application for bluetooth devoce. My server is desktop PC which has dongle attached and client will be Windows Mobile. As client server get connected server will send to client list of some files. from the client side i should be able to download file means copying file from server to client. I am using sockes for eastablise connections. Now i have to send a file from server to client. How can i send a file? Please help me.
Thanks and regards,
Yudhisthira attry(India, Bangalore)
|
|
|
|
|
I have three class's that I use in nearly every program I create. Each class is from a dialog resource. I want to create a DLL that would contain those dialogs and the class's that represent them. Is this possible? If so could someone point me to an example that loads another program's dialog resource and class?
A C++ programming language novice, but striving to learn
|
|
|
|
|
It's absolutely possible, just keep the three classes in a separate DLL project that you can include in any solution you create. Just include the appropriate headers where necessary, making sure to set the include paths as needed in the project configurations of the other projects, and set the project dependencies to include this DLL.
Not sure if I can point you to an example right now, but this is a rough idea of how it's done.
|
|
|
|
|
How do I include the dialogs the class's represent?
Do I create the dialogs in the DLL or somehow expost the dialogs from the other program into the DLL or what?
A C++ programming language novice, but striving to learn
|
|
|
|
|
Are these CDialog-derived (MFC) classes or your own classes?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes. I've started the DLL. I used the resource editor to create the dialogs in the DLL. Hopefully the programs the DLL is used in won't complain about the DLL's resource file. Will it?
A C++ programming language novice, but striving to learn
|
|
|
|
|
You have a few options, depending on how you want to link
to the MFC libraries and how your DLL will be used.
Read this link VERY carefully, choose the type of DLL you want,
and follow the links to that DLL type....all the info you need to
use them properly is there.
Kinds of DLLs[^]
If your dialog classes are derived from MFC, and only MFC apps will
use the DLL, then an Extension DLL[^] is probably a good choice.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I used "Static" instead of Extension". maybe I can change it?
A C++ programming language novice, but striving to learn
|
|
|
|