|
Why are you changing things in WM_SIZE? Just let windows do it's job, and it will do it by itself.
I think the reason that it's failing is that you're getting in the way! WM_SIZE is largely meant for information purposes, or changing scroll bar meanings, etc.
Create a brand new MDI project, don't add any code, and you'll see if I'm right or not.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Thanks for answers
I ll do that and see.But I have done that earlier , what happened at that time was the child window merged with the main window but now the main window didn't get restore button , the main window has minimize,maximize and close buttons
Prithaa
|
|
|
|
|
If it's anything like any MDI program I've worked on, the main window keeps it's normal buttons, but gains a smaller set just below them for the MDIChild.
I feel pretty sure that the bare wizard generated MDI app will work that way. If yours does not, you'll have to tear away more of your software until you get back to basic behaviour, then build back up again.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Thanks for your replies
I ll check up
|
|
|
|
|
I have a program that connects to a database in a local 2008 SQL server to create a couple of tables. On most machines the connection time is about a second but on mine it was taking several seconds. I've just discovered that if I change the connection protocol from shared memory to TCP/IP, the connection time drops back to around a second. The same problem occurs if I boot either Vista64 or Windows 7 beta (two separate SQL server installations). The main difference between my machine (HP xw4600) and others is the CPU, I have a quad core where as the others will be dual cores. Can anyone suggest what may be wrong?
|
|
|
|
|
I can imagine that it takes longer to create and open the file mapping for shared memory, than it takes to create a new socket and connect to the server socket.
But that's only a one time cost. Why not do some testing to see if the performance for using the database is faster or slower for one type of connection over the other?
|
|
|
|
|
There's no problem with speed once the connection has been established. I've also discovered that I only had to enable TCP/IP to speed up the connection. Previously I was disabling shared memory as well. The order of preference has shared memory before TCP/IP so I've no idea what's going on!
|
|
|
|
|
I am making a project depending on mfc. in this project ,i created a object(here named it xobj) ,which is defined by myself, in the cmainwnd object construction, and destructed it in the cmainwnd object destruction. but in one cmainwnd object member function,i created a thread and also pass the pointer of the xobj into the thread. When the application is closed, destruction of cmainwnd object is called so as the xobj destruction,but at some time the thread is not end ,it still has the pointer of the xobj which means nothing now.
How to solve this?
I have tried the event,I made the del xobj wait until the thread is end in the destruction of cmainwnd object.but it seems not work.why?
|
|
|
|
|
tyr2000 wrote: I have tried the event,I made the del xobj wait until the thread is end in the destruction of cmainwnd object.but i seems not work.why?
Post some relevant code of your destructor.
|
|
|
|
|
relevant code? can you give me some more details about the relevant code ?
i'd appreciate it very much.
|
|
|
|
|
Well, the code from your destructor but only things that are related to your problem (+ explanations of the variables if needed).
|
|
|
|
|
sorry ,i can't totally understand you. could you pls give some sample code? or just explain it clearly? do you mean i should do some thing in the destructor of cmainwnd object? if so ,what is the "some thing"?
sorry for my poor english
thank you again.
|
|
|
|
|
C'mon, it's not that difficult to understand is it? I asked YOU to post the code of your destructor so that WE can see YOUR code on this forum (by 'post' I mean that you just reply and you include the code in your reply message). Your explanation was not very clear, so looking at your code might help us to locate your problem. By relevant I meant that you shouldn't post all the code from your destructor but only the parts which are related to your problem.
And please use the code ("code block") tag (just above the emoticons) to format your code so that it is readable.
|
|
|
|
|
thank you for your patient. i will post the brief sample code tomorrow.pls help me then.
It is late night in my contry.
|
|
|
|
|
tyr2000 wrote: It is late night in my contry.
Your profile indicates you are in the USA. Is that not correct?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
my profile is not correct.Maybe i should make it right.
|
|
|
|
|
class CMainframe:: public CFrameWnd
{
cmainframe()
{
XOBJ* m_xobj= new XOBJ;
}
~cmainframe()
{
del m_xobj;
}
void xfunction()
{
ParaForThread =&m_xobj;
HANDLE handle = CreateThread(NULL, 0,ThreadProc, ParaForThread,0,NULL);
closehandle(handle );
}
XOBJ* m_xobj;
};
DWORD WINAPI ThreadProc(LPVOID lpParameter)
{
XOBJ* obj = (XOBJ*)lpParameter;
for(int i;i<1000;i++)
{
obj->somefunction;
}
}
my assumed simple sample,pls help;
|
|
|
|
|
you know about the code which is relevant to the problems you have.
This signature was proudly tested on animals.
|
|
|
|
|
tyr2000 wrote: relevant code? can you give me some more details about the relevant code ?
Relevant code.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
thank for english teaching
|
|
|
|
|
You need to synchronize the main thread (that's the one the CMainWnd is running in) with the other thread. In addition, have you at any point told the other thread to exit? If not, it won't, until the application exits.
Without seeing code, it's difficult to say much more.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i think your answer lighten me up. after creating main thread creating the thread ,i used closehandle();do you me if i hold the handle of the thread, the problem will not hanppen? aslo there is no more synchronize work needed?
|
|
|
|
|
No, there's more to it than that. Typically, a program using an auxiliary thread will probably have one of two patterns:
A thread that does one thing then exits its thread function
The auxiliary thread exits of its own volition. The main thread can then check that the thread has exitted using the GetExitCodeThread[^] function (the functions shows a thread exit code of STILL_ACTIVE if the thread hasn't terminated), or can wait for the thread to exit using the WaitForSingleObject[^] function, using the thread handle as the handle to wait for (a thread's handle is set when the thread exits).A thread that does many things in a loop
In this case, you need some way of telling the thread that it's time to exit. In general, you could use a boolean flag that the thread can check each time round the loop (use InterlockedExchange[^] to set the flag from the main thread) or you could use an event[^] - the main thread would set the event to indicate that the other thread should exit, the other thread use WaitForSingleObject to see if the event's been set). In either case, the main thread would notify the other thread that it's time to exit, then wait for the thread to exit using WaitForSingleObject.
Use the appropriate pattern (I suspect it's the second from what you've said) when the thing that created the thread (your cmainwnd?) is destroyed.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hi to all,
i have the following problem, when the SDI-Application starts, the window is disabled i can not write anything in it, any help to solve this problem will be appriciated.
I am using Visual Studio 2005
Thanks
|
|
|
|
|
You will have to choose CEditView instead of CView for the Application to support editing by default. Either create a new project and from "Generated Class" option, choose CEditView or CRichEditView instead of CView or manually rename CView References in your project to CEditView then it should work fine.
If your question is something else, please mention it clearly.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|