Xlib XSENDEVENT在其他应用程序/过程中
XLib XSendEvent on other applications/process
我有两个库:ida和xida。
XIDA处理事件循环,并且每个应用程序/过程都有一个单个事件循环。这些库是通过回调函数"连接"的。
这正在与一个单个应用程序/过程中的事件一起使用...
现在,我注意到我可以将事件从一个应用发送到另一个应用程序。它需要的是另一个应用程序中的窗口句柄。因此,我编码了DBUS消息,我可以收到一个...
这也可以正常工作,但是看起来Xsendevent((的接收器只能使用函数及其参数,而没有成员变量!
在HPP中:
Window mSection;
Window Section(){
return 0; // This is working
}
Window Section_A(){
return this->mSection; // This raises a memory access error
}
int CheckEvents( IDA_A *vIDA_A, XEvent vEvent);
static int Section_EventCallback(void* this_ptr, XEvent vEvent){
IDA_A* nIDA_A = NULL;
int nRet = 1;
try{
nIDA_A = static_cast < IDA_A* > (this_ptr);
} catch (...) { return 0; }
cout << "TEST " << nIDA_A->Section() << endl; // This is working, also with any other function
cout << "TEST " << nIDA_A->mSection << endl; // This raises a memory access error, also with any other member variable
cout << "TEST " << nIDA_A->Section_A() << endl; // This also raises a memory access error
nRet = nIDA_A->CheckEvents(nIDA_A, vEvent);
nIDA_A = NULL;
return nRet;
}
在CPP中:
int IDA_A::CheckEvents(IDA_A *vIDA_A, XEvent vEvent) {
Window nWindow = vEvent.xany.window;
cout << "TEST " << " -- " << nWindow << endl; // This is working
cout << "TEST " << " -- " << this->mSection << endl; // This raises a memory access error
return 1;
}
它还需要使用成员变量什么?
问候
早期咬合
----------------------------------编辑:--------------------------------------------------------
这是XIDA的一部分,其中Xsendevents((到达(从事件循环中呼叫后(:
int XIDA_A::Send_To_Callback(XEvent vEvent){
for(int i = 0; i < (int) this->mVecEvCallback.size(); i++){
if( *this->mVecEvCallback[i].pWindow == vEvent.xany.window ){
if( vEvent.type == ClientMessage ) {
cout << "THIS XIDA CLIENT " << this->mIdent << endl;
}
s_EventCallback nEvCallback;
nEvCallback = this->mVecEvCallback[i];
nEvCallback.Callback (nEvCallback.this_Ptr, vEvent);
return 1;
}
}
return 0;
}
,为此,它正在起作用,也可以进行成员变量。但是在艾达(Ida但这是相同的过程!
以及例如使用DBU,它正在工作...
我真的很想知道原因!
已解决。
我发现错误...
这个
cIDAMessage nMsg;
nMsg.Msg_Type = IDAMsg_EventCallback;
nMsg.Lng_Send[0] = 0;
nMsg.Para_Void[0] = (void*) &this->mSection;
nMsg.Para_ThisPtr = (void*) this;
nMsg.Para_CallbackPtr = (void*) &this->Section_EventCallback;
this->XIDA_Callback(this->mXIDA_A_Ptr, &nMsg);
是初始化的一部分。
我忘记了设置
nMsg.Para_ThisPtr = (void*) this;
但是我仍然不明白...
static int Section_EventCallback(void* this_ptr, XEvent vEvent){
IDA_A* nIDA_A = NULL;
int nRet = 1;
try{
nIDA_A = static_cast < IDA_A* > (this_ptr);
} catch (...) { return 0; }
nRet = nIDA_A->CheckEvents(nIDA_A, vEvent);
nIDA_A = NULL;
return nRet;
}
这里是/带有null的指针。
nida_a为什么不null,或者为什么没有引起错误,因为static_cast不能用null施放?
为什么功能工作,但不起作用?
你知道我的意思吗?
相关文章:
- 在C应用程序中运行C++(带有STL)函数
- WM_CTLCOLORSTATIC从未在WIN32应用程序中触发
- PC中的程序和PHONE中的本机描述应用程序之间的数据连接
- 为什么导入Mixed native/CLR lib.dll的本机C++应用程序没有在Mixed lib.dll中的外部变
- 如何在 64 位 vb.net Windows 应用程序中引用 32 位 dll
- 我可以在 iOS 或 mac 应用程序中使用C++代码吗?
- 如何在qt中同步应用程序和显示器的刷新率?
- 在信号处理程序中捕获C++未处理的异常并恢复应用程序
- "string.h"在构建适用于iOS的qt应用程序中找不到消息
- 在不使用系统的情况下从C++应用程序格式化 Linux 中的 SD 卡
- Windows 中应用程序的每秒输入/输出操作数
- C#类过程 - 控制C 应用程序,不可能读取输出
- Xlib XSENDEVENT在其他应用程序/过程中
- 如何创建一个新过程,而没有从管理模式运行的MFC应用程序中的管理特权
- 应用程序停滞在构建/运行过程中
- C++Qt在单独的过程中运行应用程序的各个部分
- 调用指向windows过程中C函数的函数的成员指针会导致应用程序崩溃
- 在c++遗留应用程序中重构god类的过程或步骤
- 如果WinRT应用程序在文件复制过程中终止,会发生什么
- 在构造过程中应用type_id运算符