mfc

Resources in a static lib file - MFC

MFC is failing to launch my dialog boxes, it seems, because it can't find the resource identifiers. The dialog boxes are in a separate .lib file (so it has a separate .rc file, which, I'm assuming, somehow conflicts with the one in my .exe file). How should I be handling this situation? ...

Destruction of singleton in DLL

I’m trying to create a simple Win32 DLL. As interface between DLL and EXE I use C functions, but inside of DLL i use C++ singleton object. Following is an example of my DLL implementation: // MyDLLInterface.cpp file -------------------- #include "stdafx.h" #include <memory> #include "MyDLLInterface.h" class MySingleton { friend ...

Will the Scenic Ribbon ever be supported by the MFC Feature Pack?

My team has spent a long time developing a nice UI using the ribbon included in the VS2008 MFC Feature Pack. Now that Windows 7 is out and the look and feel of the ribbon has changed, my application looks out of date already, and it hasn't even been released yet :/ I want the look and feel of the Windows 7 ribbon ("scenic ribbon") idea...

Get relative X/Y of a mouse-click on a MFC CListBox item

I have a CListBox with custom drawing being used, and need to detect mouse-clicks within each item to perform actions. I can listen for mouse-clicks on the main control and mess about translating coords into the local space of the RECT for the item under the mouse. But is it possible to register message handlers for clicks on individual...

compile errors w/wininet & winhttp in MFC application

Strangely I had this working before but I reinstalled my system, upgraded to w7 and now I can't seem to get this code to compile. The problem is that I'm using winhttp.h in most of my application, but I have a simple FTP client object that I wrote using wininet.h functionality. I can't seem to get the application to compile now, no matt...

Windows CWnd::OnLButtonDown not called as expected on double click

I'm developing an interactive MFC application which displays a 3D object using my own algorithm, essentially using MFC as a framework, but using lots of pDC->Polygon(), pDC->Rectangle(), pDC->DrawText(), etc. calls. The UI has numerous clickable areas which all work well. However, the onscreen controls for rotating, spinning, etc. the ...

MFC - Format rtf document to two columns

I am merging many rtf files into a single file for printing. In order to save paper, I would like to have the printout of the merged rtf document in two columns per page. What is the best way to do this? ...

MFC - Printing rtf document

How to print a RTF document in a MFC application without displaying it? The user will go through the following step to print the file: 1. Choose the rtf file. 2. A print dialog box will appear after that 3. Press OK to print the file. ...

MFC - How to make CRichEditView support page break during printing?

I loaded a rtf document into CRichEditView. The document contains page break defined by "\page". However, when I print the rtf document through the CRichEditView, the page break doesn't work. It looks like CRichEditView just ignore the "\page". I open the same rtf document in MS Word and found out that "\page" works. How can I make th...

Is it possible to use COM smart pointers with the CList collection

I'm attempting to create a CList with a COM smart pointer (one of the wrapper classes generated for _com_ptr_t) as the template parameter: CList<IDispatchPtr, IDispatchPtr> list; However I get several compilation errors similar to: error C2664: 'void __stdcall SerializeElements(class CArchive &,class _com_ptr_t<class _com_IIID<st...

Help finding issue with tooltip on CMFCMenuBar

I have an MFC app using the new UI features released in the Feature Pack and I'm having trouble with tooltips on the menubar. By default, I beleive tooltips are not enabled on menu items. Yet whenever I hover over the 2nd item in any of the menu lists I get a tooltip with "Untitled" in the popup. The only time this does not occur is whe...

visual indicator (a +-sign) to expand data in Listview (In MFC)

I want to implement a visual indicator (a +-sign) to expand data in Listview (In MFC). This Listview is part of treevew control like there is + sign befor Test, a Array type data, when i will click on + sign it should expand. Before +Test After - |Test[1] |Test[2] |Test[3] |Test[4] |Test[5] |Test[6] |Test[7] ...

Call a JavaScript function from C++

Hello, I have a CDHTMLDialog, with which I have 2 HTML pages and a .js file with a few fairly simple functions. I would like to be able to call one of the JS functions from my program with a simple data type passed with it. e.g. MyFunc(int). Nothing needs to be returned. I would appreciate any guidance on how I go about this, thank...

CWnd::CreateDlgIndirect leaves m_hWnd==NULL

A dialog I'm working on isn't displaying, using: CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,CWnd* pParentWnd, HINSTANCE hInst) The call to CreateDlgIndirect is in a lon-used base-class, which effectively takes the IDD of the dialog template in the resource file - it works fine for many other dialogs but I can't see what's...

Custom MFC control prevents dialog creation

I have a custom MFC control, subclassing CWnd. Other than providing OnPaint and PreSubclassWindow implementations, it overrides no default functionality and does nothing weird in construction except registering a window class in the constructor. The control is added to the dialog using the dialog editor to add a custom control. The dia...

What message should my MFC dialog control receive before I can modify it?

I have a custom MFC dialog CMyDialog, with a custom control of type CMyControl added using the resource editor - the dialog has a member variable for the control and has DDX set up. The control is receiving paint messages, and has a custom on-paint handler. But I want to have the equivalent of OnInitDialog in the control, so it can sa...

How to create a MFC dialog with a progress bar in a separate thread?

My application may take a while to connect to a database. This connection is made with a single library function call, i.e. I cannot put progress updates in there and make callbacks or something similar. My idea was to create a dialog with a progress bar in a separate thread before connecting to the DB. This dialog will continually ch...

Polished UI Desktop Application, which UI library to choose?

I am a long time MFC programmer and know it quite well. Recently we are planning for a large desktop application. In order to beat competition, one requirement is polished UI. We narrow down the choices to three: WinForms MFC QT4 We looked at some big WinForms applications, such as Paint.Net, and feel that it still lacks power of pe...

MFC without document/view architecture

I'd like some help on using MFC without the document/view architecture. I created a project without doc/view support, Visual C++ created a CFrameWnd and a view that inherits from CWnd. I replaced the view inheriting from CWnd with a new view that inherits from CFormView. However, when I run my program, after I close the window I get a ...

visual studio 2008 MFC linker error

hi i start a mfc application with a dialog window i debug it (nothing added) and i give me an linker error i run it on release mod and it worked my OS is windows 7 what should i do error: LINK : fatal error LNK1000: Internal error during IncrBuildImage 1> Version 9.00.21022.08 1> ExceptionCode = C0000005 1> Except...