|
hello,
The TableFrame's CreateFrame() is creating the Child Window and when the maximize is pressed the OnSize() is called.
TableFrame::CreateFrame()
{
if(!CMDIChildWnd::Create(NULL, FrameName , WS_VISIBLE | WS_CHILD |
WS_BORDER |WS_MAXIMIZEBOX | WS_MINIMIZEBOX |
WS_THICKFRAME | WS_OVERLAPPEDWINDOW
|WS_VSCROLL | WS_HSCROLL ,
WindowSize(), pFrame, NULL))
{
TRACE0("Failed to create view window\n");
return false;
}
}
void TableFrame::OnSize(int nType)
{
switch(nType)
{
case SIZE_MAXIMIZED :
{
CRect ParentRect;
MDIMaximize();
break;
}
}
}
|
|
|
|
|
Is TableFrame derived from CMDIChildWnd?
|
|
|
|
|
hello,
thanks for your replies.
yes TableFrame is derived from CMDIChildWnd
Prithaa
|
|
|
|
|
Why are you calling MDIMaximize() from OnSize?
I just tried it in a sample application. But could not find any problem... If you can please mail me the source. It is ns.nest@gmail.com
|
|
|
|
|
Hello,
I am using MDIMaximize() to maximize the child window. I ll try to post the code.
Thanks,
Prithaa
|
|
|
|
|
I shall check the code... may be a little bit later...
|
|
|
|
|
Problem can be solved by calling CMDIChildWnd::OnSize in TableFrame::OnSize.
|
|
|
|
|
Hello,
Thanks ,
Now I am getting the minimize,restore,close buttons for the child window and minimize,maximize,close buttons for the main window but it looks like the minimize,restore,close buttons for the child window does not have a handler function
but the main window's button handler is the TableFrame's OnSize().
Pritha
|
|
|
|
|
Ya... I found that but didn't get enough time to resolve that...
prithaa wrote: but the main window's button handler is the TableFrame's OnSize().
I didn't understand...
|
|
|
|
|
Thanks for all the help
If you happen to find out the problem then please let me know
my address
priyakalashi@yahoo.com
|
|
|
|
|
Hi,
I'm hacking at this now for several hours, it will not compile.
I've the following declaration
<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;<br />
BOOL bIsTerminal;<br />
}CMD_LINE_ENTRY,*LP_CMD_LINE_ENTRY;<br />
Later on in the code I've found a LP_CMD_LINE_ENTRY pE. I try to execute
the Relevant pCmdAction function as follows:-
<br />
(pE ->*pCmdAction)(ResultString);<br />
I get:
C:\Projects\CmdLineParser\CmdLineParser.cpp(143) : error C2065: 'pCmdAction' : undeclared identifier
C:\Projects\CmdLineParser\CmdLineParser.cpp(143) : error C2297: '->*' : bad right operand
I do not use this syntax very often, and I'm obviously making a very silly syntactic mistake. Any ideas??
regards
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: 'pCmdAction' : undeclared identifier
Where is pCmdAction declared? I don't see relevant code in your post
that would cause the error.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
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++
|
|
|
|