cwnd

MFC: What on earth is a CSplitterWnd Caret?

What on earth is a caret in the context of a CSplitterWnd class? I can't find any documentation relating explicitly to CSplitterWnds... EDIT: Specifically, what do these functions actually do: CWnd * pCurView = m_wndSplitter2.GetPane(2, 0); pCurView->ShowCaret() pCurView->HideCaret() EDIT2: Please note, I know what a caret is, I am s...

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...

DLGTEMPLATE to CWnd-derived control

Is it possible to take a DLGTEMPLATE and use it as a CWnd-derived control for placing in any other CWnd? I have a dialog template that I want to use on one of my CDockablePanes ...

How to know when a controls is going to be hidden

Hi all, I have a control derived from a CWnd object that has its custom implemented tooltip system . The tooltip is implemented using a CDialog and works fine but I have a problem to know when I have to hide it. The tooltip shows up when the mouse hover over the control (WM_MOUSEHOVER) and it's hidden when the mouse leaves the control ...

Custom image while dragging an CWnd-derived object

Hi all, I want to display a custom image while dragging an object in a drag&drop operation. I have created a CWnd-derived control (a chart) and I display 4 of them in the same dialog. I've implemented drag&drop using COleDataSource so that the user can change its position by dragging and dropping the control. Now I would like to displ...

How to redirect MFC messages to another object?

In an instance of a class derived from CWnd, is it possible to forward (redirect) all MFC messages to another object, without writing separate handlers and message mappings for each possible message? Specifically, I'd like to forward all unhandled WM_ messages to another object. If this isn't possible, then is it possible for objects ...

why message box is always hidden behind main dialog and cannot be shown on the top

I am using MFC to write a GUI application. I chose dialog-based application, and put picture control, edit box and buttons on it. When the picture control is mapped to the class derived from CWnd using DDX_Control, all the message boxes (including default system message box pop up when you enter invalid input in the edit box) are hidden...

What is the lifetime of a CWnd obtained from CWnd::FromHandle?

According to msdn, when I get a CWnd* with CWnd::FromHandle, The pointer may be temporary and should not be stored for later use. What is meant by "later use" is not clear to me. Is it only the scope of the current method? As far as I know, there is no GC in Win32! ...

How to get window handle from a CDialog derived class ?

Hi All, Is there a way to retrieve window handle from a CDialog derived class (like CWnd::m_hWnd member) ? Thanks ...

How to replace window desktop with my own application window CWnd

I tried to paint on my windows desktop using GetDesktopWindow(). But i failed because desktop repaints itself rapidly and my painting doesn't appear. So I need to replace my desktop window obtained by GetDesktopWindow() with ownerdraw application window Can anyone has an idea, how to do this ? Thanks in advance, Milan ...

Why paint messages get lost even after calling UpdateWindow() ?

I have an application with following windows hierarchy: W1 -W2 (Child of W1) - W3 ( Child of W2) --------------------| | W1|------------| | | |W2 |------| | | | | |W3 | | | | | |------| | | | |------------| | |-------------------| When certain event happens in W2, I call UpdateWindow: W2::onCertainEvent()...

Why does CCmdUI::Enable disable a button after I enable it with CWnd::EnableWindow?

My job requires me to maintain some old MFC programs, and I've been asked to add a CButton to an existing dialog. Even though my code calls CWnd::EnableWindow to enable the button, CCmdUI::Enable disables it. Here is part of the stack trace at the moment CWnd::Enable disables the button. mfc90d.dll!CWnd::EnableWindow() mfc90d.dll!CCmd...

MFC CWnd::CreateEx throws exception when the project is DLL, but runnig fine when exe

I have a C++ gui application(MFC). I have made it dll and used its functionality from my C# windows exe application. Surely I'm not showing any window that previously were shown from C++ application. For the following line i'm getting the error Error: "Microsoft Visual C++ Debug Library... Debug Assertion Failed!... afxwin1.inl Line:2...

Maximized Window Restores to Full Screen

Using CWnd::ShowWindow(SW_SHOWMAXIMIZED) maximizes my app window as expected. However, when clicking the restore button on the app (or double clicking the title-bar), the restored size is the same size as the maximized window, which is confusing for the user. Using this alternative code has the same problem: WINDOWPLACEMENT wndpl; Get...

Restricting GetFocus to specific dialog and/or application

I have a MS Visual C++ project where I have a CDialog based dialog box with several edit controls. I want to highlight the control with the current focus for the user. I implemented this by getting a pointer to the window that has the current focus with GetFocus() and then obtaining the ID for the focused control with GetDlgCtrlID(): ...