mfc

Can I compile legacy MFC applications with Visual Studio 2008 ?

I maintain several old MFC applications using Visual Studio 7 and I was considering upgrading to Visual Studio 2008. After reading this question, I realise that the Express edition will not be able to do this. Does anyone know if I will be able to compile old MFC apps with VS2008 Standard edition or will I need to get the more expensive...

Setting Background Color CMDIFrameWnd

Is there a way to change the color of the background for a MDIParent windows in MFC (2005)? I have tried intercepting ON_WM_CTLCOLOR AND ON_WM_ERASEBKGND but neither work. OnEraseBkgnd does work, but then it gets overwritten by the standard WM_CTL color. Cheers ...

Trapping messages in MFC - Whats the difference?

Hi all, I was just wondering what (if any) the difference was between the following two message traps in MFC for the function, OnSize(..). 1 - Via Message map: BEGIN_MESSAGE_MAP(CClassWnd, CBaseClassWnd) ... ON_WM_SIZE() .. END_MESSAGE_MAP() 2 - Via afx_message: afx_msg type OnSize(...); They seem to be used interchangeably, ...

Guide to New Vista Features

I'm an MFC programmer. I just had my first taste of Vista (on a VPC... Yup, I'm late). I should be evaluating things in depth in the coming days. On taking a casual look, I noticed two major changes: The shell is new User Access Control Event Viewer has changed (would like more info on this) What other new features should I look out ...

Creating Docking Panes in CView instead of CMainFrame

When creating an MDI Application with "Visual Studio" style using the AppWizard of VS2008 (plus Feature Pack), the CMainFrame class gets a method CreateDockingWindows(). Since I don't want all panes to be always visible but display them depending on the type of the active document, I made those windows to members of my views and also mo...

Parsing iCal/vCal/Google calendar files in C++

Hello all, Can anyone recommend a ready-to-use class/library compatible with C/C++/MFC/ATL that would parse iCal/vCal/Google calendar files (with recurrences)? It can be free or commercial. Thanks in advance! ...

Fast library to replace CDC vector graphics

I have a mature MFC C++ application that displays on screen and prints using CDC wrappings on the Win32 GDI. While it has been optimized over the years, I would like to replace it with something a bit faster. The graphics included rendered triangular surface models, complex polylines and polygons, and lots of text. It needs to meet th...

How to manipulate DLGTEMPLATE programmatically?

What? I have a DLGTEMPLATE loaded from a resource DLL, how can I change the strings assigned to the controls at runtime programmatically? I want to be able to do this before the dialog is created, such that I can tell that the strings on display came from the resource DLL, and not from calls to SetWindowText when the dialog is initiali...

Splitting a already split pane (MFC)

In my MFC program I am using a splitter to create two panes. I now want to split one of these panes in half again and put in another view, can someone talk me through how to do it or point me in the direction of some code? I would prefer to code it myself so I am not interested in custom derived classes unless they are extremely basic. ...

CMapStringToOb::Lookup problem in Japanese

Does anyone know why CMapStringToOb::Lookup doesn't work in Japanese? The code loads a string from the string table, and puts it into a CMapStringToOb object. Later it loads the same string from the string table (so it is guaranteed to be exactly the same) and calls CMapStringToOb::Lookup to find it. It works in all languages that we'v...

SetLimitText() in a CEdit in Vista does not work

This is happening on Vista. I created a new dialog based MFC project to test this. I added a CEdit control to my dialog. I called SetLimitText to let my CEdit receive 100000 characters. I tried both: this->m_cedit1.SetLimitText(100000); UpdateData(FALSE); and static_cast<CEdit*>(GetDlgItem(IDC_EDIT1))->LimitText(100000); I placed ...

OnKillFocus() override in MFC triggering at odd times.

I need to know when my Window goes out of input focus, so I overloaded the OnKillFocus() method of the CWnd. However it doesn't invoke this method when I focus another application (alt+tab), or even minimize the window. But it DOES invoke the method when I restore it from being minimized. Are these the intended times for it to trigger ...

Enumerating network shared directories in C++ / MFC

I need to get a list of directories shared by the current computer, and their shared names. How do I do this in C++ / MFC? ...

MFC: Showing / Hiding Splitter Panes

In my application I have a number of panes from m_wndspliter classes. What I want to do is at run time show and hide one of these panes. Whilst with the following code I can show and hide the view associated with the pane, I can't temporarily remove the pane itself. CWnd * pCurView = m_wndSplitter2.GetPane(2, 0); if( !pCurView == NULL ...

MFC: What on earth is a CSplitterWnd Caret?

What on earth is a caret in the context of a CSplitterWnd class? I can't find any documentation relating explicitly to CSplitterWnds... EDIT: Specifically, what do these functions actually do: CWnd * pCurView = m_wndSplitter2.GetPane(2, 0); pCurView->ShowCaret() pCurView->HideCaret() EDIT2: Please note, I know what a caret is, I am s...

How do I drag and drop something into a Static control?

How would I drag and drop something into a static control? It looks like I need to create a sub class of COleDropTarget and include that as a member variable in a custom CStatic. That doesn't appear to be working though. When I try and drag something onto the Static control I get the drop denied cursor. ...

Can't detect when Windows Font Size has changed C++ MFC

Hi, I'm trying to determine how I can detect when the user changes the Windows Font Size from Normal to Extra Large Fonts, the font size is selected by executing the following steps on a Windows XP machine: Right-click on the desktop and select Properties. Click on the Appearance Tab. Select the Font Size: Normal/Large Fonts/Extra Larg...

Impersonation MFC C++

Hi, I want to impersonate other user in windows, for example: I create a directory with permission only for user A and for the administrators, when logon with user B and run .exe I want to impersonate user A to have permission to edit/remove/insert in that specific directory. How can I do it? I found this: http://msdn.microsoft.com/en...

How to receive timer events in CWinApp with MFC?

In MFC I'm trying to set a null handler timer (ie. no windows). But I'm unable to process the WM_TIMER event in the CWinApp MESSAGE_MAP. Is this possible? If so, how? ...

Do c++ static libraries without mfc that are linked to an MFC project throw bad_alloc or CMemoryException*?

I'm working on a large, aging code base for an MFC app. The code has been worked on by many developers over time, and as a result, we have three different ways throughout the code of dealing with the possibility of an allocation failure with new. The first way is to test for NULL on the result of new. We don't use nothrownew.obj so th...