mfc

Thread type for background drawing to a bitmap in MFC

I have a MFC document/view C++ graphics application that does all its drawing to an off screen bitmap, and then copys that to the supplied CDC pointer in the OnDraw method. Over the last couple of days I've been looking to place the drawing component in a seperate worker thread, so it doesn't stall the GUI. I seem to get a fair number ...

How to open a webcontrol's link using the default browser?

Hi All, I have a webctrl in a dialog. And whenever there's a URL input, it turns to hyperlink and becomes clickable which is fine. My problem is, let's say I have Opera as my default browser, when the link is opened, the browser it uses is IE, so it opens another window. Is there any way that the link be opened using the default browse...

Can a CRichEditCtrl know when someone sets its text?

When typing into a CRichEditCtrl, EN_CHANGE messages are generated. However MSDN says: Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. To receive EN_CHANGE notifications, specify ENM_CHANGE in the mask sent with the EM_SETEVENTMASK message. For information about the compatibility of rich edit versions with the ...

MFC multiple radio buttons groups on dialog

I have 2 groups of radio boxes on a dialog. How can I specify which button is in which group? Because right now when I select one, all the others get unselected, even the ones from the other group. ...

How to retrieve data from a ListControl(ListView)?

Hi! I have a listcontrol with three columns. I want to read what text is in the third column. I need this, because i want color this column according to that what text is in it. Can anyone tell me, how to read the data? Thanks in advance! kampi ...

MFC's CMFCRibbonGallery and CMFCToolBarImages. Anyone got them to work?

I'm trying to load prepopulate a CMFCToolBarImages instance with HBITMAPs and then pass this to a CMFCRibbonGallery but nothing shows up. I mean the gallery is on the ribbon, and it appears to be sizing itself appropriate but zero interaction or non-background coloured pixels in the central "gallery thumbnail" section. Thoughts anyone? ...

EN_PROTECTED - Whether it's received depends which dialog a control is placed in

I have this class CMyRichEditCtrl deriving from CRichEditCtrl. I have the following: void CMyRichEditCtrl::PreSubclassWindow() { CRichEditCtrl::PreSubclassWindow(); SetEventMask(GetEventMask() |ENM_CHANGE | ENM_SELCHANGE | ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_PROTECTED); CHARFORMAT format = { sizeof(CHARFORMAT) }; form...

Class names that start with C.

The MFC has all class names that start with C. For example, CFile and CGdiObject. Has anyone seen it used elsewhere? Is there an official naming convention guide from Microsoft that recommends this style? Did the idea originate with MFC or was it some other project? ...

MFC : How to capture a link click event in a web browser control?

Hi All, I have an MFC application that has a webcontrol. When clickable links are clicked, it opens using IE, not the default browser. Questions : Is there a way to force it to open using the default browser? If not, how do I capture the Link Click event so I could just manipulate the click event later? Thanks... ...

MFC button with Bitmap and text

I have a Custom CButton which loads a bitmap, using CButton::SetBitmap(bitmap); Meanwhile, I want to display a text above the bitmap, on the same button. I tried implementing OnPaint(), but it does not display the text, just the bitmap void CBitmapToggleButton::OnPaint() { CButton::OnPaint(); CPaintDC dc(this); // device cont...

How to lookup obscure windows message codes?

I'm receiving a windows message with code 1092 (0x444) and I don't know what it is. It's higher than WM_USER but I searched our code base and found no reference so I don't think it's one of ours... does Windows use custom messages above 0x400 and if so how can I look this up? ...

Catching EM_SETCHARFORMAT and modifying the CHARFORMAT data in EN_PROTECTED

I am receiving a EM_CHARFORMAT message in my message handler when SetFont() is called on my custom control. But when I change the data in the CHARFORMAT structure pointed to in the LPARAM, it isn't being used. void CMyRichEdit::OnProtected(NMHDR* pNMHDR, LRESULT* pResult) { ENPROTECTED* pEP = (ENPROTECTED*)pNMHDR; *pResult = 1; ...

What alternatives to the Windows registry exist to store software configuration settings

I have a C++ MFC app that stores all of its system wide configuration settings to the registry. Previously, we used .INI files, and changed over to using the registry some years back using SetRegistryKey("MyCompanyName"); We now get regular support calls from users having difficulty migrating from PC and Windows version to another, ...

How do I change the width of a group box in MFC programmatically?

Sorry, I'm more of a C# person but I'm having to update some legacy MFC code. I'm starting to realize why C# was a good upgrade. ...

Implementation of True Size display

I have an MFC application displaying images where I need to display the image in true-size i.e. the image should be rendered such that physical length of the object captured on the image should be same as the displayed length. For example, if I captured a object of 5 cm length the image should be displayed such that if I take a scale and...

How to convert virtual key code to character code ?

In the onkeydown() handler I am getting 219 as the keycode for '['; however, the actual character value of '[' is 91. Is there any way to map these two? ...

Not able to set read-only property in CFile in MFC?

Hello friends,,I am creating a file in which I will have some details in it...I dont any body to edit it..so I decided to keep that as read only file...I tried the following code but its popping an exception when I am setting the status...Please tel me if there are any alternative CFile test(L"C:\\Desktop\\myText.txt",CFile::modeCreate|...

C++ windows bitmap draw text

How can I draw text (with setting font and size) on image and save it as JPEG? For example CBitmap bitmap; bitmap.CreateBitmap(width, height, 1, 32, rgbData); Here I want to draw some text on bitmap: CImage image; image.Attach(bitmap); image.Save(_T("C:\\test.bmp"), Gdiplus::ImageFormatJPEG); ...

CScrollbar works on one pc but not on any others

I've written some code in c++ using a CScrollbar which scrolls a CWnd and treeview at the same time. This works perfectly find on my pc, but on other pc's in the office it has problems: it only scrolls up it allows the user to scroll when they don't need to I've tested this on Vista, XP, and Windows 7 and they all have the same resul...

Draw formatted rich text

Given a custom control CCustomWnd which has its own OnPaint method, what's the simplest way that CCustomWnd::OnPaint can render the contents of a CRichEditCtrl, with the same formatting? To clarify, elsewhere in my dialog/window is a CRichEditCtrl. I have my custom control which does a bunch of custom-drawing, including drawing the cont...