简体   繁体   English

如何通过其他班级打开和关闭MFC GUI?

[英]How to turn on and off mfc gui by other class?

i need to make a class that have a pointer to mfc class and to turn on and off the gui and also to have the option to take data from the gui. 我需要制作一个具有指向mfc类的指针的类,并打开和关闭gui,并且还可以选择从gui中获取数据。 thank you. 谢谢。

By "turn on and off the GUI" I will assume you mean hide or display the main window, since you haven't provided a good description of what you're looking for. 通过“打开和关闭GUI”,我将假定您的意思是隐藏或显示主窗口,因为您没有对所需的内容提供很好的描述。 You can use CWnd::ShowWindow with a parameter of SW_HIDE to turn the window off, and use SW_SHOW or SW_RESTORE to show it again. 您可以使用带有SW_HIDE参数的CWnd :: ShowWindow关闭窗口,并使用SW_SHOWSW_RESTORE再次显示该窗口。

By "option to take data from the GUI" I will assume you want to do Copy and Paste from the GUI to another application. 通过“从GUI提取数据的选项”,我将假定您要从GUI复制并粘贴到另一个应用程序。 That's a much larger subject. 这是一个更大的话题。 Here's some sample code: 这是一些示例代码:

OpenClipboard();
EmptyClipboard();
SetClipboardData(CF_TEXT, dataHandle);
CloseClipboard();

You can find a lot more information in Microsoft's guide to Using the Clipboard . 您可以在Microsoft的使用剪贴板指南中找到更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM