Hidden dialog takes focus for a moment

I have a bit of a problem here. I have a third party ActiveX control which converts files from one type to another. I want to convert many files, so I need to run it in batch conversion. However this control crashes a lot (I'm not talking about nice C++ exceptions, it does cute things like accessing already freed memory, doing access violation, you name it). So my problem is the followi

隐藏的对话框需要关注一会儿

我在这里遇到了一些问题。 我有第三方ActiveX控件将文件从一种类型转换为另一种类型。 我想转换很多文件,所以我需要在批量转换中运行它。 然而,这个控件崩溃了很多(我不是在谈论漂亮的C ++异常,它可以做一些可爱的事情,比如访问已经释放的内存,访问冲突,你的名字)。 所以我的问题是以下几点: 1)我需要将这个ActiveX控件包装在一个单独的进程中,以防止它破坏我的主进程的内存。 2)我需要调用这个过程数百次

How do I set focus to CEdit in child dialog that is inside TabCtrl?

I have a dialog box (CDialog) with owner-drawn CTabCtrl in it. Tabs content are child dialogs (one for each tab). There is an CEdit in each tab. When the user clicks a tab, I'm hiding all child dialogs using ShowWindow(SW_HIDE) and showing a selected one. The problem is that when I have, for example, two tabs, click inside an edit box in the first tab and then switch to second, input foc

如何将焦点设置为TabCtrl中的子对话框中的CEdit?

