tags:

views:

241

answers:

1

When using a CStatusBarCtrl in MFC I use GetItemRect to get the bounds of each item within the CStatusBar.

However I am seeing a problem now I use an XP manifest in the exe. That it will not return a correct rectangle so I no longer identify correctly when the mouse is in the far right of the control.

The problem can be tested with a method like this:

GetStatusBarCtrl().SetTipText(n - 1, _T("Test"));

When a CStatusBarCtrl is created and a pane is created with SetPaneInfo and the text set as above the tip text will not be visible when you mouse over the far right hand side pane.

This problem has been reported elsewhere. But has not got a satisfactory answer.

I need a solution or work around would be great.

A: 

My first guess would be differences between 'THEMES' in Vista and XP. Remember, if you are using a CFrameWnd there is a gripper control in what would be your last pane in the far right of the status bar. So, it looks as though changes in the ComCtl32.dll may account for this, thus, giving you a smaller rect. I assume you are just seeing a smaller rect.Width() than you did before? You are not talking about smaller X and Y at the same time are you?

If you have to, you may want to look for the correct version and deploy it with your app, or make your manifest reflect which version to use...

Sorry I don't have a clear cut answer, but Themes are the only thing that come to mind, since if I recall correctly, in VC6, the gripper was added on top of the status bar, OR the status bar was shrunk just enough to display it...

One suggestion you could use would be to detect your running version of Windows, and made the assumption of the gripper for the OS. The gripper will be the same size as the VScroll bar, so you can naturally remove that many DLU's (or Pixels) from the last cell at runtime, and render text based on that. I'll have to go home and fire up VC6, and see how it acts based on what you are saying here...

I don't have a Vista VM handy to see what version of ComCtl32.dll it has installed by default, but it's my guess they put some code in it to deal with the gripper.

If you have complete sample code, that would really make things easier on me too... Otherwise, I have to start digging for all my old VC6 generated code and go from there...

An interesting test would be to call GetSystemMetrics on the pieces that we think could have an effect on this, and see how they differ from system to system. If you put Vista into "Windows Classic" mode, do you still see the same results?

Also, which machine is your dev box? Vista or XP?

LarryF
More details have been added
JProgrammer