QT window interaction with win32 window
来源:互联网 发布:iis 配置sql server 编辑:程序博客网 时间:2024/06/07 03:44
caller is a QT program.
example:
#include <QtWidgets/QMainWindow>#include "ui_QtGuiApplication1.h"class QtGuiApplication1 : public QMainWindow{Q_OBJECTpublic:QtGuiApplication1(QWidget *parent = Q_NULLPTR);signals:void eventData(const QString & data);private: bool nativeEvent(const QByteArray & eventType, void * message, long *result);private slots:void on_pushButton_clicked();void on_SendMsgBtn_clicked();private:Ui::QtGuiApplication1Class ui;};
void QtGuiApplication1::on_pushButton_clicked() {_cwprintf(L" on_Chrome_clicked \n" );HWND wind = (HWND)winId();_cprintf("calling hwnd %d \n", wind);std::wstringstream s;//s << "--use-views ";s << "--url=F:\\medias\\second.mp4";s << " ";s << " --caller=" << (unsigned long)wind;HINSTANCE res = ShellExecute(NULL,L"open",L"D:\\visual projects\\QtGuiApplication1\\Win32\\Debug\\cef\\cefsimple.exe",s.str().c_str(),NULL,SW_SHOWNORMAL);_cwprintf(L" on_Chrome_clicked %d \n", res);//MessageBox(wind, L"Hello world!", L"Message", MB_OK);}bool QtGuiApplication1::nativeEvent(const QByteArray & eventType, void * message, long *result) { MSG* msg = reinterpret_cast<MSG*>(message);if (msg->message == WM_COPYDATA) {HWND reciverhwnd = (HWND)msg->wParam;PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT)msg->lParam;_cwprintf(L"nativeEvent WM_COPYDATA %d, %x, %d --->\n", reciverhwnd, reciverhwnd, pcds->dwData);*result = 0;return true;}return false;}
The callee is cefsimple, do some moficication;
typedef struct tagMYREC{char s1[80];char s2[80];DWORD n;} MYREC;COPYDATASTRUCT MyCDS;MYREC MyRec;void SimpleHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) { CEF_REQUIRE_UI_THREAD(); // Add to the list of existing browsers. browser_list_.push_back(browser); MessageBox(NULL, L"OnAfterCreated", L"Message", MB_OK); if (hcaller != NULL) { SendMessage(hcaller, WM_COPYDATA, NULL, NULL); } MyRec.n = 10; MyCDS.dwData = 1; // function identifier MyCDS.cbData = sizeof(MyRec); // size of data MyCDS.lpData = &MyRec; // data structure if (hcaller != 0) { SendMessage(hcaller, WM_COPYDATA, (WPARAM)(HWND)browser->GetHost()->GetWindowHandle(), (LPARAM)(LPVOID)&MyCDS); }}void SimpleApp::OnContextInitialized() { ............. std::wstring outstr; StringToWString(outstr, caller); std::string::size_type sz; hcaller = (HWND)std::stol(caller, &sz); // MessageBox(NULL, outstr.c_str(), L"Message", MB_OK); //if (hcaller != NULL) { // SendMessage(hcaller,// WM_COPYDATA,// NULL,// NULL); //} } // SimpleHandler implements browser-level callbacks. CefRefPtr<SimpleHandler> handler(new SimpleHandler(use_views, hcaller));....}
阅读全文
0 0
- QT window interaction with win32 window
- Win32 splitter window project
- Win32 Series - Child Window Controls
- QWidget中嵌入win32 window
- 【Window】Win32 API连接热点
- [Qt]动态库--window
- Qt set current window
- Window下安装QT
- QT Window Geometry
- QT Demo 之 window
- window下安装qt
- QT Demo 之 window
- Open popup window with open.window method
- QT Demo 之 window(5) window.qml
- QT Demo 之 window(5) window.qml
- Window
- window
- window
- Java/Android引用类型及其使用分析
- Vue.js学习系列二 —— vuex学习实践笔记(附DEMO)
- 关于MP4文件格式解析
- Windows下使用pthread库(GCC CL编译器都可以使用)
- java.io.IOException: 拒绝访问
- QT window interaction with win32 window
- 录制手机屏幕并且转换成GIF(手机,模拟器)
- bootstrap radio
- Alamofire源码解读系列(十)之序列化(ResponseSerialization)
- JSSDK微信分享功能实现,有坑==||
- 都在这儿!最全的北斗厂家企业名单!
- 安卓Mob短信验证
- DOM添加删除元素
- 饿了么项目---7、ref属性注册节点信息,并获取DOM节点(1)