postmessage

MFC自定义消息

雨燕双飞 提交于 2019-12-09 19:29:21
扩展 https://www.cnblogs.com/findumars/p/3948427.html 定义消息或资源中添加 #define WM_MYMESSAGE_XYG (WM_USER + 7943) 头文件中添加消息处理函数 class CVMDSModelView { protected: ... afx_msg LRESULT OnMyMessage(WPARAM wParam, LPARAM lParam); ... DECLARE_MESSAGE_MAP() cpp中添加消息映射处理 BEGIN_MESSAGE_MAP(CVMDSModelView, CScrollView) ON_MESSAGE(WM_MYMESSAGE_XYG, OnMyMessage) END_MESSAGE_MAP() 实现消息处理函数 其中WPARAM wParam,LPARAM lParam二者为指针,所以发送自定义消息时如果想传相关参数,可以将参数的地址赋给这2个参数之一即可 LRESULT CVMDSModelView::OnMyMessage(WPARAM wParam, LPARAM lParam) { AfxMessageBox(_T("自定义消息!")); return 0; } 自定义消息触发 PostMessage()与SendMessage()函数的区别是

How to send keydown event to inactive window in C++?

不打扰是莪最后的温柔 提交于 2019-12-09 07:37:26
[C++] How to send keydown event to inactive window? TAB key works fine. But I'm having trouble with other keys such as "Z". Been googling this for a while but haven't found a solution so far. Virtual key 0x5A should be the correct for letter Z. #include <iostream> #include <Windows.h> #include <string> LPCSTR Target_window_Name = "Untitled - Notepad"; //<- Has to match window name HWND hWindowHandle = FindWindow(NULL,Target_window_Name); int main() { //send TAB DOWN - WORKS FINE SendMessage(hWindowHandle,WM_KEYDOWN,0x09,0); //send TAB DOWN SendMessage(hWindowHandle,WM_KEYUP,0x09,0); //send Z

communication between browser tab

僤鯓⒐⒋嵵緔 提交于 2019-12-09 06:13:54
问题 i've an html page (main.html) opening a new tab in the same domain using javascript with window.open("newtab.html") method. In the new tab users do something ending his activity clicking a button. At this point I would like to send a message to the opener window. I tried with postMessage but from new tab I can't have a reference to the opener. From new tab I'd like something like but I've "ko" var w = window.opener; if (w) { w.postMessage("hi", "http://10.150.10.43"); } else { alert("ko"); }

PostMessage in service applications

╄→гoц情女王★ 提交于 2019-12-09 04:36:29
There is a problem I am unable to solve. I created two service applications in Delphi and tried to post messages within them. Of course, there are no windows in such applications and PostMessage needs a window handle parameter to send a message. Therefore, I created a window handle using the AllocateHWnd(MyMethod: TWndMethod) function and passed, as the 'MyMethod' parameter, a procedure I want to be called when a message is received. If it was a windowed application, PostMessage() called using the handle returned by the AllocateHWnd method would certainly send a message that would then be

Sending Keystroke to another application using WinAPI

核能气质少年 提交于 2019-12-09 04:27:20
问题 I have to control another application by sending keystrokes to it like CTRL S or CTRL SHIFT C or CTRL F . I've tried a lot of things, but I can't get it working. So I'm trying to get this right on a simpler case. This successfully sends Hey to the notepad: procedure TForm1.Button1Click(Sender: TObject); var notepad, edit: HWND; begin notepad := FindWindow('notepad', nil); edit := FindWindowEx(notepad, FindWindow('Edit', nil), nil, nil); SendMessage(edit, WM_CHAR, dword('H'), 0); SendMessage

Specifying multiple targetOrigin uris in postmessage

血红的双手。 提交于 2019-12-08 19:46:24
问题 Window.postMessage() has a targetOrigin parameter that can be set to a URI (to ensure the message reaches only a specific url). It can also be set to * of course (not recommended), but is there a way to specify multiple URIs as allowed? At present I'm simply firing off one postMessage() call for each domain, but this seems a bit hacky to say the least. 回答1: Unfortunately you can't. You should either provide "*" or single specified domain. 来源: https://stackoverflow.com/questions/35939798

Chrome ServiceWorker postMessage

白昼怎懂夜的黑 提交于 2019-12-08 19:26:04
问题 I try to postMessage between a WebApp and the corresponding ServiceWorker. The serviceWoker is successfully registered and working so far. Unfortunately I noticed some strange behavior: 1. The navigator.serviceWorker.controller is always null. 2. At the serviceWorker side I implemented postMessage this way: self.addEventListener('message', function (evt) { console.log('postMessage received', evt); }); Unfortunately the important field to post back to origin evt.origin=““ and evt.source=null

window.postMessage between iframe and its parent with Angular: does anyone have a working example?

ⅰ亾dé卋堺 提交于 2019-12-08 16:51:22
问题 Does anyone have a working example of how to send and receive window.postMessage() calls in angular? I found the ng-post-message module on github and ngmodules, but I look at that code and it doesn't make a whole lot of sense to me and the documentation is lacking a working example. Edit: to add my failed attempt The view <div simulation-host element="thing in things"></div> </div> <div id="debugConsole"> <h1>MESSAGE CONSOLE</h1> <p id="debugText"></p> </div> The model $scope.things = [ {

How to add multiple events for “input” in post messages

痞子三分冷 提交于 2019-12-08 13:48:43
问题 I have simple input and HTML5 video player with iframe, I want to add multiple events to input with post message. Problem. I want on input focus event it should play video1 if user delay typing it should play video 2 if the user is still delaying it should play video 3. Assume user start typing then it should play video 4 so this will be on keyup event. so here is my solution I have so far . HTML formpage.html: <div class="main-container"> <iframe id="videoframe" src="videoframe.html"><

window.postMessage - difficulties to make it work

纵然是瞬间 提交于 2019-12-08 12:18:56
问题 I try to establish communication from PayPal Ipn.php script (when "Completed" message is received - that part is tested and works well), and the original page of Form that contains a submit button. The idea is to have the submit button clicked. The 2 pages are on same domain using the same protocol. Here is my script on Ipn.php script: $click = "<script> window.postMessage('Completed', 'http://www.example.com'); </script>"; echo $click; echo "test"; // I receive it. After further testing the