mfc

Qt versus WPF/.NET

My company is trying to make the decision between using Qt/C++ for our GUI framework or migrating to .NET and using WPF. We have up to this point been using MFC. It seems that .NET/WPF is technically the most advanced and feature-rich platform. I do, however, have several concerns. These include: Platform support Framework longevit...

What's behind the CAsyncSocket assertion problems and "improper argument" errors in my MFC sockets code?

I was asked to look at some code for a friend. (I rightly hesitated due to the MFC and lots of bad code, but he won...) This is a dialog box based application that uses a CAsyncSocket. The problem manifests in some nonstop debugbreaks and other similar things - there are also problem with an MFC ENSURE() macro - checking the socket ...

Unlocking the critical section in case of non-C++ exceptions

I have a object of CCriticalSection in my class to synchronize the exceptions to a method. I use it with CSingleLock object like this: void f() { try { CSingleLock lock(&m_synchronizer, TRUE); ..... ..... } catch(SomeException ) { } catch(...) { } } The critical section object is properly unlock...

How to enable an AfxMessageBox Yes/No (MB_YESNO) "close" button? (upper right corner "X")

When calling: AfxMessageBox(strMsg, MB_YESNO); A messagebox with the buttons "Yes" and "No" is displayed. But the "X" (close button) in the upper right corner is disabled, and pressing ESC has no effect. This is because the only valid results would be IDYES and IDNO, and not IDCANCEL. Is there a quick way of getting this behavior en...

Using Microsoft Access in my application

I am writing a C++/MFC application that will use Microsoft Access to store data. I hope using it will suit my purpose : small, lightweight way to keep application's data. the question i'm asking myself is : if I use Access as DB, will the client's machine be required to install Microsoft Access to use my software ? thanks. ...

Paging ListView Control

Anyone knows a good Paging ListView for MFC app ? or how to do it ? but a completely developed one would be better. ...

creating a Paging List View in MFC

How can I create a List View (or List Ctrl) with paging ? that means that whenever there are too many items in the List Ctrl, those items are organised in different pages. hope u get wht i mean. It would be better if there is already such control built (for example in Codeproject). thanks. ...

skinning MFC applications

Hi All, I have seen some cool applications with great looking skins. I'm new to MFC and I want to create an application with the capability of changing skins. How is it done in MFC? I've checked some tutorials but are a bit outdated. Thanks... ...

Open Source MFC Addins

Does anyone know of any websites that feature open source MFC addins for things around UI? ...

MFC Library - adding elements to a fixed-size CList

I'm using fixed-size CList and I was wondering what the implementation does when the list is full and I make a call to add another element. Does it fail to add? Does it replace the oldest element? ...

How do I decide whether to use ATL, MFC, Win32 or CLR for a new C++ project?

I'm just starting my first C++ project. I'm using Visual Studio 2008. It's a single-form Windows application that accesses a couple of databases and initiates a WebSphere MQ transaction. I basically understand the differences among ATL, MFC, Win32 (I'm a little hazy on that one actually) and CLR, but I'm at a loss as to how I should choo...

MFC: Why does my spin control work backwards

Using MS Visual Studio, I have attached a spin control to an edit control using the "auto buddy" property. The spin control alters the edit box, but the up button decrements the value and the down button increments the value. How do you fix this? ...

CInternetSession::OpenURL on Windows Mobile causes error 12029 (cannot connect)

I'm trying to access data using HTTP by calling CInternetSession::OpenUrl on Windows Mobile 5 (coding in C++ with MFC). I always get an exception with error code 12029 (cannot connect). I suspect that I need to use the Connection Manager API to create a connection first. Can someone confirm that? I am going to try coding it up, based o...

Using SubclassDlgItem to change control types

I have a C++ MFC app with a dialog where I want to change the type of the control dynamically based on the selection in a combo box. The dialog resource starts off with a plain old edit control which I then call SubclassDlgItem on to change to a custom control type. So far so good. Now, when the user changes the selection in a differe...

fatal error LNK1104 cannot open file C:\users\user\documents\visual.obj

Hello All, I get a "fatal error LNK1104 cannot open file C:\users\user\documents\visual.obj" whenever I want to compile my project on Visual Studio 2008. my project uses a .lib file that I created. can anyone help me out ? ...

Who is responsible for clearing up memory from image lists?

If I have a CImageList object (a simple wrapper around a HIMAGELIST), and I call: m_pImageList->Replace(...); http://msdn.microsoft.com/en-us/library/k10cwcdb.aspx Who is responsible for clearing up the memory? Does the image list create a copy of any bitmap I pass in (i.e. can I create a CBitmap object on the stack then pass the a...

How do I host WPF content in MFC Applications?

I'm going to answer my own question here because I spent a few hours piecing this together and wanted to share what I found in the hope that I will save someone else the digging. There is an MSDN Walkthrough that gets you most of the way there, but there are a couple of key pieces that I found elsewhere. For example, the walkthrough te...

I need a message pump that doesn't mess up my open window

My application (the bootstrap application for an installer that I'm working on needs to launch some other applications (my installer and third party installers for my installer's prerequisites) and wait for them to complete. In order to allow the GUI to do screen updates while waiting for an app to complete, I put a message pump in the w...

How to convert an ActiveX (webbrower hosted) project into static library project?

I have an ActiveX component which contains a control (webbrowser control embedded in composite control dialog pane) for accessing certain URL. The ActiveX component accessing URL can be used in other MFC or VB projects. The usage is to register the ActiveX component (use regsvr32 cmd) and then insert the control in a dialog window by usi...

How do I make a button caption bold in MFC?

I have a button on an MFC dialog. How can I make the text bold? ...