I am wanting to display a context menu when a user right-clicks on an item within a CListCtrl. My code is as follows:
void DatastoreDialog::OnContextMenu(CWnd *pWnd, CPoint pos)
{
// Find the rectangle around the list control
CRect rectMainArea;
m_itemList.GetWindowRect(&rectMainArea);
// Find out if the user right-click...
I just wondering about this.It is said that .NET is better than MFC in a lot of aspects.But when I use my PEID to recursive scan my 'program files' directory,it turns out there are still a lot of programs written with 'Visual C++ 6'(esp. for security software),whose GUI should be written with MFC.
So my questions are:
Is MFC still the...
I have a WTL application that uses an extended combobox control (the Win32 class ComboBoxEx32) with the CBS_DROPDOWNLIST style. It works well (I can have images against each item in the box) but the keyboard behaviour is different to a normal combobox - pressing a key will not jump to the first item in the combo that starts with that le...
If you have images stored in a CImageList, is there an easy way to render them (with proper transparency) scaled to fit a given target rectangle? CImageList::DrawEx takes size information but I don't believe it does scaling, only cropping?
...
This is an easy way to draw some text with a default font.
pDC->SelectObject(GetStockObject(DEFAULT_GUI_FONT));
pDC->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
pDC->DrawText(text, -1, rc, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_END_ELLIPSIS);
How can I do exactly the same, but in bold type... same font but bold? Ca...
I'm working with an MFC application using Visual C++ 6.0. When I double-click on one of the elements of a dialog box in Resource View, I get the error "Cannot add new member."
I understand that the source of this might be corrupted metadata in the source files associated with that resource.
Do you know any methods for determining what ...
Is this really the only way to get the correct address for an instance function:
typedef CBitmap * (CDC::* SelectObjectBitmap)(CBitmap*);
SelectObjectBitmap pmf = (SelectObjectBitmap)&CDC::SelectObject;
First, one has to create a typedef, and then one has to use that to force the compiler to select the correct overloaded method when t...
I have a MFC application that displays annotated maps, which can include a large amount of text. While the size and font of the text does not tend to change much, the rotation of the text varies considerably, in order to be aligned with the surrounding line work. This basically means that I have to do create and select a new font into ...
Hello,
I am building MFC application where there is CDialog with child control derived from CStatic on it.
I want to receive mouse events for CStatic control so I set "Notify" for it to true. Now I am able to receive message events through message map directly in MyStatic:
class CMyStatic : public CStatic
{
afx_msg void OnLButtonDow...
hello all,Am having a hard time in adding image along with a text in a Button..I know that it can be done by enabling the owner draw function with bitmapbutton class..But I dont want to that..so is ther anyother way that i can add an image along with text without drawing the text?
...
What would be the easiest way to make a thumbnail view, where you have a panel with a vertical scroll bar, and a matrix of images describing their associated image? I'd also like it such that if the parent frame resized horizontally, the matrix would shrink to as many columns as necessary to display the thumbnails without a horizontal sc...
I have a derived CMFCListCtrl which I can used group by and sort by fine via a contect menu.
However when group by is being used and I select a column to sort by (by clicking on the coloumn header) the arrow changes but the items are not sorted, I don't get my 'onsortby' message triggered either, any ideas?
I'm on XP is that the problem...
1.I want to find a window and set focus on it , but window is not taking the focus.
2.If i use HWND_TOP then it does not make the window active and if i use HWND_TOPMOST then it make window always on top.
Can anyone help me ??
HWND hwndAppDlg = ::FindWindowEx(hwndDesktop,NULL,lpszClass,lpszWindow);
if(hwndAppDlg && IsWindow(hwnd...
Hi,
I wrote an IE plugin using MFC activex. The plugin actually creates a file in CLSID_APPDATA folder and writes some data inside it. But the problem is that file which is created cannot be seen (i mean i cant see any file in CLSID_APPDATA folder on windows vista) whereas I am actually writing data inside it. The plugin is not signed.
...
I would like to update some toolbar-like code we have to have a Vista/Win7 gradient roundedness to them.
Currently, the buttons have the Windows 2000 look & feel: blocky, single-tone.
I've played around with the XP themes, and using DrawThemeBackground, DrawThemeEdge, etc.; but I'm very dissatisfied with the theme drawing mechanics (th...
In my Windows CE DLL project, I am trying to tell Visual C++ to link statically to MFC in a project that originally did not use MFC. However, upon linking successfully, Dependency Walker (depends.exe) says that my DLL is dynamically linked to MFC80U.DLL and MSVCR90.DLL. Has anyone else encountered this bug?
If "Use of MFC" is set to "Us...
I have a Bitmap image that i want to load dynamically. But I am unable to load it.
CBitmap bmp;
bmp.LoadBitmap("c:\aeimg");
it does not seem to be working.
Can someone please help me.
Thanks.
...
I always struggle to keep all these macros straight in my head. Is there an easy way to remember them, and which to use in a given scenario?
Specifically, does one of these allow a dialog to intercept/detect messages to child control windows? e.g Can the dialog register an interest when IDC_MY_CONTROL gets a WM_PAINT message?
...
I want to override the default behavior when text is pasted into a rich edit control. Specifically, I want to paste plain-text, not formatted rich-text. I guess that boils down to getting the data as a different clipboard format, but I don't know how to intercept the default behavior first.
For reference, I basically have:
class MyDial...
Hi,
I'm wondering if anyone has any ideas as to how I can host the Silverlight ActiveX control in an MFC application. I have been able to find information on this online, but everything that I have found is related to ATL or C# and so far I have been unable to translate any of this into my MFC application:
Silverlight Alternative Hosti...