|
See these two links:
http://flounder.com/workerthreads.htm
http://flounder.com/uithreads.htm
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
You can call GetExitCodeThread on the thread's handle. If it returns STILL_ACTIVE as the code then the thread is still running.
You can also use WaitForSingleObject on the thread's handle to wait until the thread is finished.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
is it like this?
CWinThread *myThread = AfxBeginThread....
while(GetExitCodeThread(myThread) == STILL_ACTIVE)
{
....
}
|
|
|
|
|
No. First off you are using GetExitCodeThread wrong, look it up in MSDN. Second, as David said above, constantly polling the thread is not a good thing to do.
Stops the caller thread until the new thread finishes:
CWinThread *myThread = AfxBeginThread(...
WaitForSingleObject(myThread->m_hThread, INFINITE);
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Hi,
i want to reduce the size of the CFileDialog(or any Common Dialog) i mean i need to compress(Shrink it ) it so it looks small.
Regards
FarPointer
|
|
|
|
|
MoveWindow() for example ....
SkyWalker
|
|
|
|
|
MoveWindow may not work ,if you are using DoModal ()directly on a object of CFileDialog
Inherit a class from CFileDialog and over -ride the OnInitdialog .Now include the MoveWindow()
Cause is my effort;
Effect is God's effort
|
|
|
|
|
If you didn't want to inherit the class and override OnInitDialog, you could probably just declare the dialog, say CFileDialog myDialog and then call myDialog.CalcWindowRect() and pass the resulting RECT or CRect structure into myDialog.Create() . This is how the framework already sets up the window size prior to creation, but if you do some of it yourself, you can change the RECT or CRect structure in between to whatever size you wish.
I've never actually tried this myself in practice, but reading through the documentation, it should work. Check out MSDN.
Danny
The stupidity of others amazes me!
|
|
|
|
|
I guess this method won't work as the HWND of the CFileDialogis not yet created !
(Worst case - try with Hooks ) .
Install a hook before Do Modal ()
Handle the Hook for it and delete the hook after that .
Cause is my effort;
Effect is God's effort
|
|
|
|
|
The method I noted in my post only handles a CRect or RECT structure, so you don't need the window to be created yet, but yes, your method, Raaja, would require the window to be created already.
Danny
The stupidity of others amazes me!
|
|
|
|
|
CFileDialog myDialog
myDialog.CalcWindowRect()
myDIalog.create ....
If this is what you have suggested ,then CalcWindowRect () call is going to fail as the window is not yet created !
Check for the Assert statement in CWnd ::GetExStyle() which is accessed in CalcWindowRect()
Cause is my effort;
Effect is God's effort
|
|
|
|
|
Ah, I see that MFC guru. Since you know MFC so well, explain this explanation of CalcWindowRect,
"Call this member function to compute the required size of the window rectangle based on the desired client-rectangle size. The resulting window rectangle (contained in lpClientRect) can then be passed to the Create member function to create a window whose client area is the desired size.
Called by the framework to size windows prior to creation.
A client rectangle is the smallest rectangle that completely encloses a client area. A window rectangle is the smallest rectangle that completely encloses the window."
I noted in there some phrases like, this is "called by the framework to size windows prior to creation" and how this function is called "to compute the required size of the window" and then you can pass the rectangle "to the Create Member function to create a window".
Do you have some constructive critism, like how he might be able to make this work?
Danny
The stupidity of others amazes me!
|
|
|
|
|
hi
can i overide my GetWindowRect.
|
|
|
|
|
Not sure, but I would guess, no.
Danny
The stupidity of others amazes me!
|
|
|
|
|
DOn't take this personally danny !!!Iam no expert ,iam just sharing what i have tried in Visual Studio ..thats it .
I just refrred to the example in MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cwnd.3a3a.calcwindowrect.asp
If thee link is not working ,refer to Cwnd ::calWindowRect in MSDN and refer to the example given at the end .
calcWindowRect will calculate the window Rectangle ,given the client reactangle size (required size).
In this case ,ur call to calcWindowrect will return the same client rectangle size as m_hWnd of that window is NULL .CHeck CWnd::GetStyle() and CWnd ::calWindowrect() .
In this case CalcWindowRect won't be useful at all .U can directly use Create with required window size .
Cause is my effort;
Effect is God's effort
|
|
|
|
|
I'm trying to write a new class that is a derivative of CObject. The code all looks fine to me, but when I try to compile I get an error saying "constructor not allowed a return type", but I'm not trying to put a return type, or a return statement. Here's the code.
In ClassNameOb.cpp:
#include "stdafx.h"
#include "ClassNameOb.h"
ClassName::ClassName()
{
m_var->VarOne = m_var->VarTwo = m_var->VarThree = m_var->VarFour = m_var->VarFive = -1;
m_otherVar = -1;
}
ClassName::~ClassName(){}
In ClassNameOb.h:
class ClassName : public CObject
{
protected:
struct structType
{
int VarOne;
int VarTwo;
int VarThree;
int VarFour;
int VarFive;
}*m_var;
int m_otherVar;
public:
ClassName();
~ClassName();
}
And then I get an error pointing to the line with the first { bracket of the constructor saying, "constructors not allowed a return type".
Why am I getting this error when I'm not even trying to return anything?
Danny
The stupidity of others amazes me!
|
|
|
|
|
You need:
class ClassName : public CObject
{
...
};
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Aaaahhh!!! How annoying! I wish it couldn've told me it was a stupid syntax error!
Danny
The stupidity of others amazes me!
|
|
|
|
|
The OP missed the semicolon at the end of the class declaration?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
OP? I assume you mean the compiler? In that case, yes, it missed it. How annoying!
Danny
The stupidity of others amazes me!
|
|
|
|
|
|
Oh, thanks. Yes, and I feel dumb for having missed it.
Danny
The stupidity of others amazes me!
|
|
|
|
|
Hi everyone,
I hope that someone can help me solve my problem...
Well, I would like to click-and-drag the child window and move it within its parent!
From child's window procedure, catching WM_MOUSEMOVE, I tried to call SendMesage(hWndParent,WM_MOUSEMOVE, NULL, NULL) in order to make it move.
Well it does not work! I tried Handling WM_MOUSEMOVE from the parent only but the child window would move with the mouse only whan the mouse leaves the child and 'touches' the parent window!
Is there anyone who can, in simple C++, help me to get over this issue?!
Thanks!
|
|
|
|
|
... SS_NOTIFY ....
see one thread below
SkyWalker
|
|
|
|
|
Frstly thanks to SkyWalker for the agility.
Unfortunately it will not work with the SS_NOTIFY because I referred to the windows which I created from the scratch, i.e. I did not use the MFC.
I have two windows involved, one is the main app’s window and the other one is created with the extended style, which identifies it as a child window (WS_CHILD).
I managed to move the child window by calling SetWindowPos while catching WM_MOUSEMOVE events from the parent window!
The thing is that, while with the mouse over the child window, I do not know how to catch WM_MOUSEMOVE of the parent. Naturally while over the child window all messages are going to that window!
I hope that the picture of my problem is slightly clearer.
|
|
|
|