|
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 />
|
|
|
|
|
If you put a breakpoint, it totally changes both the message queue and the paint workflow ( additional Invalidate() and Update() methods, plus WM_PAINT commands will be sent to your window(s) ).
That's due to the app switch to the breakpoint. And that's the reason the behavior of your app foes not change if you post some messages or add Sleep().
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.
|
|
|
|
|
Thanks for the replies. I finaly figured out what was wrong, and as you suggested the breakpoint-thing was due to a WM_PAINT being send to the grid between the statements.
The problem was that SetScrollPos32 uses SetScrollInfo, where you can set the scroll bar position but not the thumb track position. The WM_VSCROLL handler in the grid would read the thumb track position (and not the scroll bar position) in response to SB_THUMBPOSITION and this would in turn set the first item to be displayed to a wrong value. The WM_PAINT message send by the break/continue event would invoke OnDraw, where the first item to be displayed would be set from the scroll bar position (and not the thumb track position), hence this worked.
I just removed the SendMessage(WM_VSCROLL, SB_THUMBPOSITION, 0) and replaced it with a call to Invalidate() - and then everything worked.
Thanks for yourhelp
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"
|
|
|
|
|
Hi...
Simple Question:
- I want to move a dialog box on the middle of CMyView. The dialog box is a member of CMyView...
I already use CWnd::MoveWindow(), GetWindowRect(), etc...
But the dialog box don't appear on the middle...
thank for all advices!!!
Hello World!!!
from Raphaël
|
|
|
|
|
Use GetClientRect instead
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"
|
|
|
|
|
Hi,
In a dialog-based application, i have a listbox to show the results of
some calculation and a progressbar to show the finishment of the task.
The problem is:
(1) the dialog window cannot be re-maximized when minimum is implemented under the case of the runing of the process.
(2) How to abort the process including the stop of the adding strings to listbox and stop the progressbar?
Thanks in advance!
chen
|
|
|
|
|
You should do the calculation in a worker thread or a process in an extreme case. Using a worker thread will allow the user to cancel the calculation.
Kuphryn
|
|
|
|
|
You will have to check the message queue frequently using PeekMessage. See for example MSDN KB Q74795, and I vaguely remember an article here on CP about it too.
PeekMessage is much easier than worker threads.
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"
|
|
|
|
|
i have process id and want to get main window hwnd how to get it.
r00d0034@yahoo.com
|
|
|
|
|
|
I think this might work for you, although it doesn't feel very elegant. Try looking at the Win32 API EnumWindows(). You define a callback function and pass that into EnumWindows(). For every top-level window open on the desktop, you'll get one call into your function, which hands you the HWND of that window and a user-defined field.
With the HWND, you can then call GetWindowThreadProcessId() to try and match to your already-known Process ID. So you'd set it up so that your callback function will keep churning (by setting the return value to TRUE) until it finds the right Process ID. Use the lParam field in EnumWindows to pass along an information struct that holds your ProcessID and the output HWND.
There's probably a cleaner way to do this, but this should get you on the right track. Here's some pseudo-code:
typedef struct
{
DWORD dwProcessID;
HWND hWnd;
} ENUM_PARAM, *LPENUM_PARAM;
BOOL CALLBACK cbEnumWindows( HWND hwnd, LPARAM lParam )
{
LPENUM_PARAM lpEnum = static_cast< LPENUM_PARAM >( lParam );
if( lpEnum )
{
DWORD dwProcessID = 0;
GetWindowThreadProcessId( hwnd, &dwProcessID );
if( dwProcessID == lpEnum->dwProcessID )
{
lpEnum->hWnd = hwnd;
return FALSE;
}
}
return TRUE;
}
int main( int argc, char *argv[] )
{
ENUM_PARAM EnumParam;
EnumParam.dwProcessID = 1234;
EnumParam.hWnd = NULL;
EnumWindows( cbEnumWindows, static_cast< LPARAM >( &EnumParam ) );
if( EnumParam.hWnd )
{
}
}
</code>
Ty
|
|
|
|
|
const int ca(200);
int &cb=*((int*)&ca);
cb=2400;
cout<<"ca="<
|
|
|
|
|
The compiler is probably optimizing because ca is declared const. The compiler can replace any references to ca and directly insert 200.
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Your reply sounds reasonable, but both the varibale of 'ca' and 'cb' have same address in memory, but their value is different, I just can't unstand it, it must be somewhere else for 'ca' or 'cb', is that correct!
|
|
|
|