mfc

Dynamically creating controls in MFC (Collection question)

Hello all, I have some custom control inside of which i should create radiobuttons or checkboxes. The count of child controls is available only at runtime (it loads some file from which it gets this count). So i need to create variable number of controls. Which collection i should use for this purpose? Solution 1: simply use std::vec...

UpdateAllViews() from within a worker thread?

I have a worker thread in a class that is owned by a ChildView. (I intend to move this to the Doc eventually.) When the worker thread completes a task I want all the views to be updated. How can I make a call to tell the Doc to issue an UpdateAllViews()? Or is there a better approach? Thank you. Added by OP: I am looking for a simple...

MFC resource.h command/message IDs

Hi I'm working on an MFC application, that got pretty messy over years and over different teams of developers. The resource.h file, which contains all command/message mappings grew pretty big over time, and has lots of problems (like duplicate IDs). I am not proficient with MFC, so the question might sound pretty stupid... MSDN docs me...

[MFC] Combining 2 memory DCs ?

I'm writing a control where there's a lot of custom drawing going through. Because of this I need to trim down the amount of "screen writes" that go about. Currently there is only one memory DC that is used to write to screen so as to avoid flicker when the control is redrawn. I want to know if it is a possiblity to use 2 or more memory ...

Hiding the Command Console from a MFC dialog application

Hi, I have a MFC dialog based application in which I use ::system() function to physically open a text file. When I do it the command console also opens. How can I hide the command console so that it doesn't pop up when I'm opening the text file? Thank You!!! ...

how to share the paint application to others in visualC++

Hi, Recently i designed an MFC paint application so can anyone provide me idea to how to share this application to others so that when i draw on this application others also can watch what i am drawing. ...

OnCtrlColor Not Working?

Hi, I used the following overloaded method to change the text color to red in a listbox, in a Visual C++ MFC dialog based application. When I build the program in DEBUG mode, it works perfectly. But when I use the RELEASE mode the text color doesn't change. Why is this and how can I overcome this problem?? Thanks!! HBRUSH MyDlg::OnCtl...

Key strokes in wpf window hosted in MFC ActiveX running in Internet Explorer

We have an MFC ActiveX control created in Visual Studio 2008 with CLR support which creates a WPF grid and shows a WPF window within that grid. This ActiveX is hosted within Internet Explorer and it shows up and works nicely except that the tab key, backspace, function keys etc. does not work since they are handeled by IE instead of th...

Why some MFC classes are not derived from CObject?

Hi All, Normally most of the MFC (window based classes) are derived from CObject. What does CObject do? Why some MFC classes are not required to be derived from CObject? ...

What restrictions exist choosing a MFC version to use with Visual C++?

Each version of Visual Studio comes with a specific version of the MFC framework, but I believe MFC SDK can be downloaded separately. Since MFC is just C++, is there any reason you couldn't use the latest version with an older version of VC++... I don't mean trying to get the ribbon working in MSVC++ 6, But we're on VS2005 and some of th...

MFC/CCriticalSection: Simple lock situation hangs

I have to program a simple threaded program with MFC/C++ for a uni assignment. I have a simple scenario in wich i have a worker thread which executes a function along the lines of : UINT createSchedules(LPVOID param) { genProgThreadVal* v = (genProgThreadVal*) param; // v->searcherLock is of type CcriticalSection* while(1) { ...

Will VC++ MFC become obsolete in near future?

Normally people say MFC is little clumsy. It makes UI development slightly difficult to maintain since it has lot of auto generated code. It has good architecture (doc/view) but is not transparent like Win32 programming to understand how window program works in the background. So with this situation, is it good to extend the exposure on ...

Parsing CArchive (MFC classes) files in Ruby

I have a legacy app that seems to be exporting/saving files with CArchive (legacy MFC application). We're currently refactoring the tool for the web. Is there a library I can look at in Ruby for parsing and loading these legacy files? What possible libraries could I look into? Problems with the file format according to XML serializati...

Can't add message handlers for my MFC dialog

I have two dialogs in my application. (i'm working in Visual C++ 2008) For one of them I've added various message handlers. However, for the other dialog I can't add any handlers. If I click the "Messages" button in the Properties window, it only shows a blank page instead of the usual messages list. What could be the problem? Thanks f...

C++/MFC: Handling multiple CListCtrl's headers HDN_ITEMCLICK events

I'm coding an MFC application in which i have a dialog box with multiple CListCtrls in report view. I want one of them to be sortable. So i handled the HDM_ITEMCLICK event, and everything works just fine .. Except that if i click on the headers of another CListCtrl, it does sort the OTHER CListCtrl, which does look kind of dumb. This i...

[VC++]How can I run my program on another PC ?

I have an MFC application that runs on my computer, but when I try to run it on another PC I receive an error message that the application failed to initialize and I should re-install it. What should I do? ...

Problem with OnMeasureItem()

Hi, I used OnMeasureItem() in my MFC ListControl to increase the height of the rows, and added WM_ON_MEASUREITEM() message in the Map. THe code I used is as follows: void CListCtrlTestDlg::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) { if( nIDCtl == IDC_LIST1 )//IDC_LIST1 is my ListControl ID { lpMeasu...

Auto Resizing in a ClistCtrl

Hi, Is there a way to resize the listcontrol automatically? Usually when the item gets too long the back end disappears from view and the user manually has to resize the width of the column. Is there anyway to do this by the code? Thank You!! ...

Any way to make dialogs appear/disappear with a transition in MFC?

For instance I have a main dialog, when I click a button a smaller dialog appears next to it. But it would be neat if the small one could somehow transition in, rather than simply appear. For instance using transparency, or zooming in, or sliding in from width=0 -> full-width. Making an actual dialog do such things isn't too hard, but w...

What is the best way to make a schedule in MFC

I have a list of items that are each associated with a start and end time and date. What I want to do is, given a time and date range, display only the items that fall within that window, even partially. What I'm doing is creating a CListCtrl with all the items in it and the CListCtrl is sorted by start time by default. But given a ti...