Need help adding scroll bar to edit box - c++

I'm making an MFC dialog-based application in Visual C++ 2005. I added a scroll bar to an edit box. How do I program the scroll bar to make it work?

The windows styles wS_VSCROLL and WS_HSCROLL control if there is a scroll bar present or not. Normally you just setup these styles as part of the resource dialog template.
With MFC you use the "CWnd::ShowScrollBar" method to turn the scroll bar on/off.
When scrollbars are turned on, then they should work automatically for edit controls. You don't need to do anything.

http://www.functionx.com/visualc/controls/scrollbar.htm
has code you can use to control the scroll bar.

Related

Minimize button and context help button in the same title bar in Qt

To make a help button in the title bar in a Qt window of the type QWidget, I do like this:
myWindow->setWindowFlags(Qt::WindowContextHelpButtonHint);
This works fine.
To make a minimize button in the title bar in the same kind of window, I do like this:
myWindow->setWindowFlags(Qt::WindowMinimizeButtonHint);
This also works fine.
What I want to do is to have both a help button and a minimize button in the title bar of same window. For that, I tried to combine the flags:
myWindow->setWindowFlags(Qt::WindowContextHelpButtonHint | Qt::WindowMinimizeButtonHint);
This only shows the minimize button, not the help button (at least in Windows). How do I show both buttons in the same title bar?
Unfortunately, this is impossible on windows. Here is why:
Qt::WindowMinimizeButtonHint is implemented by adding WS_MINIMIZEBOX window style, see here.
Qt::WindowContextHelpButtonHint is implemented by adding WS_EX_CONTEXTHELP extended window style, see here.
From the reference for WS_EX_CONTEXTHELP:
WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or
WS_MINIMIZEBOX styles.
So, you can never have a window with the minimize button [ - ] and the context help button [ ? ] on windows.
If you really want to do so, you may have to use a frameless window, and provide your own custom frames.
Note: This answer is about windows platform only.

Can I remove the caption in a CDockablePane

I'm porting a MFC application to use the Ribbon UI and MFC feature pack and would like to have a docked horizontal pane that does not include a caption. I'd hope that something like
MyPane.ModifyStyle(WS_CAPTION, 0);
m_pParentFrame->RecalcLayout();
would work, but no joy. FWIW, the docking pane is hosting a wide horizontal dialog docked under the main view and the caption wastes more desktop real estate than I'd like to give away.
Edit: Further googling found a possible solution here: http://www.sibisa.com/remove-hide-title-bar-board-cdockablepane-window/
Edit2: EnableGripper(FALSE) was what was needed, see https://msdn.microsoft.com/en-us/library/bb984118.aspx
Calling EnableGripper(FALSE) removes the caption.

C++ WinAPI - How to make button appear pressed?

I have in my editor few editing modes. I can choose specific mode using buttons that are placed on a toolbar. I want to indicate which mode is currently on. When I press appropriate button - I want to make the clicked button remain pushed. How do I do that in WinAPI? My toolbar uses bitmaps for icons if that's relevant.
There used to be a way to get something like the look and feel of a toolbar by using a normal check box with the BS_PUSHLIKE style set. But that got broken a bit with Windows XP because of mouse hover effects, so it's not widely used any more.
If you want to create your own toolbar, without the help of MFC, there is an MSDN article that covers the creation and management of a toolbar window (actually a dedicated window class as part of the Common Controls Library).

Propertysheet Dialog box not dispaly propery in Windows 7

I have an application which has Propertysheet dialog box with PropertyPage and dialogbox has three button at the bottom.
PropertySheet and PropertyPage create using MFC CProperySheet and CpropertyPage.
Dialog box display fine in windows xp but in windows 7 its partially cut three button
Please Help me to resolve this problem
It's probably due to the font size being something other than default size (check the DPI in the Display properties). If you're manually sizing the property sheet you'll need to be aware that the dialog units will be multiplied by a factor to calculate the size for a given DPI.
Let me clarify:
Are you embedding property sheet in a dialog?
If yes:
Is there any reason to do so?
The buttons you mention belong to a dialog or property sheet?
Are you resizing property sheet?
If buttons belong to the dialog are they cut by the bottom of the dialog?
The best if you post a snapshot of the dialog from XP and 7.

How are controls put in the caption bar?

I noticed Firefox 4, Opera and Chrome, and IE 7/8 put buttons and controls in the title/caption bar, how is this done?
Thanks
http://img199.imageshack.us/img199/3307/slayerf.png
alt text http://img199.imageshack.us/img199/3307/slayerf.png
What they probably do is turn the caption bar off entirely (by excluding the WS_CAPTION window style), add a glass area to the top of the window, and then draw their own controls.
See http://msdn.microsoft.com/en-us/magazine/cc163435.aspx for more on glass.
Probably they simply handle the WM_NCPAINT message and draw part of the non-client area (which includes the borders and the caption bar) by themselves; they will also handle WM_NCLBUTTONDOWN, WM_NCHITTEST and other WM_NC* messages to emulate the behavior of a button on the caption bar.
Or at least, this was the way it was commonly done before Aero; I don't know how much it changed this kind of things.
Yes, you can do that.. you have use window hooks, insert your dll in remote process and run the function of dll remotely. here is full fledged article dealing with it :-
http://www.codeproject.com/KB/threads/winspy.aspx