mfc

CHtmlView class and focus

I am having Dialog Box Application written in MFC. Dialog is having 3 child controls on it. 2 Buttons (Button 1 & Button 2) and a HTML Control (Class derived from CHtmlView) HTML Control has been navigated to a HTML page having 2 checkboxes (Check Box 1 & Check Box 2). Control Z-Order for focus should be like: Button 1 Button 2 HTML Con...

How to prevent an MFC dialog from handling the enter and escape keys and not passing it on.

Hi, we have a C++ application that hosts a flex application in a MFC dialog. Everything works fine, all button pushes etc are passed directly on to flex with no problem at all, except the enter and escape keys, which immediately closes the dialog. We can trap the enter key, by implementing PreTranslateMessage() or OnOK() and impede the ...

Detect drive letter of SD card hardware

Is there a way to programatically detect the driver letter of an SD card(s) on Windows? Does the method support internal and external SD card hardware? Thank you for your time. ...

Resizing Dialog Box In MFC

Hi all; I want to know is there any way or message in MFC by which one can know that a user has finished resizing the dilog box ..?? ...

Using AfxEnableMemoryTracking to detect Memory leaks

Has anybody personally used AfxEnableMemoryTracking function provided by MFC to detect memory leaks. How useful is it? ...

SetLayeredWindowAttributes not working in XP .

I use SetLayeredWindowAttributes for giving the dialogbox an irregular shape .it is working fine in Vista ,win 7 , But in XP(SP2 ,SP3) it shows the masked color . I tried drawing the picture using GDI+ Graphics DrawImage and IPicture interface . no luck. when i tried with a BMP image it works fine in XP .but i need to draw a jpg or png...

how to show both icon and text on button on mfc?

m_pButton->Create(L"ABC", WS_CHILD | WS_VISIBLE| BM_SETIMAGE,CRect(0,0,100,100),this,ID_BUTTON1); m_pButton->SetIcon(::LoadIcon(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_ICON1))); //above show neither showing image nor showing text. ...

reading from registry fails in vista enterprise

I try to read registry key from registry . I start with Admin privilage .Read fails only in vista enterprise ...

Implement Drag and Drop without using Context Menu using Shell extension in C++

HI, I want to implement Drag and Drop without using Context Menu using Shell extension in C++ Currently I am refering to Shell extension article: http://www.codeproject.com/KB/shell/shellextguide6.aspx But this article in turn is using Cookies and all .. I am not able to understand that. My requirement is just when I want to drag and d...

Prevent screen flickering for CScrollView and CToolBar

I have a toolbar being displayed on the top of scroll view. When I call invalidate on scroll view, I realize both toolbar and scroll view are having screen flickering problem. I try to have a workaround, by overriding their erase background event handler. This method works for scroll view, but not the toolbar. Here is my code snippe...

How to disable all possible popup messages in CDHtmlDialog?

Hi! I use CDHtmlDialog to work with DOM of some HTML content from given URLs. I need to disable all possible popup messages (e.g Security alerts) that can appear as in case of InternetExplorer Browser. In JScript I can set property Silent to true var oIE = WScript.CreateObject("InternetExplorer.Application","EventIE_"); oIE.Silent = tr...

Wrong menu bar when starting MFC application

My application is MFC, MDI, and in Visual Studio 2008. It has three menu bars: one to start up with, one associated with document type A, and one associated with document type B. Recently, we've been getting menu bar A showing up some of the times instead of the mainframe menu bar when we start without a document (such as double-click...

Getting "ActiveX controls could not be instantiated. Reinstall or register the controls and try again" message when viewing Dialog

I have an existing Visual C++ project using MFC that I'm running within Visual Studio 2008. The machine was just setup and installed and I have pulled the project from Source Control. The solution builds ok, but if I go into the resource file and try to pull up and view a dialog, I get the message 2 ActiveX controls could not be inst...

How to handle IHttpSecurity::OnSecurityProblem having a IWebBrowser2 object

Hello, I can't seem to understand how i give my implementation of the IHttpSecurity::OnSecurityProblem to my IWebBrowser2 object. I know that i need to implement a class something like this: class CServiceProvider : public IServiceProvider { public: CServiceProvider(); ~CServiceProvider(); // IUnknown ULONG STDMETHODCALLTYPE...

text is not showing on toolbar created in mfc?

int MFC_Tutorial_Window::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!myBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC)) { MessageBox(L"Failed to create toolbar\n"); retur...

Determine windows DPI settings programmatically?

Hello, we've got a problem with one of our non dpi aware MFC applications. If you change the system setting to high dpi (e.g. 120 or 144 dpi), the application icon on the taskbar looks screwed up. Unfortunately, we have to register our own WNDCLASS for the mainframe, and in the WNDCLASS.hIcon member you have to set an icon. This icon is...

Input Box in an MFC CWinApp prgram?

I need an input box in a UI program that is already written derived from the CWinnApp class and using MFC. I see it is using message boxes but I don't see any examples of input boxes.... How do I do this? (Using Visual Studio 6.0 in C++) Thank You. ...

How to have a CDockablePane in the taskbar and not always on top

How can you have CDockablePane have it own panel in the Taskbar, and that it is not always on top of the main window? In other words, have the pane works like normal windows. I've tried to set the pane window's style but without success. LONG windowExStyle = GetWindowLong( GetSafeHwnd(), GWL_EXSTYLE ); windowExStyle |= WS_EX_APPWINDOW...

MFC: Drawing lines of different colors

I have two series of N points I want to graph in two different colors. I can't find anything that explicitly states the best way to go about this simple task when using MFC CDC and CPen objects, and as bunch of CDC::MoveTo/CDC::LineTo calls. It seems each device context can only have one pen object selected at a time, so am I best to se...

Need to learn Visual C++ MFC asap.

I guess I'm a very experienced .Net developer for more than 5 years. I also have experiences on java and even written applications with Borland C++ Builder and also done iPhone apps. Now, I am in a situation that I need to rewrite a .net cf app for a wince device which doesn't have .net framework. So, basically, I need to learn Visual C+...