mfc

Something for a child window analogous to `this`

我是研究僧i 提交于 2020-01-06 08:07:31
问题 I am a newcomer to programming. I am writing a dialog based application which has a static control on it. Using Using void CMy1stDlg::OnMouseMove(UINT nFlags, CPoint point) { if (this == GetCapture()) { CClientDC aDC(this); aDC.SetPixel(point, RGB(255,0,0)); } } I can create results like However what I want is that the locus of mouse is only drawn within the static window. I can't find the reference to this in MSDN and I don't know why the following method fails. void CMy1stDlg::OnMouseMove

How to make a window always appear on top of other windows?

橙三吉。 提交于 2020-01-06 07:03:20
问题 In my dialog I have a rich edit control. While typing in the richeditcontrol, I am displaying a list box for auto completion. I want to display the listbox on top of other windows but my listbox is not visible fully but it is forced to be inside of richedit control. I want to implement like listbox in combobox which is always top of other windows . How to display the listbox on top of other window? I am displaying below styles. DWORD nListStyle = WS_CLIPCHILDREN|WS_EX_TOPMOST|WS_CHILD |WS

How to make a window always appear on top of other windows?

a 夏天 提交于 2020-01-06 07:02:02
问题 In my dialog I have a rich edit control. While typing in the richeditcontrol, I am displaying a list box for auto completion. I want to display the listbox on top of other windows but my listbox is not visible fully but it is forced to be inside of richedit control. I want to implement like listbox in combobox which is always top of other windows . How to display the listbox on top of other window? I am displaying below styles. DWORD nListStyle = WS_CLIPCHILDREN|WS_EX_TOPMOST|WS_CHILD |WS

MFC gui testable with google test?

◇◆丶佛笑我妖孽 提交于 2020-01-06 06:58:31
问题 I have been using gtest as my C++ unit-test framework, and it works great for console applications. Does anybody know if it is possible to use this (or which would be a good alternative) for testing an MFC application? I mean, make an automatic test depending on the events of the GUI (text inside text-boxes, buttons clicks and so). I have seen applications like TestComplete, but I would like to know if gtest offers something similar or if there is a free/opensource alternative to start with.

How To Get Window handles In Mozilla Firefox

為{幸葍}努か 提交于 2020-01-06 06:55:40
问题 How to get handles of all the child windows in Mozilla firefox. Spy++ is showing only one class and window caption for all the windows. I tried using GetWindow and FindWindowEx but got nothing. I want to read URL from mozilla firefox. 回答1: Spy++ uses standard Windows API calls to inspect window hierarchies (EnumWindows, EnumChildWindows, etc.). If Spy++ doesn't show any native windows, then there aren't any native windows. Consequently, you cannot find any native windows either. Firefox uses

SendMessage WM_LBUTTONDOWN/UP works on buttons but not window

十年热恋 提交于 2020-01-06 06:09:15
问题 I am trying to send some simple mouse down/up messages to Windows Calculator using SendMessage. I have been able to press the buttons by sending the messages to the buttons directly. However, I have not been able to successfully send the same messages to the main calculator window handle. Given that hWnd is the window handle to calculator, this is my code. IntPtr fiveKey = FindWindowEx(hWnd, IntPtr.Zero, "Button", "5"); int x = 5; // X coordinate of the click int y = 5; // Y coordinate of the

Dividing a CDialog in two areas with different backgrounds (picture of the objective inside)

本秂侑毒 提交于 2020-01-06 05:01:06
问题 I need to build a window designed to look exactly like this (it has controls inside the white area, but that's not relevant for now): http://dl.dropbox.com/u/3432167/example.png My problem is defining those two separate "areas" with different backgrounds. The closest I've got to the expected look was representing the white area with an empty ListBox, but the result is not the same (and it is a lousy hack). Any ideas on how achieve this? 回答1: If the dialog does not need to be resizable, the

How can I have a multi-line item in a ListControl MFC?

微笑、不失礼 提交于 2020-01-06 03:53:06
问题 I have an MFC List Control in Visual Studio 2013 (C++) with a List of items (Report view) LVCOLUMN lvColumn; lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvColumn.fmt = LVCFMT_LEFT; lvColumn.cx = 120; lvColumn.pszText = "Full Name"; ((CListCtrl*)GetDlgItem(IDC_LIST1))->InsertColumn(0, &lvColumn); lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvColumn.fmt = LVCFMT_LEFT; lvColumn.cx = 75; lvColumn.pszText = "Profession"; ((CListCtrl*)GetDlgItem(IDC_LIST1))->InsertColumn(1, &lvColumn)

How do I override DrawItem for BS_SPLITBUTTON buttons

微笑、不失礼 提交于 2020-01-06 02:28:49
问题 If I make a new button class inheriting from CButton , specifying the BS_OWNERDRAW style , and overriding the DrawItem method I can control the rendering of the button, like this: void CMyButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { CDC dc; dc.Attach(lpDrawItemStruct->hDC); RECT rect = lpDrawItemStruct->rcItem; dc.FillSolidRect(&rect, RGB(0, 0xFF, 0)); dc.Detach(); } m_button.Create(L"Foo", WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, CRect(0, 150, 100, 200), this, IDC_FOO); I get the

Can't get the handle of a Cwnd Class in MFC Windowless Activex?

╄→гoц情女王★ 提交于 2020-01-05 12:23:14
问题 I have asked two questions earlier about this and for each post there was some solutions i tried them, but the problem still exist. My first question was : why a windowless Activex does not return the Handle. the suggestion was "change the creation setting an make windowless activate off, i have tried it but still m_hWnd property has returned zero as GetSafeHwnd() method has did. the second one was the same question this one focused on COleControl class and it's ancestor CWnd. the solution