我有一个对话框(CDialog),其中拥有自己绘制的CTabCtrl。 选项卡内容是子对话框(每个选项卡一个)。 每个选项卡中都有一个CEdit。 当用户点击一个标签时,我隐藏了所有使用ShowWindow(SW_HIDE)的子对话框并显示选中的对话框。 问题是,当我有,例如,两个选项卡,单击第一个选项卡中的编辑框内,然后切换到第二,输入焦点停留在第一个选项卡(不可见)编辑框中,无论我在我的代码(尝试调用所有可能可以设置焦点的方法

MOUSEMOVE is caused by touch/pen

I am experimenting with WM_TOUCH and want to detect if mouse events are synthesized from touch/pen events or due to an actual mouse event. The official solution according to MSDN is to check if the result of GetMessageExtraInfo() has the upper 24 bits set to 0xFF515700 . This works. Most of the time. If I use one finger, all is well and good, but if I use more than one, releasing the last o

MOUSEMOVE是由触摸/笔造成的

我正在试验WM_TOUCH,并希望检测鼠标事件是由触摸/笔事件还是由于实际的鼠标事件而合成。 根据MSDN的官方解决方案是检查GetMessageExtraInfo()的结果是否将高24位设置为0xFF515700 。 这工作。 大多数时候。 如果我使用一个手指,一切都很好,但如果我使用多个手指,释放最后一个手指会导致鼠标随着GetMessageExtraInfo() == 0 。 另外,当窗口通过触摸失去焦点时,会生成多达3条带有GetMessageExtraInfo() == 0鼠标移动

c++

I have created a dialog that runs on the main thread of an MFC application. While this dialog is made modal, it does a few things on the main thread (ie message pump thread) that takes time. Whenever something takes time, I create an automatic variable using the MFC class CWaitCursor. While in the OnInitDialog method, it works as intended. However, If I do the same past the end of OnInitDial

C ++

我创建了一个在MFC应用程序的主线程上运行的对话框。 虽然这个对话框是模态的,但它在主线程(即消息泵线程)上做了一些事情,这需要花费一些时间。 无论何时需要时间,我都会使用MFC类CWaitCursor创建一个自动变量。 在OnInitDialog方法中,它按预期工作。 但是,如果我在OnInitDialog的末尾执行相同的操作,例如在为响应自定义窗口消息而调用的方法中,等待光标不会显示出来。 但是,如果我使用EveryWAN(这是一个允许通

MFC dialog maximized is larger than monitor

In WIndows 7, when I maximize an MFC dialog, using the system menu's small square button, the resulting dialog window is slightly larger than the physical dimensions of the screen. Why is this? The GetSystemMetrics calls yield the correct monitor dimensions, and the screen resolution (right-click desktop) also shows the correct dimensions. The WM_SIZE message, sent after the window is ma

最大化MFC对话框比监视器大

在Windows 7中,当我最大化MFC对话框时,使用系统菜单的小方块按钮,所得到的对话框窗口略大于屏幕的物理尺寸。 为什么是这样? GetSystemMetrics调用产生正确的显示器尺寸,并且屏幕分辨率(右键单击桌面)也显示正确的尺寸。 窗口最大化后发送的WM_SIZE消息显示的尺寸稍大于监视器,与切断的对话边缘部分一致。 例如,在1920 x 1080监视器上,从OnSize()最大化的大小是1936 x 1096. Spy ++显示 矩形:(-1928,-8)

SetWindowTextA or SendMessageA crashes program

ERROR: afxwin2.inl line 165 My app is a dialog box with a few edit boxes. Once I click the button to evaluate the information entered I want to open a child dialog to display the results. I tried overloading DoModal() like this: //in the child dialog //.h CResultsDlg::CResultsDlg(CParentDlg *parent); virtual INT_PTR DoModal(float bmi); //.cpp CResultsDlg::CResultsDlg(CParentDlg *p

SetWindowTextA或SendMessageA崩溃程序

错误:afxwin2.inl行165 我的应用程序是一个带有几个编辑框的对话框。 一旦我点击按钮来评估输入的信息,我想打开一个子对话框来显示结果。 我试图像这样重载DoModal(): //in the child dialog //.h CResultsDlg::CResultsDlg(CParentDlg *parent); virtual INT_PTR DoModal(float bmi); //.cpp CResultsDlg::CResultsDlg(CParentDlg *parent) : CDialogEx(CResultsDlg::IDD), _parent(parent) { //initiali

extra initialization in new window of a MFC/OpenCV project

I have a computer vision project using OpenCV and MFC for the GUI. I want to do the following: when i click Button1, i get a new window that displays a video then captures images by clicking on the buttons of that new window. First, i had an MFC project with only the window that displays the video and it worked fine. Then i created a new project where i made that window comes after clicking o

在MFC / OpenCV项目的新窗口中进行额外的初始化

我有一个使用OpenCV和MFC的GUI的计算机视觉项目。 我想做以下事情:当我点击Button1时,我得到一个显示视频的新窗口,然后通过单击新窗口的按钮来捕获图像。 首先,我有一个只有显示视频的窗口的MFC项目,它工作正常。 然后我创建了一个新的项目,我点击一个按钮之后创建了该窗口。 这是我用来调用该窗口的代码。 void ClassTestDlg::OnBnClickedButton1() { CDialog ClassTestDlg(IDD_DIALOG_WindowDisplay); Cl

Multithreading and MFC

I am writing a multithreaded app. On the main thread is the main window which is a modeless dialog box. When the user clicks on the start button, it will create a new thread that does some stuff for a long time. On the main thread it will create a new modeless dialog box to display the status of that new thread, 1 per thread. I created kind of a template dialog box using the resource editor a

多线程和MFC

我正在编写一个多线程应用程序。 主线程是主窗口,它是一个非模态对话框。 当用户点击开始按钮时,它会创建一个新的线程,长时间执行一些东西。 在主线程上,它会创建一个新的无模式对话框来显示新线程的状态,每个线程1个。 我使用资源编辑器创建了一种模板对话框,并为该状态设置了一个静态文本,使其ID为IDC_STATIC_NUMCYCLE。 我在OnIdle函数中轮询线程的状态。 状态的更新只适用于1个线程,但是如果我更多地生成了所

How Do I Launch a Dialog in MFC?

I'm fairly new to VC++ and MFC, so bear with me. I have created a new dialog, and I want to figure out how to display it when the user clicks a button. I have not create a class or header file for the dialog -- I tried using the class wizard, but it pretty much sucked and didn't work. That, or I was doing something wrong. Either one is equally as likely if you ask me. So what steps

如何在MFC中启动对话框?

我对VC ++和MFC相当陌生,请耐心等待。 我创建了一个新的对话框,我想知道如何在用户单击按钮时显示它。 我没有创建对话框的类或头文件 - 我尝试使用类向导,但它几乎被吸引,并没有工作。 那,或者我做错了什么。 如果你问我,其中任何一个人都是一样的。 那么在创建源文件/头文件并获取对话框启动/显示时,需要执行哪些步骤? 这是一个模态对话框。 澄清:我知道我需要创建对话框类的实例,然后调用DoModal(),但

Why aren't std::count and std::find optimised to use memchr?

I was reading sehe's answer to this question and was surprised to see sehe found using a hand written loop using std::memchr to be over 3 times faster than using std::count (see comments). The code using std::count can be seen in edit 2, but it basically boils down to: const auto num_lines = std::count(f, l, 'n'); vs uintmax_t num_lines = 0; while (f && f != l) if ((f = static

为什么不std :: count和std :: find优化使用memchr?

我正在阅读sehe对这个问题的回答,很惊讶地看到使用std::memchr手写循环比使用std::count (见注释) 快了3倍 。 使用std::count的代码可以在编辑2中看到,但它基本归结为: const auto num_lines = std::count(f, l, 'n'); VS uintmax_t num_lines = 0; while (f && f != l) if ((f = static_cast<const char*>(memchr(f, 'n', l - f)))) num_lines++, f++; 我希望std::count版本至少和std::mem