mfc

MFC COM or ATL COM (ActiveX)

I have some MFC code (custom CWnd controls and some classes to expose) that I need to make into an activex / COM object with interfaces. Is it easier to make an ATL project with MFC support and make my ActiveX that way or make an MFC ActiveX control? When doing an activeX control, is doing dual interfaces (like that explained in ACDual ...

Illegal Instruction in service using SCM in VC++

Hi guys, I have issue in service created using VC++ code. as my ServiceMain function ends. it returns following error in End of the function(in release it crashes.) Unhandled exception at 0x0012e3b4 in Adiserv.exe: 0xC000001D: Illegal Instruction. i am unable to figure out the issue. can you help me out... Thanks Ashish ...

Error while reading files with native code on windows mobile

Hi all! I'm new here and my english is not really good. Apologize any inconvenience! I'm programming an application for windows mobile with native code (MFC). I'm trying to open a file and this is driving me crazy. I've tried to open it in a thousand diferent ways... And I really achieve it, but when I try to read (fread or getline) t...

Crash within CString

Hi I am observing a crash within my application and the call stack shows below mfc42u!CString::AllocBeforeWrite+5 mfc42u!CString::operator=+22 No idea why this occuring. This does not occur frequently also. Any suggestions would help. I have the crash dump with me but not able to progress any further. The operation i am performi...

Displaying an EMF file

Hey guys! Got a quick question about Windows EMF/EMF+ files. Reading the documentation, I realize that an EMF/EMF+ file is just a bunch of GDI/GDI+ commands. So what's the supported way for reading in an EMF/EMF+ file and then displaying it in either MFC or WinForms? Thanks, Alex ...

Switching to WPF. Is it time?

I'm considering switching from MFC to WPF. My first concern is that there are too many users who don't have .NET with WPF installed yet. Can anybody point to a source containing the WPF penetration numbers? My second concern is speed. Any other considerations? ...

Get text width in MFC

I'm wanting to dynamically resize a CButton to the width of the text within it. Is there either a built-in way to do this in MFC, or a way of calculating the pixel width of some specified text (so that I can use CWnd::SetWindowPos)? ...

MFC multithreading problem with delete[] , dbgheap.c

Hi! I've got a strange problem and really don't understand what's going on. I made my application multithreaded using the MFC multithreadclasses. Everything works well so far, but now: somewhere in the beginning of the code i create the threads: m_bucketCreator = new BucketCreator(128,128,32); CEvent* updateEvent = new ...

How do I split a large MFC project into smaller projects

We have a large MFC/C++ Visual Studio 2005 solution which currently consists of two projects: Code (around 1500 .h/.cpp files, linked dynamically to MFC) Resource DLL (we translate the resources using an external tool) What options do we have (lib, dll, ...)? Where do we start? Is there a technical sample of this or a tutorial (I ...

MSHTML MFC Tutorial

Hi, I know this has been asked twice before but both had no proper replies and are dated so in case someone has found something in these days, I'm asking again!. Any one knows any good tutorial for MSHTML or some open source project which can be read to understand how various operations can be done in MSHTML - MFC? Thanks ...

Icons on CMFCOutlookBar

I'm using CMFCOutlookBar from the Feature Pack, and I'm trying to put an icon on the "button" of the tabbed pane - the thing that slides up and down in the bar, when you select a pane. The pane API includes a "SetIcon" function, but this doesn't do anything as far as I can tell. Neither does the "SetTabHicon" function of the bar. Does...

Problem statically linking MFC libraries

I have a Visual Studio 6 workspace I'm trying to convert to a Visual Studio 2008 solution. The output of said solution is a .dll. It has to be a .dll and it needs to statically link MFC as I can't redistribute MFC to existing customers. The solution consists of three projects, say A, B, C. C is the Active Project, outputs the .dll and...

Anchor buttons in a dialog when using SW_MAXIMIZE

This should be a simple one: I have a CDialog with 2 buttons. The dialog is always opened in full screen (No title bar \ Status, etc...) using m_pMainWnd->ShowWindow(SW_MAXIMIZE); I want my buttons to snap to the edge of the screen. There are no resizing or anything. ...

Loop through MFC Child Dialogs, MDIFrames and etc

Hello, Is there a way to loop through all MFC Child Dialogs, MDI frames and etc? And is there a way to find out which dialog or window I am looping through? Any answer would be appreciated! ...

C# DllImport MFC Extension DLL & Name Mangling

I have a MFC extension DLL which I want to use in a C# application. The functions I'm exposing are C functions, i.e. I'm exporting them like this extern "C" { __declspec(dllexport) bool Initialize(); } The functions internally uses MFC classes, so what do I have to do to use the DLL in C# using P/Invoke. Secondly, I want to use func...

How do I control the text input panel programmatically (tabtip.exe) in windows vista/7.

Hi, I'm adapting an application for touch screen interface and we're want to use the tablet text input panel included in windows vista/7, specifically its keyboard. I want to show and hide it as appropriate for my app. Basically I want ShowKeyboad() and HideKeyboard() functions. What's the best way to control this. I looked at the ITex...

Howto Track down variable Corruption

I have a MFC class derived from CStdioFile declared as follows // Datafile.h class CDataFile : public CStdioFile { public: CDataFile(void); ~CDataFile(void); int OpenFile(LPCWSTR FileName); } After my OpenFile function is called the FileName variable is being corrupted. int CDataFile::OpenFile(LPCWSTR FileName) { m_OpenFl...

Get Current User Selection(IHTMLTxtRangePtr) in MSHTML

Hi, How can I get Current user selection or current cursor location in HTML document? I am useg MSHTML interfaces in MFC. Thanks. :) ...

Switching threads for MFC application cleanup

I'm trying to clean up specific memory objects created by a specific thread (hence only accessible to that thread). The only way for me to achieve that is to switch to that particular thread when freeing that memory block. This is how I allocated the specific memory context: This is what I attempted to do: I have originally added t...

Unicode RTF text in RichEdit

I'm having trouble getting a RichEdit control to display unicode RTF text. My application is Unicode, so all strings are wchar_t strings. If I create the control as "RichEdit20A" I can use e.g. SetWindowText, and the text is displayed with the proper formatting. If I create the control as "RichEdit20W" then using SetWindowText shows the ...