Hello everybody,
I've tryed to use an interprocess communication via
SendMessage on Windows.
Unfortunately, nothing goes on
############### ############### ############### ############### #############
#! /usr/bin/env python
import win32api, win32ui, win32con
import struct, array
"""
typedef struct tagCOPYDATASTRU CT { // cds
DWORD dwData;
DWORD cbData;
PVOID lpData;
} COPYDATASTRUCT;
"""
def packCopyData(nN um, sString):
int_buffer = array.array("L" ,[nNum])
char_buffer = array.array('c' , sString)
int_buffer_addr ess = int_buffer.buff er_info()[0]
char_buffer_add ress = char_buffer.buf fer_info()[0]
char_buffer_siz e = char_buffer.buf fer_info()[1]
copy_struct = struct.pack("pL p", # dword*, dword, char*
int_buffer_addr ess,
char_buffer_siz e,
char_buffer)
return copy_struct
# get the window handle
hwnd = win32ui.FindWin dow(None, "special window")
# print just for fun
print hwnd
cds = packCopyData(1, '1')
print cds
# try to send it a message
win32api.SendMe ssage(hwnd,
win32con.WM_COP YDATA,
0,
cds)
############### ############### ############### ############### #############
The last parameter shut be an integer, but I think it must be a pointer ?
Any experience or a tip for me ?
gf
I've tryed to use an interprocess communication via
SendMessage on Windows.
Unfortunately, nothing goes on
############### ############### ############### ############### #############
#! /usr/bin/env python
import win32api, win32ui, win32con
import struct, array
"""
typedef struct tagCOPYDATASTRU CT { // cds
DWORD dwData;
DWORD cbData;
PVOID lpData;
} COPYDATASTRUCT;
"""
def packCopyData(nN um, sString):
int_buffer = array.array("L" ,[nNum])
char_buffer = array.array('c' , sString)
int_buffer_addr ess = int_buffer.buff er_info()[0]
char_buffer_add ress = char_buffer.buf fer_info()[0]
char_buffer_siz e = char_buffer.buf fer_info()[1]
copy_struct = struct.pack("pL p", # dword*, dword, char*
int_buffer_addr ess,
char_buffer_siz e,
char_buffer)
return copy_struct
# get the window handle
hwnd = win32ui.FindWin dow(None, "special window")
# print just for fun
print hwnd
cds = packCopyData(1, '1')
print cds
# try to send it a message
win32api.SendMe ssage(hwnd,
win32con.WM_COP YDATA,
0,
cds)
############### ############### ############### ############### #############
The last parameter shut be an integer, but I think it must be a pointer ?
Any experience or a tip for me ?
gf
Comment