mfc

How to make child control handle accelerator command of parent CView

妖精的绣舞 提交于 2020-01-13 06:42:11
问题 I have a CFormView, and a child CListCtrl control. I can handle accelerator events, like Ctrl+C, Ctrl+V ... in CFormView without problem, by defining below message handler: ON_COMMAND(ID_EDIT_COPY, &CMyFormView::OnEditCopy) Now I want my CListCtrl handle these commands differently. I want to implement OnEditCopy in CListCtrl class, rather than implement logic in the view class. How can I pass the accelerator events from CView to child control, when CListCtrl is on focus? I tried like: ON

Hiding an MFC dialog box

ぐ巨炮叔叔 提交于 2020-01-12 03:42:05
问题 Ok so I am using this code to hide the taskbar icon of a dialog based MFC application(VC++). The taskbar icon and the dialog box hide whenever I click on the cross or the close buttons. But I can’t get this one thing right. Whenever I hit the close or the cross button from title bar, the dialog box first flickers and shows a sort of intermediate dialog box and then hides. This is very annoying. I am posting my code here after two days of vain effort. So guys please help me. Thanks in advance.

How to correctly screencapture a specific window on Aero/DWM

倖福魔咒の 提交于 2020-01-11 20:05:50
问题 Background info: I have this MFC application I coded and been using for a long time that pretty much automatically saves screenshots to the hard disk when the user hits the Print Screen/Alt+Print Screen key. I have been putting off using anything related to Aero until now that I've been using Windows 7 RC for a couple of weeks. The problem: I'm using the standard GetDC/BitBlt method to capture the window contents. I have no problems with this method while doing regular full-screen grabs (no

How to correctly screencapture a specific window on Aero/DWM

喜你入骨 提交于 2020-01-11 20:03:32
问题 Background info: I have this MFC application I coded and been using for a long time that pretty much automatically saves screenshots to the hard disk when the user hits the Print Screen/Alt+Print Screen key. I have been putting off using anything related to Aero until now that I've been using Windows 7 RC for a couple of weeks. The problem: I'm using the standard GetDC/BitBlt method to capture the window contents. I have no problems with this method while doing regular full-screen grabs (no

How to prevent MFC dialog closing on Enter and Escape keys?

若如初见. 提交于 2020-01-11 15:45:11
问题 I know one method of preventing an MFC dialog from closing when the Enter or Esc keys are pressed, but I'd like to know more details of the process and all the common alternative methods for doing so. Thanks in advance for any help. 回答1: When the user presses Enter key in a dialog two things can happen: The dialog has a default control (see CDialog::SetDefID() ). Then a WM_COMMAND with the ID of this control is sent to the dialog. The dialog does not have a default control. Then WM_COMMAND

Can I add MFC support to an Existing ATL COM project

落花浮王杯 提交于 2020-01-11 13:28:26
问题 I have created a Shell Extension using ATL COM Object . But during creation I haven't added MFC support. Can I change the setting now to add MFC support 回答1: Yes, but I believe that doing this won't auto-add all the required headers and #defines - of course, you could try this first, and check to be sure. If that does not work, you could use 'File->New->Project from Existing Code' to create a new project in your solution that uses both MFC and ATL, using the code in your original project. You

How to change the font style of the dialog's title bar in MFC

你。 提交于 2020-01-11 10:17:10
问题 By default in MFC, the font of the dialog's title bar is in correspondence with the system settings. How can I change the font style? 回答1: This is not just an MFC default; it works that way for all Windows applications. That's because the operating system draws the title bar for all windows, and naturally the operating system respects the settings that the user has configured. If you want to change that and override the user's settings (and I really question why you would want to do such a

Reading VC++ CArchive Binary Format (or Java reading (CObArray))

核能气质少年 提交于 2020-01-11 10:09:12
问题 Is there any clear documentation on the binary formats used to serialize the various MFC data structures? I've been able to view some of my own classes in a hex editor and use Java's ByteBuffer class to read them in (with automatic endianness conversions, etc). However, I am currently running into issues while trying to bring over the CObArray data, as there seems to be a rather large header that is opaque to me, and it is unclear how it is persisting object type information. Is there a set

CRecordset::snapshot doesn't work in VS2012 anymore - what's the alternative?

折月煮酒 提交于 2020-01-11 06:16:32
问题 Apparently, in VS2012, SQL_CUR_USE_ODBC is deprecated. [Update: it appears that the cursors library has been removed from VS2012 entirely]. MFC's CDatabase doesn't use it anymore (whereas it was the default for VS2010 and earlier versions of MFC), but instead uses SQL_CUR_USE_DRIVER. Unfortunately, SQL_CUR_USE_DRIVER doesn't work properly with the Jet ODBC driver (we're interacting with an Access database). The driver initially claims to support positional operations (but not positional

Why is CMFCMenuBar not utilizing the accelerator table?

强颜欢笑 提交于 2020-01-11 03:34:07
问题 In a doc/view project using VS2008, a MFCMenuBar seems to load the correct MENU resource (IDR_MAINFRAME) from the project, since adding and removing menu items is reflected in the menu's UI. It even appends the accelerators to the default menu items (e.g. Ctrl+O to the Open... item). However, the accelerator table (IDR_MAINFRAME) doesn't seem to be connected to the menu. Changing the default Ctrl+O for Open... to something like Ctrl+7 doesn't work. The Ctrl+O is still appended to the Open...