mfc

Creating a UAC like environment

I want to create an environment like UAC. i.e. my dialog should appear to the user and unless he responds to it, i want to disable the background. User should not be able to carry out any activity. For this purpose I created a new desktop and display my dialog on the new desktop. But i want something like UAC where the background seems...

Determine an included header files contribution to total file size

Hello, I am interested in reducing the file size of my application. It is a MFC/C++ application built with MVC++ in Visual Studio 2008. UPX does a good job of reducing the final exe to about 40% of its original size but I would like to reduce it more. MFC must be statically linked in this project. I have tried some methods outlined in ...

Stopping an MFC thread

I understand the problem with just killing the thread directly (via AfxEndThread or other means), and I've seen the examples using CEvent objects to signal the thread and then having the thread clean itself up. The problem I have is that using CEvent to signal the thread seems to require a loop where you check to see if the thread is sig...

Call unmanaged C++ VS 6.0 MFC dll from C#

Hello, I have an unmanaged C++ MFC dll that was developed in VS 6.0. I would like to use it in my C# app. I'm trying to use PInvoke. Here is the C++ code: // testDll.cpp : Defines the entry point for the DLL application. // #include "stdafx.h" extern "C" { BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_rea...

Are there any Regression Tests coded in C/C++ to test all the functionality of CString (ATL/MFC)?

I am trying to do a comparison of CString from ATL/MFC to a custom CString implementation and I want to make sure that all the functionality in the custom implementation matches that of the ATL/MFC implementation. The reason we have a custom CString implementation is so that we can use it on *nix and Windows platforms. The interface is ...

Filling a Partially Rounded Rectangle with GDI

I have a rounded rectangle that I make like so dc.RoundRect(textBorder, CPoint(20, 20)); Later on I draw a line through it about 1/3 of the way down. dc.LineTo(textBorder.right, textBorder.top + 15); Now I would like to fill just the part above the line with a solid color. In other words I need to fill a partially rounded rectan...

Very weird errors when linking (LNK1000)?

Error 1 fatal error LNK1000: Internal error during IncrBuildImage MFC_Test MFC_Test Why do I get this weird error every 2nd time I compile? ...

Maintaining a recent files list

I would like to maintain a simple recent files list on my MFC application that shows the 4 most recently used file names. I have been playing with an example from Eugene Kain's "The MFC Answer Book" that can programmatically add strings to the Recent Files list for an application based on the standard Document/View architecture: (see "M...

setting an HBITMAP object as desktop wallpaper

How do you set an HBITMAP object as the wallpaper? I am taking the screenshot of the desktop using BitBlt, so i have the screenshot as a HBITMAP object. Now i can save the object to a bmp file and the set it as wallpaper using SystemParametersInfo, SPI_SETDESKWALLPAPER. But i am checking if there is a direct way to set the bitmap object...

CString join method?

I need to concatenate a list of MFC CString objects into a single CSV string. .NET has String.Join for this task. Is there an established way to do this in MFC/C++? ...

What can cause an abnormal program termination?

MFC application (uses SQLite3.dll for DB access, along with other DLLs for accessing hardware) terminates abnormally. There is no particular sequence of termination :( My application is a Single threaded Application Uses exception handling Uses more than 6 DLLs to access different hardwares Runs on WinXP SP2 Initially i thought it m...

Spell checking in MFC

I was looking for a multi-language (specifically English & Swedish) supporting spell-check solution that can plug into a commercial MFC/C++ application. Top of my Google search was Wintertree, which appears to meet all criteria but is hardly cheap at $3500 for a site license. Now I know that using some open-source option could take seve...

How to update MFC source code?

After several Visual Studio patches and a service pack or two, my MFC source code no longer matches my MFC binaries. When I trace into MFC, I either see assembly or old source code. How do I get my MFC sources to match my binaries again? ...

How do i get visual studio 2008 to create a class for my MFC dialog resource?

I used to use VC 6 a while back and there was a simple to use "wizard" that would create a class out of a dialog created in the GUI editor. I am using 2008 professional and there seems to be no way to generate this. I can try to make it based on a template of previous projects, but it seems to me that is missing. Where did they bury...

MVC model in MFC

how are the classses in MFC match the model-view-control pattern ? the model is suppose to handle the Business Logic , the control suppose to be some kind of mediator and the view suppose to be the gui ? what class in MFC represent each one ? cause it seems pretty different to me as i read more about mfc. (seems like CView represent th...

What is a good way to add MFC gui to a Win32 C++ command line application?

We have a command line application that could benefit from a GUI. We want to add some plotting functionality and have identified a plotting library that uses MFC. Initially we developed a separate app, but we'd rather have the GUI in the same process space. I was thinking of possibly a GUI in an MFC DLL that could be hosted in the p...

SEHException thrown in a non-.NET application

I am writing an MFC application that doesn't use .NET (CLR support is set to No Common Language Runtime support in the project settings). However, I get an SEHException thrown when I quit the application in Release build. Debug build gives me an assertion error, but the error window disappears in about half a second after it pops up (so...

Why Doesn't my Application Display Unicode?

I have created an MFC application from scratch being careful from the start to use Unicode aware structures such as CStringW, LPCWSTR Etc. to store and process data. Unicode is also defined in the project. Since I only one speak one language I tried the following test to ensure that a Unicode string was processed and stored correctly...

how to add message map to dynamic menu item in MFC

Hi, I writing a MFC which has a listview control. When the user right clicks any item , I am generating a dynamic menu item with that text that is selected in listview. Everything is displaying properly, but I do not know how to add a message map to that dynamic menu item. Any help? void CMyListDlg::OnRclickList(NMHDR* pNMHDR, LRESUL...

How can I obtain the Line Height of a GDI HFONT?

I'm adding SVG export support to an old application built with MFC and using plain old GDI. As SVG 1.1 doesn't support text wrapping, I am forced to do this manually. The application provides me with a CFont instance (which contains an HFONT). I can calculate the width of a piece of text using CFont::GetTextExtentPoint(), but I haven't ...