mfc

Custom dropdown for CComboBox

I'm trying to create a custom dropdown for a derivative of CComboBox. The dropdown will be a calendar control plus some 'hotspots', e.g. So I figure the best way to achieve this is to have a simple CWnd-derived class which acts as the parent to the calendar control, and have it paint the hotspots itself. The window needs to be a pop...

Exceptions silently caught by Windows, how to handle manually?

We're having problems with Windows silently eating exceptions and allowing the application to continue running, when the exception is thrown inside the message pump. For example, we created a test MFC MDI application, and overrode OnDraw: void CTestView::OnDraw(CDC* /*pDC*/) { *(int*)0 = 0; // Crash CTestDoc* pDoc = GetDocument...

[MFC] What is the reciprocal of CComboBox.GetItemData?

Instead of associating objects with Combo Box items, I associate long ids representing choices. They come from a database, so it seems natural to do so anyway. Now, I persist the id and not the index of the user's selection, so that the choice is remembered across sessions. If id no longer exists in database - no big deal. The choice wil...

What color to use in owner-draw Windows List Control background?

I have an owner-drawn list control in my Windows program. I use CListCtrl::GetBkColor to get the background color, and for a selected item I use GetSysColor(COLOR_HIGHLIGHT). This matches what Windows uses for non owner drawn list controls, except for the case where the control doesn't have focus - then the background is replaced with gr...

Changing Screen co-ordinates

Hi, Just i come across one application.When i load that application,the actual applcation is like toolbar only.Its get loaded in the top of the screen.And the desktop items automatically get moved and displayed below toolbar.Even when i open any other window and maximized the windoe,its get maximized below toolbar only.The screen co ordi...

SetWindowLong in CustomDraw causes unhandled exception

Hello, I am making some changes to a CSliderCtrl using the Custom Draw, the control is to be used in a dialog. Here is the structure: In my MessageMap I have : ON_NOTIFY_REFLECT_EX(NM_CUSTOMDRAW, OnNMCustomdraw) The OnNMCustomdraw method looks like the following: BOOL CCustomSliderCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult) ...

How to create a bold and italic label in MFC?

Please do not mark it as a dupe of this question just yet: http://stackoverflow.com/questions/1881865/bold-labels-in-mfc That question does not help me; for some reason I do not see the rich edit control. Instead I believe I have to do it in code. here is a sample I found: http://www.tech-archive.net/Archive/VC/microsoft.public.vc.mfc...

What's the right way to show a non-modal child dialog in MFC (VS2005)?

Rather than have everything in one big dialog, I'm looking at being able to display child dialogs for separate groups of controls. The idea is these are not free-floating child dialogs like floating toolbars, but would be shown with no title-bar, their position locked to the parent dialog... so as you drag the parent dialog any open chil...

CFile + WriteHuge not working

HI, I am using CFIle in my application and when i compiled my code i am getting error 'WriteHuge' : is not a member of 'CFile' 'ReadHuge' : is not a member of 'CFile' I included #include "afx.h" CFile file; file.WriteHuge(m_pDib,bmpFileHeader.bfSize-nBmpFileHeaderSize); file.ReadHuge(m_pDib,bmpFileHeader.bfSize-nBmpF...

MFC: 'Gluing' two windows/dialogs together

I'm trying to set something up so my main dialog has one or more child dialogs, and these are glued/docked to the outside of the main dialog - when the main dialog is minimised, the children are too, when main dialog moves, children move with it. I'd tried setting child dialogs as having main dialog CWnd as parent, with CHILD style. But...

Drawing problem does ShowWindow(hWnd, SW_HIDE) automatically invalidate rectangles?

Hello, I'm running into a problem where, I have a Window that contains a child window. The child window contains another child window where a video is playing using Windows Media Player. Whenever I do call ShowWindow (hWnd, SW_HIDE) on the parent Window and paint over the entire surface, the region occupied by the grand-child window (whe...

Is it possible to create a CImageList with alpha blending transparency?

I would like to knwo if it is possible to create a CImageList with alpha blending transparency. Sample code that creates a CImageList with ugly transparency (no alpha blending) CGdiPlusBitmapResource m_pBitmap; m_pBitmap.Load(IDB_RIBBON_FILESMALL,_T("PNG"),AfxGetResourceHandle()); HBITMAP hBitmap; m_pBitmap.m_pBitmap->GetHBITMAP(RGB(0...

VS 2008 MFC - Remove MFC handler

Hi, How do you remove a MFC command handler like ON_UPDATE_COMMAND_UI from a C++ file? I can't seem to find a way to do it thru Dev Studio. If you know how, please explain. I am using VS 2008. Thanks, Mike ...

MFC CEdit does not process messages

Hi I'm dealing with a really annoying bug here... Basically I have an MFC application, that has a CEdit used to display some text in read-only mode(CStatic is not used, because CEdit provides the scrolling feature). After some set of actions is performed, the CEdit quits processing WM_SETTEXT messages. It does receive them - I can clear...

Difference in Solicit and unsolicit messages/events?

Can someone pls tell me do we have solic & unsolic message/events in MFC or window programming? In devices solic response and unsolic response is said as immediate response (like acknowledgement to commands) and late response (generated without any further commands being sent) respectively. Likewise can we say events as solic / unsolic...

This program has stopped working

In a visual C++ mfc program, which I run on Wondows 7, I always get the error message This Program Has Stopped Working after I close the main dialog/exit the application. But it doesn't happen in Windows XP. Can anyone explain what the matter is and how to solve it? Thanks a lot. ...

[Win32/MFC] Making group-boxes contain things

As I understand it, a group-box is just another control. Controls inside it are not owned by it, so unlike in Winforms, if you move a group-box the contained controls stay put. What would be the nicest way to address this? Just create your own data-structure mapping controls to 'container' group-boxes so that when the container is moved ...

Flicker/dead region issues maximizing an MFC window

I'm trying to make an MFC window (a CDialog) go fullscreen whenever the user attempts to maximize it. The window is being used as an OpenGL context. I'm attempting to do everything inside of the CDialog::OnSize callback. Here's the code that I'm using: void MyCDialogSubclass::OnSize(UINT action, int width, int height) { CDialog::OnS...

how to use CDialog in win 32 application?

I did the following steps to use the CDialog in win 32 application: Changed the use of MFC to "use mfc shared DLL". Added a dialog resource and added a class for the dialog. Included the dialog class in my main. Tried to call do modal. when i try to call do modal...i am getting an debug assertion failed.. can anybody help me out of t...

Regular DLL using: MFC Shared vs MFC statically linked

When we create a DLL using Visual studio (VC8 or 9), we get an option as create Regular DLL using MFC as shared DLL or using MFC as static library How are they different? Which one is advisable to use? ...