访问2 MFC应用程序的数据成员 [英] Accessing data member of 2 MFC application

查看:101
本文介绍了访问2 MFC应用程序的数据成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题要在vc ++中执行软键盘.实际上我必须使用2个MFC应用程序.一个用于放置editbox.另一个用于keaboard设计.如果我单击editbox,我必须打开另一个用于键盘设计的mfc exe文件我可以正确打开键盘窗口.如果我单击键盘窗口中的任何按钮,我将按键字符串发送到另一个应用程序中的editbox,并成功返回到键盘窗口中,单击下一步按钮.到此为止,我的程序还可以,但是问题是当我单击键盘设计中的下一个按钮时,成功发送了keytrock,但是我面临的问题是editbox中没有控件.因此keytrock不会在editbox中显示.我的问题是,如何访问控制变量第一个MFC到第二个MFC,即键盘MFC.为此,我创建了一个包含带有头文件的editbox的类对象,但调试器显示错误没有这样的文件目录".应用

I got a question to perform softkeyboard in vc++.Actually i have to use 2 MFC application.One for placing editbox.Another for keaboard designing.if i click on editbox i have to open another mfc exe file which is for keyboard design.I could open properly the keyboard window mfc.if I click on any button in keyboard mfc i sent keystrock to editbox which is in another application and succesfully returned to keyboard mfc to clicking next button.Upto this thing my program is ok.But problem is that when i click on the next button in keyboard design keystrock sent successfully but tha problem which i am facing is that no control in the editbox.so the keystrock wont desplay in the editbox.My que is that How can I access the control variable of first mfc to second mfc ie keyboard mfc.For that that I have created a object of class which contain editbox with including headerfile.but debuger shows the error "there is no such file directory".Please reply How can i send keystrock to another application for one or more time.

推荐答案

这是非常有限的软键盘"应用程序.您不需要带有编辑框的第二个应用程序.在解释如何制作 real 虚拟键盘之前,让我们先完成基于编辑框的设计.我认为您使用编辑框通过"softkeyboard"输入文本;以及键入的文本,您以后可以使用剪贴板将其移至任何其他应用程序.如果是这样,您将需要将其包括在与键盘相同的应用程序和过程中;否则,您将无法使用它.这样,您可以将处理程序传递给编辑框HWND并向其发送消息.你在做什么吗?这是非常有限的方法.

您可以创建一个 real 虚拟键盘,该键盘可以直接在任何应用程序中键入.

为此,您只需要使用两种技术即可:

1)使用Windows API SendInput在较低级别上模拟键盘.
请参阅 http://msdn.microsoft.com/en-us/library/ms646310(v = vs.85).aspx [WS_EX_TOPMOST(始终在顶部")和WS_EX_NOACTIVATE.在原始Windows API中,这些样式是在对CreateWindowEx的调用中设置的,请参见 http://msdn.microsoft.com/en-us/library/ms632680(v = vs.85).aspx [ Hans Dietrich 在CodeProject上的这篇文章:
XKeyboard-屏幕键盘 [
This is very limiting "softkeyboard" application. You don''t need the second applications with edit box. Before I explain how to make a real Virtual Keyboard, let''s finish with the design based on edit box. I think you use the edit box to type text using the "softkeyboard"; and the typed text you can later move to any other application using clipboard. If so, you would need to include it in the same application and process as the keyboard; in this way you can pass a handler to the edit box HWND and send messages to it. Is is something you''re doing? This is very limiting approach.

You can create a real Virtual Keyboard which can type directly in any application.

For this purpose, you need to use just two techniques:

1) Simulate keyboard on a low level using Windows API SendInput.
See http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx[^].

2) Solve the problem of keyboard focusing and activation. To simulate typing in any window of any application, you need to keep the keyboard focus in this window. That means the parent pop-up window of this application should be activated and the text input control should have the keyboard focus. When you try to click on a button of a Virtual Keyboard it would be activated and the key focused which would make typing impossible. To prevent this, your Virtual Keyboard window should combine style WS_EX_TOPMOST ("always on top") and WS_EX_NOACTIVATE. In raw Windows API, these styles are setup in the call to CreateWindowEx, see http://msdn.microsoft.com/en-us/library/ms632680(v=vs.85).aspx[^].

Look at this article by Hans Dietrich on CodeProject:
XKeyboard - on-screen keyboard[^]

—SA


这篇关于访问2 MFC应用程序的数据成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