|
Your application sleeps in WaitForSingleObject call until the child process finishes. You need to handle application message queue using PeekMessage. Search in MSDN Library for Q74795 KB article "Using PeekMessage() Loops in a Dialog Box" for details.
Pavel
Sonork 100.15206
|
|
|
|
|
Thanks for the help Pavel, much appreciated.
|
|
|
|
|
Read up on the article you posted, also read about the
TranslateMessage and DispatchMessage functions but still
unclear as to where and how I would implement the
PeekMessage calls.
Once again, many thanks for the help.
Chris
|
|
|
|
|
Use the WaitForSingleObject call in a loop with timeout set to reasonable short time (100 ms?) and when it doesn't return WAIT_TIMEOUT, break from the loop. If it does, pump the messages using PeekMessage and continue looping.
Pavel
Sonork 100.15206
|
|
|
|
|
Hi to All
I want to ask u that how can i make a round shape window or elliptical shape window using MFC.Please explain with some Code
Thanks
Inam
|
|
|
|
|
In your OnCreate handler create a round region then call SetWindowRgn to change the shape of the window like this.
RECT rWindow;
GetWindowRect(&rWindow);
HRGN hRgn = :: Create EllipticRgnIndirect(&rWindow);
::SetWindowRgn(hRgn, TRUE);
You do not need to delete the region that is selected into the SetWindowRgn because windows takes ownership of that region. You should not use that region at all after you call that function.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi!
Can windows GDI command be used in the Visual C++?
I'm trying to do some coordinate transformation and mapping in the CView. Can I use windows GDI command such as SetWorldTransformation. It seems like using XForm method were much easier for coordinate transformation. Even if I can use GDI command in my visual C++ project how do I suppose to do it? I've tried the example in MSDN but it didn't work
Newbies
|
|
|
|
|
Zayax wrote:
Can windows GDI command be used in the Visual C++?
In Visual C++ for sure. If you mean in MFC then again, yes. MFC uses CDC class in drawing - it's a thin encapsulation of GDI display context.
Pavel
Sonork 100.15206
|
|
|
|
|
Yes you can, however the wrold translform functions are only supported on the Windows NT operating systems. So your program will not be able to be used on Windows 95, 98 and ME.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Is there any MFC way to do the coordinate transformation?
Newbies
|
|
|
|
|
I do not think that there is. THe reason why is because it would not be supported on Windows 9x.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Then how come there was some software that could do that kind of coordinate transformation and still could be use in win 9x?
Newbies
|
|
|
|
|
The transformations were probably written by hand and did not depend on the Windows API.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
This message continuously scrolls while my project is running and I can't seem to figure out why.
Anyone seen this before?
|
|
|
|
|
You should revise tab order and group styles of buttons in your dialog resource. Radio buttons in one group should be in tab order directly in sequence, first of them should have the Group style set, and the first control behind should have the group style set too.
Pavel
Sonork 100.15206
|
|
|
|
|
Yep that's is it! Thanks...I would have never guessed that the next control would have to have it's group flag set.
Thanks!
|
|
|
|
|
You may get this message anyway, if the radio buttons are the last controls in the tab order in the dialog. It's harmless, so I wouldn't worry about it.
Gary R. Wheeler
|
|
|
|
|
i call
CreatePolygonRgn //rectangle, 4+1 pts
SelectClipRgn
and than
GetClipBox
what returns different coordinates (not in all places but in repeatable situation - there always)
why?
how to transformate Create input to get wanted clipbox?
thanks
t!
|
|
|
|
|
I suspect that the "repeatable situation" is when scrolling occurs.
|
|
|
|
|
repeatable situation is printpreview
no scrolling but different map mode only (aniso)
get returns different scales for x and y and if i see well uncomparable to any view ones
t!
|
|
|
|
|
|
Is there any way to tell when a notebook has been unplugged from the network? Windows 2000 and XP must know this as a balloon tooltip comes up and tells you that the machine has been connected/disconnected from the network.
Thanks for any help you can provide.
Steve.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Hi Steve,
maybe my response to another question might
help you, unless you are the same person i originally replied to
Alwin
|
|
|
|
|
Hi,
I have a very spurious problem. I have a MFC Grid (thanks, Chris!) in a view in a MFC app. I want the grid to change the sort order of the items when the user clicks the header. So if the first item is selected when the header is clicked the grid should reverse the items and scroll down to the last item.
I have implemented the scrolling part this way:
void CMyGridCtrlDerivative::SetNewPosition(int nPos)
{
...code
SetScrollPos32(SB_VERT, nPos * GetRowHeight(nPos));
SendMessage(WM_VSCROLL, SB_THUMBPOSITION, 0);
}
where nPos is the new position (linenumber) to scroll to. All items have the same height, so I use the height of the nPos'th item to convert from linenumber to pixel.
This does not work when I execute the program with Go (F5) - the items are reversed after click on header but the grid does not scroll down, and the thumb position on the scroll bar is not changed. However, if I put a breakpoint on the SendMessage-line, and the execute with Go (F5) and press Go (F5) again when the app breaks, then everything works as planned! I don't change anything during the break, I just press F5.
I have tried to put a pause (Sleep(5000)) between the SetScrollPos32 and SendMessage calls, didn't work.
I changed the SendMessage to a PostMessage, didn't work.
What the f*** is going on?????
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
It is not a good idea to handle scrolling by sending WM_xSCROLL messages, as there many problem will arise, as you call SetScrollPos32 and then send WM_VSCROLL + SB_THUMBPOSITION which is processed internally so that it interferes with previous call of SetScrollPos32. Also read the excellent book by Richter on Win32 programming, namely - section on message queuing. You'd better deal with functions that perform necessary operations when WM_xSCROLL messages are received. Just an example:
<br />
void CMyGridCtrlDerivative::SetNewPosition(int nPos)<br />
{ <br />
...code <br />
SetScrollPos32(SB_VERT, nPos * GetRowHeight(nPos)); <br />
DoProcessWmVscroll(SB_THUMBPOSITION);<br />
}<br />
|
|
|
|