mfc

Binding a static text box to a checkbox

I need some help in MFC. The following is my problem: I have two controls a static text and a checkbox When using MFC Wizard, i place a '&' in front of one of the letters in the static text, while executing if i press Alt+, the checkbox either gets enabled or disabled. Now my problem is i am adding these controls programaticaly, and ev...

How do you handle right click on a treeview in WTL/Win32 apps?

I have a basic app written with ATL, using the wizard with VS2008. I have a treeview in the left side of the app. I see how to (painfully) add tree items. Question is how do I show a menu when the mouse is right clicked? How do I trap any click events on each item that could be selected? ...

MFC canned DllMain does not call ExitInstance for DLL_PROCESSS_DETACH?

The canned DllMain for MFC 8.0 does not seem to call ExitInstance when it gets a DLL_PROCESS_DETACH. One possible solution is to define my own DllMain, but how do I tell the linker to use mine and not MFC's? Or, is there another override which gets called on DLL_PROCESS_DETACH I'm not aware of? ...

Hyperlinks within AfxMessageBox

Hello, Is it possible to add hyperlinks to websites/email to messages that appear in windows created by AfxMessageBox? If not, what is a simple way to replace a AfxMessageBox call with one that spawns a similar-looking window with text that contain hyperlinks? Thanks. ...

How do I force my app to come to the front and take focus?

I'm working on an application that happens to be the bootstrap for an installer that I'm also working on. The application makes a few MSI calls to get information that I need for putting together the wizard that is my application's main window, which causes a progress window to open while the info is being gathered and then go away once ...

Events and messages in mfc

I am a bit confused about the difference between events and messages in mfc. Are they the same? ...

Catching when user selects an item from a CComboBox

This is as basic as it gets. I want to catch when the user selects an item from a CComboBox (actually, a subclass of CComboBox). Tried lots of combinations of OnCblSelChange, OnCommand. Guess I haven't hit the right combo yet (no pun intended). OS is Vista but I'm forcing an XP-style dialog (That shouldn't matter, should it?) I'm ab...

Clistctrl item text color

How do you change the text color of a Clistctrl item (report view)? ...

Will WPF process an App.xaml file if the hosting application isn't WPF?

First I just want to say I am new to WPF, so please excuse my ignorance... I am creating a .Net plug-in for Rhino 4.0. With the plugin I am developing a UI using WPF. The Rhino 4.0 CAD engine is an MFC/Win32 application. The plugin will execute after the application is run, and it creates the WPF Window and then "sucks" the MFC Windo...

Assertion in VS2008 but not in VS2005

Hello, After switching from VS2005 to VS2008 SP1, I found an issue that I can't explain. A program works fine under VS2005 in both release and debug mode. Under VS2008, when entering the debugger an assert is raised. If I let the program run (in debug or release mode), no assertion at all. I spent almost two days on this and I don't un...

CDC text drawing issue

I'm trying to draw text using CDC::ExtTextOut() to a device context (CDC), but I'm getting garbage outputs. The output text was drawn is weird fonts. The CDC pointer that got passed to me was originated from a unicode build ActiveX control (.ocx). The text drawing code resides in an ANSI build DLL. It seems like there're some kind of ...

click or select Clistctrl subitem (report view)

How can I determine a selected or clicked sub item of a report view Clistctrl? ...

How to underline individual items in a CListCtrl

We want some items in a CListView to appear like hypertext links. I can make everything underlined by setting the lfUnderline flag in LOGFONT, and creating a font from this, before calling SetFont - but this applies to the whole CListView. Does anyone know how to make individual items in a CListView to appear underlined? ...

Is there some sort of tool or helper to port an MFC/C++ app to OS X/Cocoa?

I have a significant codebase written in MFC and am tasked with creating a port for Mac OS X. I know that I'm going to have to roll up my sleeves at some point and do alot of grunt work to get everything working correctly, but are there any tools out there that might get me partway? ...

CDialog not Receiving Windows Messages in ActiveX Control

I have an ActiveX control in MFC that manipulates images and I am trying to add TWAIN scanning functionality to it. I need to be able to receive a Windows Message back from the TWAIN driver that tells my control when an image has been scanned, so I have created a CDialog and I pass the HWND of the Dialog to the driver. ALl the sample c...

Docking control bars/panes to CMDIFrameWndEx?

In one of our applications I've used some of the MFC classes to allow docking a sidebar window, approximately like so: CDialogBar* bar = new CDialogBar; bar->Create(this, IDD, WS_CHILD | WS_VISIBLE | CBRS_RIGHT | CBRS_TOOLTIPS, IDD)); bar->EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_RIGHT | CBRS_ALIGN_LEFT); DockControlBar(b...

How can I call a .NET form from an MFC application?

We have a several large MFC applications which presently call a COM object to bring up a complex dialog. We would like to integrate the dialog into the applications -- we do not want to continue to use a COM object. I'm investigating the possibility of building the dialog in .NET as a separate project (using Windows forms, not WPF) and...

Callback Routine Not Getting Triggered

I've created a very simple one-button MFC dialog app that attempts to utilize a callback function. The app complies and runs just fine, but the callback routine never gets triggered. What needs to be modified in order to get the callback to trigger properly? You can download the test.zip file here (the test app is in VS 2003 to ensure...

Trying to create my own Toolbar inside Mainframe class VS 6.0

I am having issues with creating my own Toolbar inside the Mainframe. I have bitmaps of buttons which I want to use for my own Toolbar but the problem is that the Toolbar displays inside the View of my SDI application. Here is a pic of the incorrectly displayed Toolbar. http://www.flickr.com/photos/14402427@N02/3409050475/ Here is the ...

port mfc pocketpc to xp embedded

Hi, I'm asked to port an existing PocketPC mfc app (lot's of forms and buttons) to XP embedded. 3 possible scenarios spring to mind: 1) I use some kind of tool or wizard and get the sources compiled for XP 2) I open a new MFC app in vis studio 2008 and form by form copy controls (gui) and code over and this way recreate the same stuff...