postmessage

cannot trigger the textchanged event while using sendmessage and WM_SETTEXT but PostMessage can

删除回忆录丶 提交于 2019-12-13 06:28:55
问题 I have a problem similar to this but I still cannot solve it. I am trying to edit a textbox for contrast and another for brightness inside an image viewer program from my wpf program. Changing the values inside these two textbox will trigger the change of the image right away. Using Spy++ allows me to get the exact window handle for both of those textbox and I've tried these following methods but still can't get what I need from my C# program. Method 1: This method allows me to change the

Firefox - Javascript - window.event not surviving pass to context.apply()

北城以北 提交于 2019-12-13 05:24:34
问题 - This is the original question for posterity - I'm having a bit of trouble with a new piece of code I wrote. I'm trying to find the iframe the window that sent a message lives in, assuming it's from an iframe at all. The relevant code: var getContainingFrame = function(source){ var frames = document.getElementsByTagName('iframe'); for (var i = 0; i < frames.length; ++i) { if (frames[i].contentWindow === source) { return frames[i]; } } return false; } var postMessageReceivedCallback =

postMessage not being received from iframe

旧巷老猫 提交于 2019-12-13 04:49:59
问题 Here is the code in the iframe with src="example.com" <script> var domain = "http://example2.com"; function redirectRequest(){ console.log("window.opener",window.opener); // NULL console.log("window.top",window.top); // script_name console.log("window.parent",window.parent); // script_name opener.postMessage("redirect", domain); //fails because null //top and parent also do not work BUT do not display errors } </script> and here is the code running in example2.com which contains the

How to send object instances to WndProc

ぐ巨炮叔叔 提交于 2019-12-13 04:02:52
问题 I'm using my custom class that describes some states and values: class MyClass { int State; String Message; IList<string> Values; } Because of application architecture, for forms interaction is used messages and its infrastructure (SendMessage/PostMessage, WndProc). The question is - how, using SendMessage/PostMessage, to send an instance of MyClass to WndProc? In my code PostMessage is defined next way: [DllImport("user32.dll", SetLastError = true)] public static extern bool PostMessage

How to post Extended ASCII chars (0x80 to 0xFF) using PostMessage in Delphi?

倖福魔咒の 提交于 2019-12-12 17:50:41
问题 I am writing a Keyboard Mapper Application in which I need to send Extended ASCII chars (0x80 to 0xFF) to Current Window. I have tried everything like below function ConstructLParam(vKey: Word): LongInt; // Cardinal; begin { ConstructLParam } if vKey > $FF then Result := LongInt(MapVirtualKeyW(vKey, 0) and $00000FFF or $F000) shl 16 or 1 else Result := LongInt(MapVirtualKey(vKey, 0) and $000000FF or $FF00) shl 16 or 1; end; { ConstructLParam } procedure PostCharacter(TargetWinHandle: Hwnd;

PostMessage unable to pass a string C#

不羁岁月 提交于 2019-12-12 12:30:43
问题 Here is my prototype: [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern bool PostMessage(int hhwnd, uint msg, IntPtr wparam, IntPtr lparam); And here is how I'm using it: PostMessage(HWND_BROADCAST, msg, Marshal.StringToHGlobalAuto("bob"), IntPtr.Zero); In a different thread I can intercept this message, but when I try to get bob back using: string str = Marshal.PtrToStringAuto(m.WParam); // where m = the Message object I don't get bob in str. I'm thinking this has got to

Can I do synchronous cross-domain communicating with window.postMessage?

偶尔善良 提交于 2019-12-12 08:54:16
问题 I'm thinking of using window.postMessage directly for cross-domain communication. If I do: postMessage() from the parent frame Load an iframe window.addEventListener("message", callback, false); from the child iframe When will the messages I posted before loading the iframe be executed? Are they guaranteed to be executed at all? Are there timing guarantees? I would like to pass a parameter from the top frame that influences the initialization of the child frame. 回答1: The postMessage()

window.postMessage from web_accessible_resource to content script

廉价感情. 提交于 2019-12-12 01:28:16
问题 i try to post a message from a web_accessible_resource to a content-script of my chrome extension. My Setup: parts of my manifest.json: "content_scripts": [{ "matches": ["http://*/*"], "js": ["content.js"] }], "web_accessible_resources": ["run.js"] content.js // this listener is never triggered ;-( chrome.extension.onMessage.addListener(function(request, sender, sendResponse) { if (request.type === 'foo') { // do whatever i want if request.type is foo } }); run.js window.postMessage({type:

Bypassing a blocked frame with origin from accessing a cross-origin frame with postMessage()

試著忘記壹切 提交于 2019-12-11 15:30:01
问题 I've heard that you can bypass a "blocked a frame with origin from accessing a cross-origin frame" with postMessage() and I've been trying to use it, but it's not working properly. What am I doing wrong? <iframe src="www.example.com" id = "theID"></iframe> document.getElementById('theID').contentWindow.postMessage({ document.querySelector("input[value='true']").click(); }); 回答1: You can use your server as a proxy. Assuming that you intend to load page XYZ inside the iframe, you can create an

C++ Handle as HWND?

淺唱寂寞╮ 提交于 2019-12-11 14:49:58
问题 I was wondering whether you can convert a handle to a window "HWND". I need to call the "PostMessage" function using the "FindWindow" method. I currently have to source HANDLE mainProcess; BOOL APIENTRY ATTACH_PROCESS(int ProcessID) { mainProcess = OpenProcess(PROCESS_ALL_ACCESS, true, ProcessID); return TRUE; } BOOL APIENTRY SEND_INPUT(/*NOT USED FOR THIS SAMPLE*/ const char* String, bool Keydown) { int ToDo = WM_KEYUP; if (Keydown) ToDo = WM_KEYDOWN; return PostMessage((HWND)mainProcess,