我编写了一个发送“rapp”Apple 事件的程序。从调试控制台我可以看到目标应用程序接收到事件并且参数看起来不错。但是程序什么也没做
AppleEvent e;
AEBuildError be;
ProcessSerialNumber psn;
OSStatus result = GetProcessForPID(81188, &psn);
result = AEBuildAppleEvent(kCoreEventClass,
kAEReopenApplication,
typeProcessSerialNumber,
&psn,
sizeof(ProcessSerialNumber),
kAutoGenerateReturnID,
kAnyTransactionID,
&e,
&be,
"~'frnt':bool(@)", 0);
if(result == 0) {
result = AESendMessage(&e, NULL, kAENoReply, 0);
int x=0;
}
这是确保收到事件的控制台输出
------oo start of event oo------
aevt('aevt'\'rapp' transactionID=0 sourcePSN=[0x0,d72d72 "smart_back_test_app"] timeout=0 eventSource=3 sourceUID=1992786101 sourceGID=593637566 sourceEUID=1992786101 sourceEGID=593637566 sourcePID=81994 auditToken=[1992786101,1992786101,593637566,1992786101,593637566,81994,100005,81994]{ ~'frnt':bool(0) })
------oo end of event oo------
我究竟做错了什么?