|
How can i add a tooltip to a buttons and to ToolBar burrtons?
thanks
|
|
|
|
|
Hi,
- to add a tooltip to a button control use CToolTipCtrl::AddTool (...)
- to add a tooltip to a ToolBar I use the Ressource Editor to add menu-items. The ids of my menu items are associated with my toolbar buttons (they have the same ressource id). In the properties dialog of a menu item, put any text in the "statusbar-text" field. The part of the string after a '\n' is used as tooltip for the toolbar automatically by the framework.
Nice day ,
~ Florian
--
Florian Heidenreich
WWW: http://www.mp3tag.de
eMail: codeproject@mp3tag.de
|
|
|
|
|
thanks, but i am using a simple application based on a dialog, with no framework, i create this toolBar manualy, at run-time. i've tried what u said and it didnt work... any other ideas?
thanks
|
|
|
|
|
the problem i came across: i want to be able to zoom in or zoom out a bitmap
(original size is 800*600)on a dialog,every time when the user clicks the zoom button,
i stretch the bitmap by ratio of 2,4,8,16,32 of the original size.When i set my
system's color mode to 24bit true color and the ratio reach to 8,it doesn't work,
whereas under the mode of 16bit enhance color or 32bit true color,it work!
BUT WHY?Had i forgotten anything?
the code is:
CMyDialog::OnPaint()
{
CPaintDC dc(this);
HDC hdcMem1=CreateCompatibleDC(dc.GetSafeHdc());
SelectObject(hdcMem1,m_hBitmap);
int nRaster=dc.GetDeviceCaps(RASTERCAPS);
if((nRaster & RC_STRETCHBLT) !=RC_STRETCHBLT){
dc.TextOut(100,100,"Not surport StretchBlt()");
return;
}
dc.SetWindowExt(m_szImage.cx,m_szImage.cy);//m_szImage if the size of the bitmap;
dc.SetViewportExt(m_szImage.cx,m_szImage.cy);
dc.SetStretchBltMode(COLORONCOLOR);
BOOL ret=StretchBlt(dc.GetSafeHdc(),0,0,m_szImage.cx,m_szImage.cy,hdcMem1,0,O,800,600,SRCCOPY);
DeleteDC(hdcMem1);
}
Thank in advance;
Truely yours julia.
|
|
|
|
|
I'm really sorry to tell you this, but it is a known bug. StretchBlt was purposefully limited, and accidentally overlimited. To do what you want, you need to stretch to an intermediate bitmap, so the stretch is performed in two steps. Or move to GDI+.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Hi,
Why I cann't print the brush into the rectangle if it create with bitmap!
For Example:
CMyView::OnDraw(...)
{
CBitmap bitmap;
bitmap.LoadBitmap(IDB_...);
CBrush brush(&bitmap);
CBrush * brOld = pDC->SelectObject(&brush);
pDC->Rectangle(0, 0, 300, 300);
pDC->SelectObject(brOld);
}
|
|
|
|
|
Brushes from memory can only be 16x16 under W9x.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Hello,
I am using a windows hook(WH_JOURNALRECORD) to hook right-click message system-wide. Once I detect a right-click message in the hook procedure, I want to remove the right-click message from the system message queue and prevent it from passing on to any window under the cursor or desktop('cause that will bring up whatever right-click context menu. I have no success on this. Could you please show me how to achieve this? Thank you very much in advance.
|
|
|
|
|
Hello,
Could anyone please show me how to create an Always On Top window like ICQ or Task Manager except it is transparent? I want the window to be Topmost and no application being maximized can stay above it. I am creating my window like this, but it is not always on top. Please help, tell, or show me what to do, thank you.
// Create the window (this doesn't work, I don't know why)
// If I do a Alt-Tab, other windows being maximized can still go above it
hwndHotkey = CreateWindowEx(WS_EX_TRANSPARENT | WS_EX_TOPMOST,
szWindowNameHotkey, NULL,
WS_POPUP, 0, 0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, ghInstance, NULL);
SetWindowPos(hwndHotkey,
HWND_TOPMOST,
0,
0,
0,
0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
|
|
|
|
Try to write: SetWindowPos(&wndTopMost, ... );
When I use (for example) SetWindowPos(&wndTopMost,1,1,200,200,SWP_SHOWWINDOW );
my dialog window is always on top.
Best regards, Vitaliy
|
|
|
|
|
How do I go about keeping my form-view based app from being resized, I'd also like to hide the maximize/restore restore button....
|
|
|
|
|
Try catching the WM_SIZE/WM_SIZING message but don't resize anything. I don't know how to hide the maximize/restore button.
Here are a couple links you may find interesting:
OnSizing
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cwnd.3a3a.onsizing.asp
OnSize
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cwnd.3a3a.onsize.asp
Hope that helps.
|
|
|
|
|
You need to remove a couple of window style flags from the main frame: WS_THICKFRAME and WS_MAXIMIZEBOX. The easiest way to do this in MFC is to override CWnd::PreCreateWindow().
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
return TRUE;
}
--------------
"Aagh!! I'm a victim of a Random Act of Management!"
|
|
|
|
|
Ulf is on the right track. However, I like the thick frame style so I take a somewhat backdoor approach. Catch the WM_NCHITTEST message (I think it is), which is the non-client hit test and tell the OS that it never hits the corners or sides. If you don't want it to be unmoveable then don't "let" it hit the title bar. This way, you can have a standard appearance but the window will be non-resizable and unmovable.
|
|
|
|
|
I agree that apps look better with the thick border style. Catching WM_NCHITTEST is not 100% foolproof, though. It prevents the user from resizing the window, but Windows can still resize it (if the user, for example, clicks "Tile windows" from the task bar). Also, if the window has a status bar, it can be resized with the status bar's gripper. These problems can be solved by catching WM_GETMINMAXINFO and setting the window's min and max tracking sizes.
--------------
"Aagh!! I'm a victim of a Random Act of Management!"
|
|
|
|
|
I'm working on a personal project using MFC. I'm still a beginner with it, however One thing that I'm having problems with is trying to figure out how to communicate between the different components of my application. I have a Main Frame window with the Report Control View (http://www.codeproject.com/miscctrl/reportctrl.asp), a toolbar, and a menu. Now, what I would like to do is allow the user to delete/edit entries in the view using the keyboard (catching windows messages for the view) and also using the toolbar and menu on the main window. How can I communicate with the view through the main window class? I'm finding it confusing trying to figure out the message maps for both view and frame.
I'm sure it will fall together when I get other peoples' ideas. I hope my description wasn't too confusing
Any help will be appreciated.
|
|
|
|
|
|
How can I communicate with the view through the main window class?
2 ideas: CFrameWnd::GetActiveView() and cast to your view class or keep a pointer to your view as a member of your frame class. Set it in OnCreate(...)
Now if only someone would answer my question. I did this for good karma
|
|
|
|
|
It works on NT 4.0, Win95 and Win98 but fails on a windows 2000 computer. I have Client for Microsoft Networks (with file sharing enabled), TCP/IP and NetBEUI network protocols installed.
Any ideas?
Cathy
|
|
|
|
|
Hi Cathy,
What does CFileException* pException tell you is wrong?
(Some good karma for me )
Neville Franks, Author of ED for Windows
www.getsoft.com
|
|
|
|
|
"An invalid file handle was associated with \\ComputerName\DirName\filename.ext"
This is the code:
serverfile.Open(csServerFileName, CFile::modeCreate |
CFile::modeWrite |
CFile::typeBinary, &e)
This works fine from other operating systems.
Cathy
|
|
|
|
|
My guess is that you're using a UNC and MSDOS doesn't know about such things.
Neville Franks, Author of ED for Windows
www.getsoft.com
|
|
|
|
|
I'm running on a win2000 machine trying to read a shared file on an MSDOS machine.
The same code runs without problems on 95, 98, ME and NT 4.0
|
|
|
|
|
Look at the actuall OS Error code being returned from the CFileException and see if you get find more detailed info about it. eg. Lookup MSDN for the extended error code in question.
It may be a security issue, but that's a wild stab in the dark.
Neville Franks, Author of ED for Windows
www.getsoft.com
|
|
|
|
|
It returns 66. I will look into it more on Monday.
Have a good weekend and thank you for your help.
Cathy
|
|
|
|
|