mfc

How to execute stored procedure without exception thrown by CRecordset::Open?

I'm trying to execute a stored procedure on SQL Server from an MFC based C++ program. The stored procedure does get executed properly, but an exception is thrown in my program, a CDBException with a message of "Function sequence error". Tracing through the MFC source code for CRecordset::Open, the exception is thrown from MoveNext - th...

MFC: retrieve button ID programmatically

I have a CButton object called mouseCtrl, and in the DoDataExchange function, I have the following: DDX_Control(pDX, IDC_MCCHECK, mouseMode); Somewhere else in my program, I would like to be able to call a function/method of mouseMode so that I can retrieve the IDC_MCCCHECK id macro properly. Is there a function in MFC that can allow ...

How to increase a cells height and width in ListControl

How can we increase the the height and width of a cell in List It is created using Listcontrol MFC ...

MFC: troubleshooting on which thread is responsible for causing a crash

I currently have my project running two separate threads (one for MFC operations, like views/formviews, application window, etc., and one for an infinite while loop in its main function). However, for certain situations, when I run my program in debug mode, I have noticed that one of the threads' exit status was a 1 (in other words, it r...

Unhandled Exceptions from Managed C# User Control used in MFC Dialog

Our core application is built in MFC C++, but we are trying to write new code in .NET, and have created a User Control in .NET, which will be used on an existing MFC Dialog. However, when a unexpected/unhandled exception is thrown from the User Control, it causes the MFC app to crash (illegal op style), with no ability to recover. I've...

MFC OnEnChange handler function - infinite loop

Hi, (I'm using VS++2005) I put edit box control (with ID - ID_edit_box) on my dialog, and associate (with handler wizard) two varibles for it: control (c_editbox) and value (v_editbox) variable. Also I associate handler function OnEnChangeedit_box with that edit box control. Suppose that we may enter just one digit in edit box, and tha...

Why don't Firefox and other apps honor my Windows XP settings?

Recently for convenience I set up Windows XP to "Automatically move pointer to the default button in a dialog box" (via Control Panel => Mouse => Pointer Options). For most dialog boxes (e.g. Windows file delete confirmation, Outlook empty deleted items) Windows will follow this directive and automatically position my cursor above the d...

Hiding the dialog on startup for a system tray application

I'm writing an application in C++ that runs as a system tray icon. When the application initially starts up the main dialog loads up and takes focus, which isn't the behavior I intend it to have. Is there a way to load the system tray icon without having the main dialog load up? ...

Screen capture ignores some windows

Hello, I am working in MFC and I am trying to capture a bmp of the desktop. I am using GetDC(NULL) to do this but it seems it ignores special skinned windows. It seems to ignore windows drawn with UpdateLayeredWindow. This behaviour seems to be happening only on Vista x64 and XP. I have also tried GetWindowDC with the desktop HWND but t...

Open an html page on an install CD with the default browser

I am trying to build an install CD with a custom MFC application set to autorun when the CD is inserted. The instructions are included as a simple html page with images and links to PDF documents, all of which are located on the CD. In the past I'd used the following to open the html page with the default browser: ShellExecute(NULL, "...

How to detect "Use MFC" in preprocessor

For a static Win32 library, how can I detect that any of the "Use MFC" options is set? i.e. #ifdef ---BuildingForMFC--- .... #else ... #endif ...

MFC: child dialog behavior

I'm trying to make my child dialog box to be created as a member of the main application class as follows: class ParentWindow : public CWinApp { public: // Other MFC and user-implemented classes before this line MiscSettings activeMiscSettings; public: ParentWindow(); ~ParentWindow(); // Overrides virtual BOOL Init...

VC++ 2008 Express MFC Download

I am following this tutorial: http://www.generation5.org/content/2001/sr00.asp?Print=1 Right off the bat it asks me to use the MFC Application Wizard to create a new project. It turns out that it's not included with the Visual Studio 2008 Express. Is there any way that I can download it so that I can use it to continue the tutorial? O...

MFC menu item checkbox behavior

I'm trying to add a menu item such that it acts like a check mark where the user can check/uncheck, and the other classes can see that menu item's check mark status. I received a suggestion of creating a class for the menu option (with a popup option), however, I can't create a class for the menu option when I'm in the resource layout ed...

What may cause DefWindowProc to stop processing messages ?

Hi, I encountered strange behaviour of my application. I would like to close frame window in MDI application, so I send WM_SYSCOMMAND (SC_CLOSE) to that window. After that, I receive OnSysCommand. Then I call CMDIChildWnd::OnSysCommand to proceed processing. The problem is, that sometimes base implementation of OnSysCommand calls OnCl...

Embed IE6 with MFC

Hi guys, I'm looking to use the "Microsoft Web Browser" ActiveX control in an MFC app, but we need it to be IE6 in order to support legacy stuff and all that not-so-fun stuff. The systems that it will be deployed upon, however, may have IE7 or IE8 installed. I'm not much of a COM/ActiveX guy, although I know my way around C++ and MFC. ...

Managing input focus on an MFC SDI multiple view application

Hi all, We have a relatively large MFC application that uses an SDI to host a number of dynamically created CView- based views. The basic structure of the application is somewhat like Outlook (tree view on the left, dynamic view(s) on the right). I've been puzzling over the correct way to handle focus changing in the app. For example...

Does MemoryDC occupied memory or the memory on video card?

I am using the following code to create a compatible DC: m_pDC=new CDC(); VERIFY(m_pDC->CreateCompatibleDC(sampleDC); CBitmap bitmap; if (bitmap.CreateCompatibleBitmap(sampleDC, rect.Width(), rect.Height())) { m_pOldBitmap = m_pDC->SelectObject(&bitmap); } My question is does CDC CBitmap occupied memory ? If it is using memory, wh...

some questions about MFC development?

How do you develop UI in MFC? do you use any free libray, or usually develop from scratch? There are always so many DLL files in a C++ developed software, what are them used for ? What's the difference between MFC ActiveX Control and MFC DLL ? ...

MFC Fail to Load Dlg from DLL

I have installed in my PC VS2008 and Windows Mobile 6 SDK. I have made a SmartDevice MFC application and a Regular DLL MFC, both uses shared MFC DLL. But when I called DoModal() of the DLL the application hangs, show a "Debug Assertion Failed" message and freeze my device. Can you help me? Codes: The EXE code: typedef BOOL (CALLBA...