Questions tagged [cwnd]

CWnd Class is part of MFC library and provides the base functionality of all window classes.

CWnd Class is part of MFC library and provides the base functionality of all window classes.

A CWnd object is distinct from a Windows window, but the two are tightly linked. A CWnd object is created or destroyed by the CWnd constructor and destructor. The Windows window, on the other hand, is a data structure internal to Windows that is created by a Create member function and destroyed by the CWnd virtual destructor.

73 questions
13
votes
4 answers

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…
remio
  • 1,242
  • 2
  • 15
  • 36
8
votes
1 answer

C++ "var foo = !!::bar()" syntax ?

Looking for some explanation on how going fullscreen mode with HWND window, I found this response Win32: full-screen and hiding taskbar The chromium response code has this line: saved_window_info_.maximized = !!::IsZoomed(hwnd_); from this file…
Julien hadim
  • 101
  • 2
7
votes
2 answers

Overridden functions for IAccessible interface do not work in cwnd-drived class

I have a CWnd-derived class named button, and want to use CWnd accessibility functions, I override this function in my class: virtual HRESULT get_accName(VARIANT varChild, BSTR *pszName); virtual HRESULT get_accChildCount(long…
5
votes
1 answer

How to get window handle from a CDialog derived class?

Is there a way to retrieve window handle from a CDialog derived class (like CWnd::m_hWnd member) ? Thanks
ivymike
  • 1,511
  • 2
  • 20
  • 27
4
votes
4 answers

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…
Geoff
  • 83
  • 2
  • 7
3
votes
2 answers

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…
Adi Shavit
  • 16,743
  • 5
  • 67
  • 137
3
votes
3 answers

MFC CWnd height and width

How do you get the height and width of a CWnd*? The CWnd is the window correct? Why isn't the command: CWnd* parent = this->GetParent(); // C++ command parent->GetSize(); // what I think the method should be OR ... parent->GetWindowRect(); // what i…
Fractal
  • 1,748
  • 5
  • 26
  • 46
3
votes
1 answer

Focus not changing upon tab key in a nested CWnd-Derived Class

Environment: VS2013, MFC, C++ I have a CDialog derived dialog with 2 static buttons (OK, Cancel), created with the dialog editor. Additionally the dialog should contain a dynamically created instance of a CWnd-Derived class, which contains 2 edit…
suriel
  • 191
  • 1
  • 10
3
votes
5 answers

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…
Milan Dhameliya
  • 129
  • 1
  • 10
3
votes
2 answers

Modify the congestion control window value

For my research, I would like to manually control the congestion control window size of TCP. I want to explicitly stop the window from being reduced when segment/ack loss occurs on a test network. Is this possible at all? I have been looking into…
user2037981
  • 31
  • 1
  • 2
3
votes
1 answer

How to create C# Event to handle MFC Windows message from PostMessage()

I have a managed C++ DLL using WINSOCK. On receive it sends a custom message to a CWnd * via PostMessage(). This works fine when called from unmanaged C++. The target CWnd * is registered with the C++ class after construction using this code: …
JonN
  • 2,498
  • 5
  • 33
  • 49
2
votes
3 answers

MFC add scrollbar to CWnd member

I have a member of CWnd class name mywindow and i want to add to it a scroll-bar. how i can do it? i try already to do: mywindow.EnableScrollBarCtrl(SB_BOTH,TRUE); it display both Horizontal and Vertical scroll-bars, but i cannot push the buttons…
Tal
  • 1,145
  • 2
  • 14
  • 32
2
votes
2 answers

MFC: Is it safe to call CWnd methods from another thread?

Actually I have two questions: Is it safe to call SendMessage from a worker thread? Do CWnd methods, like MessageBox, call API function SendMessage behind the scene? Per my understanding, when the worker thread calls SendMessage, it pushes the…
Ken Zhang
  • 1,454
  • 2
  • 13
  • 27
2
votes
0 answers

CWND max size in Linux

I've used this command below in Solaris to set the max CWND window size: ndd -set /dev/tcp tcp_cwnd_max size_here But I don't know the equivalent of it in Linux. Can anyone help me please? Note: I want to set the max size not the initial…
Dionis Beqiraj
  • 737
  • 1
  • 8
  • 31
2
votes
3 answers

How do I prevent users from dragging windows around?

I've inherited a project that presents users a set of tabs, each of which contains a view that displays multiple components. In some of these tabs, we want to prevent users from moving the components displayed in the tab. We have an object that…
BobbyA
  • 2,090
  • 23
  • 41
1
2 3 4 5