mfc

2008 MFC and threads?

I was reading this thread/post: http://stackoverflow.com/questions/262298/windows-c-ui-technology and am also wondering about a non .NET UI framework. Specifically - prior to .NET having support for serial ports (I can't believe they left that out of the first release of .NET) I was forced to use MFC for an application. I had not been...

How to write code just for debug mode in MFC vs2005

I want to define some member variable and some code just in Debug Mode, When change to Release mode, they will not appear. I know I can use #ifdef xxx to do this task. My question is : is there any handy macro provided by MFC to do this. ...

Drawing icons instead of bitmaps in a MFC CMenu?

I can use an bitmap in a menu CMenu men; CBitmap b; b.LoadBitmap(IDB_0); men.AppendMenu( MF_ENABLED,1,&b); I can draw an icon into a DC CImageList IL; IL.Create(70, 14, ILC_COLOR16 | ILC_MASK, 1, 0); IL.Add(AfxGetApp()->LoadIcon(IDI_0)); IL.Draw ( pDC, 0, rcIcon.TopLeft(), ILD_BLEND50 ); But I cannot find a simple way t...

How To Set Errorlevel On Exit of MFC App

I have an MFC legacy app that I help to maintain. I'm not quite sure how to identify the version of MFC and I don't think it would make a difference anyway. The app can take some parameters on the command line; I would like to be able to set an errorlevel on exiting the app to allow a bat/cmd file to check for failure and respond app...

MFC - execute code right after dialog is shown (.NET equivalent of Form.Shown)

I'm doing some small changes to C++ MFC project. I'm .NET developer so Windows programming is new to me. I need to launch some method right after CDialog is completely shown (painted) for the first time, but only once. How can I do this? In .NET I would handle Form.Shown event. Do I need to handle some message? Which? Do I need to ove...

MFC: Accessing Views from Mainframe

I am trying to access a view inside a splitter from my mainframe. At the moment I have this: CWnd* pView = m_wndSplitter.GetPane( 0, 0 ); However this gets me a pointer to the CWnd not the CMyViewClass object. Can anyone explain to me what I need to do in order to access the view object itself so I can access member functions in the f...

Can't initialize an object in a member initialization list

I have this code: CCalcArchive::CCalcArchive() : m_calcMap() { } m_calcMap is defined as this: typedef CTypedPtrMap<CMapStringToPtr, CString, CCalculation*> CCalcMap; CCalcMap& m_calcMap; When I compile in Visual Studio 2008, I get this error: error C2440: 'initializing' : cannot convert from 'int' to 'CCalcArchive::CCalcMap &' ...

How do I display custom tooltips in a CTreeCtrl?

I have a class derived from CTreeCtrl. In OnCreate() I replace the default CToolTipCtrl object with a custom one: int CMyTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CTreeCtrl::OnCreate(lpCreateStruct) == -1) return -1; // Replace tool tip with our own which will // ask us for the text to display with a T...

ASSERT vs. ATLASSERT vs. assert

I am refactoring some MFC code that is littered with ASSERT statements, and in preparation for a future Linux port I want to replace them with the standard assert. Are there any significant differences between the two implementations that people know of that could bite me on the backside? Similarly, I have also come across some code th...

MFC: Changing font of a List control

Hi guys, I need to at run time change the font of a List Control so as to used a fixed width font. I have seen some examples which suggest I should trap the NM_CUSTOMDRAW message, but I was wondering if there was a better way of doing it. Thanks. ...

CMFCToolTipCtrl or CTooltipManager examples?

Has anyone tried using these new VS2008 MFC classes yet? I can't seem to find any examples anywhere. Even the VS2008 samples(1) don't mention these classes. (They use CToolTip.) (1) Update: My mistake. I had downloaded the non-SP1 samples. I see that the SP1 samples have samples specifically for the 2008 Feature Pack, including the DlgT...

Mixing MFC and WPF: Modal Dialogs

I'm adding C# WPF dialogs to an existing C++ MFC app, using a C++/CLI interface layer. I've got things working, except I'm having a problem with modality. For example: MFC app shows a WPF dialog using ShowDialog. Works as expected. That WPF dialog shows a MFC dialog using DoModal. The WPF dialog is hidden behind the base C++ app, and i...

Which platform should I use : native C++ or C# ?

I want to develop a windows application. If I use native C++ and MFC for user interface then the application will be very fast and tiny. But using MFC is very complicated. Also If I use C# then the application will be slower than the native code and It reqiures .NET framework to run. But developing GUI is very easy by using WinForm. Whic...

VS2005 Resource Editor Keeps Eating my #ifdef's

The resource editor keeps wiping out code of this form in my .rc: #ifndef V2 IDB_SPLASHSCREEN BITMAP "res\\xyz v1.bmp" #else IDB_SPLASHSCREEN BITMAP "res\\xyz v2.bmp" #endif Anyone know of a workaround? Better way to accomplish the same? ...

What are the most active community resources for MFC development?

I am wondering what are the best community resources for MFC development- such as forums, IRC channels, etc. Currently the only resource I have for finding answered questions on MFC is using google which comes up with Codeproject results or the occasional result on MSDN or some other web page. Now that there is stackoverflow I am sure ...

How can I place a MFC CFormView inside a CDockablePane?

Hello all, How can I place a MFC CFormView inside a CDockablePane which was introduced in the VS 2008 MFC Feature Pack? Thanks. ...

Easiest way to convert CArchive to use SQL database for serialization?

I have an existing application that uses CArchive to serialize a object structure to a file. I am wondering if can replace the usage of CArchive with some custom class to write to a database the same way that things are serialized. Before I go about figuring if this is doable I was wondering if other people have done the same- what is ...

Slow performance of AddString in MFC

I've got a dialog with several largeish combo boxes in it (maybe several hundred items apiece). There's a noticeable delay at construction while these are populated (confirmed that it's them by profiling). My initial thought was that sorting was killing it's performance, but disabling sort and using InsertString instead doesn't seem to ...

How to implement CEditListCtrl

How to implement CEditListCtrl?. List control with edit capabality (Report/Grid view). I have a list view in Report View. It has some values. I need to extend this to edit the values present in the list view. I declared a class which inherits from CListCtrl. And I have handled the two Window messages to start and end the edit. Upon getti...

Using Chromium as a MFC CWnd

Hey all. I am looking to using Google Chromium for my MFC app as an HTML renderer. I found this test bed application and I am wondering if anyone knows how or of a resource that I can make sense of it so that I could extract the Webkit/Webview stuff into my application. Thanks. ~/webkit/tools/test_shell ~/webkit/tools/test/reference...