Posts tagged ‘mfc’

34 posts; newest first

Handling LVN_GETDISPINFO

mfc

If you specify LPSTR_TEXTCALLBACK when inserting an item into a ListView control, it no longer supports sorting; you can’t click on the column heading to sort the list control.

» read more

Displaying Progress in a Wizard

mfc

I’m adding a wizard to the program that I’m currently working on. The wizard walks the user through importing some information from a file. I’d like to be able to display the import progress as a seamless part of the wizard.

» read more

Using FindWindow in an MFC application

mfc

There are at least two reasons for using FindWindow.

  • To activate the previous instance of your application.
  • To close your application while the installer is upgrading it.

Changing window class names in MFC

Unfortunately, FindWindow is only really guaranteed to return your application’s main window if you use a unique class name. If you’re using MFC, you’ll find this a little difficult: MFC automatically generates class names of the form “Afx:400000:8:10011:0:7e0c0b”.

» read more

Using ON_COMMAND_RANGE and ON_UPDATE_COMMAND_UI_RANGE

mfc

The ON_COMMAND_RANGE and ON_UPDATE_COMMAND_UI_RANGE macros are useful when you want to treat a group of commands similarly. In this case, it’s the commands for changing list view style. The command IDs must be contiguous, and you must specify the lower one first.

» read more

Many to One Dependencies

mfc

Using a modal dialog as a main window

If you ask the MFC AppWizard to generate a dialog-based application, it generates code that looks like this:

» read more

Including resources in Static Library projects

mfc

Introduction

Consider the following situation:

You’ve got an MFC application, which uses a lot of static libraries to do a lot of the work. These libraries need to interact with the user (perhaps they’ve got dialog boxes in them). Unfortunately, Visual C++ and MFC effectively force you to store all of your resources in the main application .rc file. This makes it difficult to use the static library (with the same resources) in multiple projects. Moreover, it makes the library dependent on the main application, for the resource IDs.

» read more