mfc

What is the difference between PostMessage and AfxBeginThread?

Hi, I can acheive the same functionality by both PostMessage and AfxBeginThread ( calling asynchrously ) So where lies the the difference between PostMessage and AfxBeginThread? ...

How to load a VC++ CLR library in MFC application?

HI I have a application developed in VC++6.0 ,now I want use some new features from .NET and developed a library, to develop this library I have to use the CLR-VC++ now I packaged this in a DLL.Now I need to call the routine of this DLL in my MFC application. I tried to write a small MFC application to load this DLL, All the time the Lo...

how to find a window's SW_SHOW/SW_HIDE status

I am trying to determine a window control's visibility that has been hidden or enabled with CWnd::ShowWindow(). (or ::ShowWindow(hWnd,nCmdShow)) I cannot simply use ::IsWindowVisible(hWnd) as the control is on a tab sheet, which may itself be switched out, causing IsWindowVisible to return FALSE. Is there a way to get the SW_SHOW/HIDE ...

Catching User Input in C# COM Client

Using VS2003 (.Net 1.1) We have an MFC MDI application that spawns a C# window as a COM client. We need to catch all user input within the application and we're currently using CWinApp::PreTranslateMessage() to catch the commands headed to the MFC windows but this obviously doesn't catch the messages headed to the C# window. What is th...

MFC class's destructor is called twice from managed C++

My task is to allow a MFC based legacy code to be called from .NET applications. I thought about using Managed C++. It works quite fine untill one of the legacy MFC classes get destroyed. I could debug the run of the destructor, without any sign of error. After the destructor, but while the program lefts the scope, the application crashe...

In MFC program, how to pass data between different dialog?

In web development, when we want to pass something between different pages, we might use the Session to save the data. But in MFC, what can we use to store these things? Thanks! ...

in mfc how to implement dockable dialog?

i am working on a Dialog based application in MFC, I need something just like visual studio's left panel, right panel, bottom panelwhich have a close button to close the panel. Anyone know how to implement this ? ...

program to show and hide a toolbar

following is the code which shows and hide a toolbar...the problem is that it does not displays the toolbar..and the showcontrolbar()does not work either.plz help... Is there any other way round??? I am using visual studio 5.0... #include<afxwin.h> #include<afxext.h> #include<stdafx.h> #include"resource.h" class myframe: public CFrameW...

C++ Events/Notifications & Default handling method list

Hello, Is there a list any where of C++ Events/Notifications & Default handling method list. For example, it would be useful to know that by default, the HDN_DIVIDERDBLCLICK notification is normally handled by the CWnd::OnLButtonDblClk method. This would make it easier to find the correct method when wanting to call it when you write y...

How can I preserve the QueryString semantics when converting an MFC CHttpServer based web server to ASP.Net?

In a legacy MFC CHttpServer based web server, we have a command parsing map something like this: BEGIN_PARSE_MAP(MyHttpServer, CHttpServer) ON_PARSE_COMMAND(MyPage, MyHttpServer, ITS_I4 ITS_I4 ITS_I4 ITS_I4 ITS_PSTR ITS_PSTR ITS_PSTR ITS_I4) ON_PARSE_COMMAND_PARAMS("intParam1=11 intParam2=12 intParam3=13 intParam4=14 strParam5=s...

Why does IMPLEMENT_DYNAMIC require an empty constructor?

I have a class which overrides the default empty constructor to provide a constructor with a single parameter. If I use the mfc IMPLEMENT_DYNAMIC macro with this class, I get the error: no appropriate default constructor available. It's simple to solve by adding an empty constructor, but I wondered why this is needed. I am forced to make...

Unmanaged C++ Unit testing in Visual Studio 2008

I want to create a managed C++ unit test project to test an unmanaged MFC project. I have read msujaws's procedural and followed it. I implemented a test method to test the return string of a function like so: #include "stdafx.h" #include "TxStats.h" #include <cstdlib> #include <atlstr.h> #pragma managed #using <mscorlib.dll> #using <...

How to set the picturebox style using SendMessage in win32

Hi, i want to set the style of picturebox using sendmessage in win32. i want a sample piece of code with enum values of setting style.. please please suggest me... i will be thank full to u guys.. please help me. ...

MFC inclusion in different flavors of Visual Studio

Hello, I learned via Wikipedia that Visual Studio C++ 2008 Express Edition does not ship with support for MFC projects. Does anyone know if the Visual Studio 2010 Beta 1 distribution ships with MFC support ? I imagine MFC versions for Win 7 are incomplete, but I only require basic/legacy MFC support for Win XP/Vista. Thanks ...

MFC Dialog Size Question

Hi Good day. from my vc++ project. .rc file. IDD_My_DIALOG DIALOGEX 0, 0, 233, 273 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_OVERLAPPEDWINDOW | WS_EX_STATICEDGE | WS_EX_APPWINDOW CAPTION "AMEC FA Tool" FONT 8, "MS Shell Dlg", 0, 0, 0...

UpdateLayeredWindow, SIZE_RESTORED and GetClientRect problem.

I have a layered window set up in my MFC application. I have set up my own derivation of CDialog to allow me to customise various parts of how the window is rendered. Everything works fine right up until I start worrying about minimise and maximise. If you click minimise or maximise then the window reacts exactly as you'd expect (ie...

Windows messages serviced whilst assert dialog is being displayed?

I have an MFC application that spawns a number of different worker threads and is compiled with VS2003. When calling CTreeCtrl::GetItemState() I'm occasionally getting a debug assertion dialog popup. I'm assuming that this is because I've passed in a handle to an invalid item but this isn't my immediate concern. My concern is: From my ...

How to catch a scroll event in a CListCtrl? MFC C++

I subclassed CListCtrl into my own class, and I use it in several dialogs and views. What I want to do is execute some code when the ClistCtrl is being scrolled vertically. I need this to be in the CListCtrl subclass itself. I can detect the scrolling triggered when interacting with the scrollbar with the method provided by demoncodemon...

Why is my code slower using #import "progid:typelib" than using "MFC Class From TypeLib"?

I am writing an automation client in Visual C++ with MFC. If I right-click on my solution » Add » Class, I have the option to select MFC Class From TypeLib. Selecting this option generates source/header files for all interfaces. This allows me to write code such as: #include "CApplication.h" #include "CDocument.h" // ... connect to ...

How to avoid CListCtrl items to be partially visible?

I have a resizeable CListCtrl and I want to avoid any item being displayed partially, ever. For example: I want Item 9 to not be displayed in this case. Is there a flag or method for this? How would you go about solving this issue? I tried the following and it was no good: void CMyCListCtrl::OnEndScrolling() { int iCount = this...