-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to send WM_COPYDATA message with a string #25
Comments
Is it working? rest = user32.sendMessageW(hWnd, 74, 100, Buffer.from([100]))
// or
rest = user32.sendMessageW(hWnd, 74, 100, Buffer.from(['foo\0', 'ucs2'])) |
@waitingsong No ,they doesn't work. |
@TerryChan Would you like to provide the code. |
Here is the code: var { Kernel32, User32 } = require('win32-api')
// import * as ref from 'ref-napi'
const knl32 = Kernel32.load()
const user32 = User32.load() // load all apis defined in lib/{dll}/api from user32.dll
const title = 'WindowsDesktop\0' // null-terminated string
const lpszWindow = Buffer.from(title, 'ucs2')
const hWnd = user32.FindWindowExW(0, 0, null, lpszWindow)
if (typeof hWnd === 'number' && hWnd > 0
|| typeof hWnd === 'bigint' && hWnd > 0
|| typeof hWnd === 'string' && hWnd.length > 0
) {
console.log('window handle: ', hWnd)
// Send WM_QUIT message, success
// res = user32.SendMessageW(hWnd, 2, 0, 0)
// Send WM_COMMAND message, success
res = user32.SendMessageW(hWnd, 273, 1000, 3)
console.log('WM_COMMAND', res)
// send WM_COPYDATA (74) message, fail
res = user32.PostMessageW(hWnd, 74, 100, 100)
// rest = user32.SendMessageW(hWnd, 74, 100, Buffer.from([100]))
// rest = user32.SendMessageW(hWnd, 74, 100, Buffer.from(['foo\0', 'ucs2']))
// res = user32.PostMessageW(hWnd, 74, 100, 100)
console.log('WM_COPYDATA', res)
} |
pls try this demo with version |
Is there any way to receive WM_COPYDATA?
only sth like
How to get the data from WM_COPYDATA? |
|
With node-win32-api, I tried to send a WM_COPYDATA message to another win32 application with window, but it failed, the win32 application didn't receive the messsage. But when I send WM_QUIT and WM_COMMAND mesage, it worked very well
And when I used another win32 applciation to send the WM_COPYDATA message, it can received the message and the string
send WM_COPYDATA :
received the message:
Do you know how to send WM_COPYDATA with a string by node-win32-api?
Or do you know is there any other method that I can send a string to another win32 application in NodeJS?
Thank you in advance.
The text was updated successfully, but these errors were encountered: