mfc

Load a png resource into a CBitMap

How do i load a png resource into a CBitMap? When i try this it doesnt work. CImage image; image.LoadFromResource(AfxGetInstanceHandle(), IDB_PNG1); bitmap.Attach(image.Detach()); It gives me an error resource type not found. Is there any other way to load a PNG resource? ...

DTPicker: how to open up an control expanded (by default)?

Hi all, in my windows form (Visual C++ 6.0) I'm using an Active x control called "CDTPicker" (CDTPicker : public CWnd). My control is opened up by the click event of another button. like this (works fine): void CProducerDlg::OnSelect() { ... m_wndDatePicker.SetValue(varVariant); // hide date combo box if first entry has been...

Manually create a dialog child window using an ID from resource.h

I want to add a simple panel to a dialog created using Visual Studio resource editor, but the resource editor doesn't allow this - I need to add my own CWnd as a dialog child. However that way I think I have to use CWnd::Create manually, and pass in names for the class and the window. I want to create an ID like IDC_MYPANEL, and as much...

MFC , C++ in embedded(semiconductor) projects

What are the internal features/aspects of C++/ VC++ and MFC that are used for embedded(semiconductor) projects by large IT companies. I ask this becuase I need to be prepared for one such poistion. please reply. ...

SetWindowPos has not effect on tooltip

Hello, I am trying to give my ComboBox an in place tooltip for long strings. However when I call SetWindowPos on the tooltip, the position is never changed. Called when TTN_SHOW is received: ::SetWindowPos(textTooltip, NULL, TipRect.left, TipRect.top, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER); If I remove the SWP_NOSIZE flag ...

How does one hide a win32 app window?

I want to run the app in silent mode by passing in a parameter, otherwise I will show the window. ...

Can managed and unmanaged C++/MFC be mixed in one dll?

Previously we had software in MFC (VC6), VB6 and C# applications that needed to call the same engine written in C++ (and MFC). The engine required C++ for speed. At the time we decided to use COM as the interface because all three could use it with the least issues in marshalling, etc. Our MFC application is now deprecated and we have...

Obtaining MFC Feature Pack GUI elements in .NET WinForms

The MFC Feature Pack (and VS 2010) adds out-of-the-box support for several "modern" GUI elements (such as MDI with tabbed documents, the ribbon, and a Visual Studio-style interface with docking panels). These are a boon to those of us that have to support legacy MFC-based applications and want to update their look-and-feel, and a sign th...

Create a ActiveX with a MFC existing application

Hello! I'm trying to convert my MFC application, a simple "PaintBrush" app that draws lines and rectangles (it's only a little test from another bigger application), to a ActiveX Control that a could embed into a Windows Forms Application (with Visual C#). I didn't found any tutorial for do this, and now, I'm not sure that this it's po...

allow debugger to hook instance of application launched externally?

I'm trying to test problems with an MFC application that still uses DDEEXEC mechanism for handling shell verbs (e.g. "open"). I cannot seem to find a way to cause the debugger to hook the application instance the second its created (or at a point of my choosing) when it's launched from the Windows shell. For example, if I were to double...

What's the best approach for getting into VS2010, C# 4, and WPF if my background is in C++/MFC

All my past programming experience has been in C++ on VS2003/8, Mostly service based and completely self taught. 2 Years ago I had to create my first real GUI app and (Foolishly) choose MFC. I got the app working but it took a long time & was a bit of a nightmare to learn MCF (and its many shortcomings) but I ended up with a reliable...

how to load image from file using MFC

My browse button code is void CFileOpenDlg::OnBnClickedButton1() { // TODO: Add your control notification handler code here CFileDialog dlg(TRUE); int result=dlg.DoModal(); if(result==IDOK) { path=dlg.GetPathName(); UpdateData(FALSE); } } and this is the code for loading an image from resource but that does not work for loa...

Windows program written using MFC is a C++ program?

Hi, Every C++ books that I've read says something like this:- All C++ programs have a main() function. main() function is the starting point for all C++ programs. All C++ programs begin its execution from the main() function. However, I found that Windows programs written using MFC do not have any main() function. It use WinMain() f...

<msbuild/> task fails while <devenv/> succeeds for MFC application in CruiseControl.NET?

The Overview I am working on a Continuous Integration build of a MFC appliction via CruiseControl.net and VS2010. When building my .sln, a "Visual Studio" CCNet task (<devenv/>) works, but a simple MSBuild wrapper script (see below) run via the CCNet <msbuild/> task fails with errors like: error RC1015: cannot open include file 'winr...

Problems encountered in changing a CRichEditCtrl selection color.

I have written the following code after creating the CRichEditCtrl // 06112010 : The following code was added to highlight the textselection in black color instead of the default blue color of CRichEditCtrl. - 1311 { m_EditControl.SetSel(0,100); CHARFORMAT2 cf1; cf1.cbSize = sizeof(CHARFORMAT2); m_EditControl.GetSelectionCharFormat(c...

How do you switch to "Use MFC in a Static Library" and get rid of the errors

I am working on a project i inherited form a previous team and am attempting to build the project in release mode in Microsoft Visual Studio 2008. I need to get the program to compile with "Use MFC in a Static Library" in the properties window instead of "Use MFC in a Shared DLL" I keep getting a number of errors which are displayed belo...

How to do HTTP transfers with MFC/C++ ?

How do you do HTTP transfers in MFC? Which library would you use to access HTTP resources in MFC? ...

Windows 7 sharing data between users via the registry

Where can I create/modify/delete registry keys to share data between users in the Windows 7 registry? Both of the users are non administrators and it shouldn't require admin privileges. The application I'm working on uses the registry to write a key from userA and then userB can read/modify/delete it. Neither user has admin privileges ...

Okay to compare pointers returned by RUNTIME_CLASS() macro?

I've got a function that takes a list of CRuntimeClass pointers in order to setup a view. I'd like to return without doing anything if the function is called with a list of the same classes that are already setup. Saving the pointer values and comparing them on the next call is currently working, but I want to verify that that's a legal ...

SQLConfigDataSource creates invalid datasource

I am using SQLConfigDataSource to create an ODBC MS Access data source programmatically. It works most of the time, but fails if the DBQ value (i.e., path to the Access database) in the lpszAttributes string contains more than 148 characters (far fewer than MAX_PATH). Has anyone ever run into this before? Any possible workarounds? ...