mfc

Parent notification in MFC Dialog

I have a first dialog with a simple button on it and while clicking the button, a second dialog is created using CDialog::Create(IDD,this). I would like the parent to be notified when the second dialog is destroyed but without adding any code to the second dialog i.e., without adding a m_pParent->Notify() line in OnDestroy method. I have...

MS Web Browser on Pocket PC

Hi all, I'm trying to create a custom web browser for on a pocket pc in C++ MFC. When I add the Microsoft Web Browser activeX control and run the app on the pocket pc (emulator) then this error pops up: "Debug assertion failed. occcont.cpp line: 916" When I look in the debug window of VS2005: "CoCreateInstance of OLE control {8856F961-...

ULONGLONG value corrupted in WinPE

I have an MFC app running in WinPE (Windows Preinstallation Environment), and I'm trying to make a method call with a 64-bit value in a ULONGLONG as a parameter. I've determined that the value is correct (ie. 0x1b432d6000) before the call, but is corrupt (ie. 0x432d60000000000a) inside the call. The value is initially allocated on the ...

MFC, c++ When showing and hiding ctrls on the screen can I disable paint for a bit.

I have a screen with say 20 controls on it. I want to show all twenty, then hide only the ones that don't relate to what I'm working on. psudoCode. for each element show element for each element in hide list hide element. My problem is that between the loops the screen paints. It looks very ugly. I know I've seen this do...

How do I implement simple copy/paste functionality in an mfc CListCtrl?

Is this really the easiest way to do this? http://simplesamples.info/MFC/Clipboard.php ...

How can I preserve UTC in a CDateTimeCtrl?

My MFC application has a dialogue with a date picker. When I initialise this dialogue, I need to call CDateTimeCtrl::SetTime() and I'm trying to decide what argument to give it. I have an array of integers representing a year, month, day, hour and minute in UTC. Here's the important bit: the date picker must display the time in UTC, n...

MFC built using /clr compiler option - CString/System::String conversion

I've got a fairly large MFC application that has just been migrated from VS6.0 to VS2008. It was a pretty painful process, but now I'd like to explore any managed-code options that may be available. I was able to successfully build the project using the /clr switch which seems to give me access to managed types. I'd like to know if con...

MFC CSocket in a static library

I am using the MFC class CSocket. Nothing complicated - open a connection to a server and send a short message. The code works fine when I link with MFC in a DLL. However, the call to CSocket::Create() crashes when I link to MFC in a static library. I would like to use MFC in a static library since it simplifies distribution. ...

How to draw 32-bit alpha channel bitmaps?

I need to create a custom control to display bmp images with alpha channel. The background can be painted in different colors and the images have shadows so I need to truly "paint" the alpha channel. Does anybody know how to do it? I also want if possible to create a mask using the alpha channel information to know whether the mouse ha...

CListCtrl::GetItemNext returns start item

Hi I have a CListCtrl object in my C++ MFC app for Windows Mobile 6. When I call listctrl.GetNextItem(0, LVNI_ABOVE) I should therefore get back -1 (no item above first item), but if (and only if) the list has exactly one item, the call returns 0, even though MSDN says "The specified item itself is excluded from the search". Is this a k...

How to access win32 console App Data in VC++ MFC GUI.

I have two apps: Win32 Console App. MFC GUI App. I wanted to execute the console app in MFC GUI and I am want to get data from that Console app and display them in GUI. I get this error: "fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do ...

How to create MFC applications with VS express08 ??

Please ... I need this for a project ... ...

is it possible to create DLL for both win32 console and MFC GUI

is it possible to develop DLL for both win32 console and MFC GUI. If yes please explain. What i want to do is to create dll that contains certain API's for both win32 console and MFC GUI. ...

Static control with WS_EX_TRANSPARENT style not repainted

Hi all, I am trying to create a control that implements the per-pixel alpha blend while painting a 32-bit bitmap. I extended a CWnd and use static control in the resource editor. I managed to paint the alpha channel correctly but still the static control keep painting the gray background. I overwrote the OnEraseBkgnd to prevent the co...

LPCSTR, LPCTSTR and LPTSTR

What the difference between LPCSTR, LPCTSTR and LPTSTR? Why do we need to do this to convert a string into a LV_ITEM structure variable pszText: LV_DISPINFO dispinfo; dispinfo.item.pszText = LPTSTR((LPCTSTR)string); ...

How can I make a CListCtrl keep its scrollbar?

In MFC, a CListBox has a "disable no scroll" property. When you set it to true, the vertical scrollbar is always there, no matter how many items you have. How can I do the same thing with CListCtrl? ...

Multi-byte character set in MFC application

I have a MFC application in which I want to add internationalization support. The project is configured to use the "multi-byte character set" (the "unicode character set" is not an option in my situation). Now, I would expect the CWnd::OnChar() function to send me multi-byte characters if I set my keyboard to some foreign language, but...

Developing as a programmer

Hi all, I have been learning C++ for three months now and in that time created a number of applications for my company. I consider myself fairly comfortable with C++ / MFC and STL, however I don't just want to be an OK programmer, I want to be a good programmer. I have a few books on best practices but I was wondering if anyone could su...

Which is preferred CTabCtrl vs. CPropertSheet in MFC?

I don't know how to use both of them. So a sample code with pros and cons is perfect. Which one is preferred? Why? ...

Advanced Windows Application UI (MDI Tabbed Group)

I would like to be able to create an MDI UI layout that extends the behavior of MDI Tabbed Groups in the following way. Within a pane for a split tabbed group, I'd like to create a nested tab group with the opposite directional alignment. For instance, given a horizontally split top level, I would like to create a vertically split tab ...