mfc

Strange MFC / VC++ Linker Error (std::list<CRect> already defined)

I've got a really odd error message that only occurs when I add the following line to my project: std::list<CRect> myVar; It's worth noting that it doesn't have to be a std::list, it can be std::vector or any other STL container I assume. Here is the error message: Error 1 error LNK2005: "public: __thiscall std::list ...

What is a good MFC starting book?

Hey all. Any one have any recommendations for a great MFC book that I can learn? I have background in .NET and C++. Thanks! ...

Programs don't work on Vista and Server 2008

Many, if not all, of my old VC++ 6.0 MFC apps don't work in Vista and Server 2008. I had that migration was a problem, but now it's my problem :( How do I go about making these things work? Is that possible? I've searched, but is there some repository of knowledge on this subject? edit: Compatibility mode seems to work. ...

How to measure performance in a C++ (MFC) application?

What good profilers do you know? What is a good way to measure and tweak the performance of a C++ MFC application? Is Analysis of algorithms really neccesary? http://en.wikipedia.org/wiki/Algorithm_analysis ...

How do I get a mutli line tooltip in MFC

Right now, I have a tool tip that pops up when I hover over an edit box. The problem is that this tool tip contains multiple error messages and they are all in one long line. I need to have each error message be on its own line. The error messages are contained in a CString with a new line seperating them. My existing code is below. ...

Saving MFC Model as SQLite database

I am playing with a CAD application using MFC. I was thinking it would be nice to save the document (model) as an SQLite database. Advantages: I avoid file format changes (SQLite takes care of that) Free query engine Undo stack is simplified (table name, column name, new value and so on...) Opinions? ...

Control for getting hotkeys like tab and space

I have a dialog box that allows users to set hotkeys for use in a 3d program on windows. I'm using CHotKeyCtrl, which is pretty good, but doesn't handle some keys that the users would like to use - specifically, tab and space. The hotkey handling is smart enough to be able to fire on those keys, I just need a UI to let them be set. A...

Open multiple documents from a single file

How would I go about creating multiple documents when a single file is opening in a MFC application? We have an aggregate file format which can contain information for multiple documents. When this file is opened, I would like multiple CDocuments created for each record in the file. We already have a extended CDocManager, so I'm guess...

Best UI development framework on windows?

I have been developing UI in Win32/MFC, but developing cool UI in Win32/MFC is very difficult and time consuming. Please note, I always want my code to be platform independent, So I prefer programming back-end (Business logic) in C++. Which is the best framework for developing cool UI on windows platform? I heard of quite a few, like Q...

MFC File upload

How would I upload a file to a webserver using c++ and MFC. We are not using .Net. Would I need to open a socket and do everything myself? If so, where is a good reference to follow? ...

How can you bring a control to front in mfc

How do you change controls' Z-order in MFC at design time - i.e. I can't use SetWindowPos or do this at runtime - I want to see the changed z-order in the designer (even if I have to resort to direct-editing the .rc code). I have an MFC dialog to which I am adding controls. If there is overlap between the edges of the controls, I want ...

Referenced structure not 'sticking'

I am currently porting a lot of code from an MFC-based application to a DLL for client branding purposes. I've come across an unusual problem. This bit of code is the same in both systems: // ... CCommsProperties props; pController->GetProperties( props ); if (props.handshake != HANDSHAKE_RTS_CTS) { props.handsha...

Using PostMessage in Windows Mobile to simulate a menu pick

I'm writing a routine to provide user definable keyboard short-cuts for any menu item in my Windows Mobile 5 application, which is in C++/MFC. To do this I am getting all of the available menu command IDs, and using the CWnd::PostMessage(WM_COMMAND,MyMenuID) to post it to the application. I use this technique to good effect elsewhere f...

Docking a CControlBar derived window

How can I dock a CControlBar derived window to the middle of a splitter window (CSplitterWnd)? I would like the bar to be repositioned whenever the splitter is moved. To make it a little clearer as to what I'm after, imagine the vertical ruler in the Dialog Editor in Visual Studio (MFC only). It gets repositioned whenever the tree vie...

Moving between dialog controls in Windows Mobile without the tab key

I have a windows mobile 5.0 app, written in C++ MFC, with lots of dialogs. One of the devices I'm currently targetting does not have a tab key, so I would like to use another key to move between controls. This is fine for buttons but not edit controls or combo boxes. I have looked at a similar question but the answer does not really s...

Reuse Edit Control as Command Window

This is a GUI application (actually MFC). I need a command window with the ability to display a prompt like such: Name of favorite porn star: The user should be able to enter text after the prompt like such: Name of favorite porn star: Raven Riley But I need to prevent the user from moving the cursor into the prompt area. Use...

Creating a ruler bar in MFC

What's the best way to go about creating a vertical and horizontal ruler bars in an SDI app? Would you make it part of the frame or the view? Derive it from CControlBar, or is there a better method? The vertical ruler must also be docked to a pane and not the frame. To make it a little clearer as to what I'm after, imagine the vertic...

Why do thread functions need to be declared as '__cdecl'?

Sample code that shows how to create threads using MFC declares the thread function as both static and __cdecl. Why is the latter required? Boost threads don't bother with this convention, so is it just an anachronism? For example (MFC): static __cdecl UINT MyFunc(LPVOID pParam) { ... } CWinThread* pThread = AfxBeginThread(MyFunc, ....

Change min/max/close buttons theme

Hi, im currently overiding the WM_NCPAINT, WM_NCCALCSIZE and WM_NCACTIVATE to paint my own color/themed title bar for an application im working on. Now this is working great however the min, max and close buttons still are xp default theme. I looked into what controls them and the mouse messages do. However they also contol resizing and...

How to use CMFCListCtrl with CListView?

I'd like to use the new CMFCListCtrl features with my CListView class (and, of course, the new CMFCHeaderCtrl inside it). Unfortunately, you can't use Attach() or SubclassWindow() because the SysListView32 window is already associated with a CListView object. Do I have to override CListView's OnCmdMsg() and route all messages to my own ...