mfc

error C2661: 'CObject::operator new' : no overloaded function takes 4 arguments

。_饼干妹妹 提交于 2020-01-14 18:49:22
问题 I have a memory leak that I'm trying to hunt down in my mfc program. Typically I would do something like the following: header file // Leak Detection #if defined(WIN32) && defined(_DEBUG) #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> #endif cpp file // Leak detection #if defined(WIN32) && defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) #ifdef DEBUG_NEW #undef DEBUG_NEW #endif #define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ ) #define new DEBUG_NEW #endif This

How to get ATL support into an existing Windows application

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-14 17:54:21
问题 I'm building an application using Qt 5.3.1 in Visual Studio 2012. I also want to use a hardware library which requires me to add a simple ATL object to the project. This can be done by using a Visual Studio wizard. The wizard complains that my project is neither an MFC executable nor an MFC DLL with full ATL support. My question is: How can I add this support to my application? In the project properties I configured the project to link to the ATL and use the MFC. It did not work. Both

How to get ATL support into an existing Windows application

不问归期 提交于 2020-01-14 17:54:09
问题 I'm building an application using Qt 5.3.1 in Visual Studio 2012. I also want to use a hardware library which requires me to add a simple ATL object to the project. This can be done by using a Visual Studio wizard. The wizard complains that my project is neither an MFC executable nor an MFC DLL with full ATL support. My question is: How can I add this support to my application? In the project properties I configured the project to link to the ATL and use the MFC. It did not work. Both

How to use a CTabCtrl in a MFC dialog based application?

混江龙づ霸主 提交于 2020-01-14 14:58:05
问题 I need to do something which i expected to be was simple - create a tab control which has 2 tabs, implying 2 modes of operation for my app. When user clicks on Tab1, he'll be presented with some buttons and textboxes, and when he clicks Tab2, some other input method. I noticed that there was a CTabCtrl class thats used in MFC to add tabs. However, once I added the tab ctrl using the UI designer, I couldn't specify how many tabs there'll be using property window. Searching on the net, I found

Thread type for background drawing to a bitmap in MFC

牧云@^-^@ 提交于 2020-01-14 13:38:07
问题 I have a MFC document/view C++ graphics application that does all its drawing to an off screen bitmap, and then copys that to the supplied CDC pointer in the OnDraw method. Over the last couple of days I've been looking to place the drawing component in a seperate worker thread, so it doesn't stall the GUI. I seem to get a fair number of MFC GDI related asserts firing when I do this, e,g, VERIFY(::MoveToEx(m_hAttribDC, x, y, &point) So a few questions; Are there any problems with using worker

MFC CMenu tooltip not being displayed

孤者浪人 提交于 2020-01-14 07:11:06
问题 I tried using something like this to set the tool tip of a CMenu item (as described here) but it is just being displayed in a single line and the line break is not visible. // read control id UINT id = menu->GetMenuItemID(1235); // modify caption and add tooltip? menu->ModifyMenu( id, MF_BYCOMMAND, id, "Click here\nThis is the tooltip for the menu item ..."); I also tried to set the caption directly in the visual studio resource designer of the menu item with the same effect. Can you give me

STL iterator for MFC container CObList

给你一囗甜甜゛ 提交于 2020-01-14 03:19:10
问题 I have a Folder class which contains two lists of Folders and Files . class Folder : public CObject { public: typedef std::string StringT; ... Container filesInFolder; Container foldersInFolder; StringT folderName; ... }; class File : public CObject { ... }; Lists derive from CObList. Class Container : public CObList . I need to perform search inside foldersInFolder by name and in filesInFolder by name and extension. CObList::Find does not allow me to use predicates. I would normaly use std:

How to get WM_POWERBROADCAST message in CWinApp?

随声附和 提交于 2020-01-14 03:04:23
问题 I create the class that inherited CWinApp and this class has a timer (use a window timer). When PC go sleep mode and wake-up, timer callback is called exact time of wake-up. I want to make to not call the timer callback when PC is resuming from suspend. So I tried to use WM_POWERBROADCAST message. But this message didn't catch in PreTranslateMessage() API. Also I tried SetWindowLong() with my own API but still didn't catch the WM_POWERBROADCAST message. Is there any way to get WM

Windows cannot find hcw

穿精又带淫゛_ 提交于 2020-01-14 01:57:13
问题 I am trying to migrate an old MFC project to VS 2012 and one of the errors I get is this one: From what I read is that it has something to do with Help Files , which are not supported on Windows 7 . I thought that maybe Windows is searching for the hcw path so I added to the Environment Variables , but I still get the error. From the code I can see that the command is called inside .mak files: start /wait hcw /C /E /M "hlp\$(InputName).hpj" Anyone has an idea how can I get rod of the error ?

When will _ATL_ALLOW_UNSIGNED_CHAR work?

橙三吉。 提交于 2020-01-14 01:52:18
问题 I'm migrating a Visual C++ project which uses ATL/MFC from VS2010 to VS2013. The project compiles with /J ("assume char is unsigned"), and there is too much code that may or may not rely on that fact to easily remove the compiler flag. Under VS2013, /J causes a compiler error in atldef.h: ATL doesn't support compilation with /J or _CHAR_UNSIGNED flag enabled . This can be suppressed by defining _ATL_ALLOW_UNSIGNED_CHAR . Microsoft mention this in the MSDN documentation for /J, along with the