惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

博客园 - 古代

linux下关于重命名卷标 wget header参数使用。 - 古代 - 博客园 奔波尔霸温瑞安 方娥真〈月台〉析论 入凡尘十二年的方娥真 模拟兼容onmouseleave,onmouseenter - 古代 - 博客园 parse_url 和再pathinfo,what you'll get - 古代 autopos php转换拼音,全。 RPM 安装mod_encoding,linux下apache支持中文名 自动杀死pps的后台进程 js表达式转义 - 古代 - 博客园 批量jstest get_top_dom($dom); - 古代 - 博客园 rm大量文件 Read-only file system处理记录 通过PHP获取生僻字的汉语拼音[转] 唉,这个备案,头疼. 神奇的js代码,图片全都飞起来了
python 进程通信测试代码(程序A,程序B)
古代 · 2010-08-20 · via 博客园 - 古代

http://old.nabble.com/-CPyUG--Python-%E5%92%8C-MFC%E7%A8%8B%E5%BA%8F-%E9%80%9A%E4%BF%A1%E7%9A%84%E9%97%AE%E9%A2%98-(%E8%AF%B7%E6%95%99Windows%E6%B6%88%E6%81%AF%E6%9C%BA%E5%88%B6%E9%AB%98%E6%89%8B)-td28851695.html

发送端程序A

#encoding=gbk
import wx

import win32con
import win32api
import win32gui
import os
import sys

   
#win32con.WM_USER+


class MyFrame(wx.Frame):
    def __init__(self, parent=None):
        wx.Frame.__init__(self, parent, -1, "testFind")
        wx.Panel(self)
        #hWnd = win32gui.FindWindow(None, "MSGWIN")
        hWnd = win32gui.FindWindow(None, "MSGWIN")
        if hWnd <> 0:
            print hWnd
            ret=win32gui.PostMessage(hWnd, win32con.WM_USER+779, 266,0)
            #ret=win32gui.SendMessage(hWnd, win32con.WM_CLOSE, 0,0)
            print ret
            print 'END'
            self.Destroy()

if __name__ == '__main__':
   app = wx.PySimpleApp()
   frame = MyFrame()
   app.SetTopWindow(frame)
   frame.Show()
   app.MainLoop()

def f_put(f,data,mode='wb'):
    try:
        fx = open(f,mode)
        fx.write(data)
        fx.close()
        return True
    except Exception,e:
        return False

#f_put("f:\\whois.txt",response)


"""
hWnd = win32gui.FindWindow(None, "FrameEvent")
print hWnd
if hWnd <> 0:
    win32api.SendMessage(hWnd , 300 , 300, 300)
    pass

    point = (555, 175)
    x, y = point
    win32api.SetCursorPos(point)

    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x, y, 0, 0)
    win32api.SetCursorPos(point)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)

    #ctrl + A
    win32api.SendMessage(hWnd, 0, win32con.VK_CONTROL, 0)
    win32api.Sleep(10)
    win32api.SendMessage(hWnd, 0, 65, 0)
    win32api.SendMessage(hWnd, win32con.KEYEVENTF_KEYUP, 65, 0)
    win32api.SendMessage(hWnd, win32con.KEYEVENTF_KEYUP, win32con.VK_CONTROL, 0)
    win32api.Sleep(10)

    #ctrl + C
    win32api.SendMessage(hWnd, win32con.WM_KEYDOWN, win32con.VK_CONTROL, 0)
    win32api.Sleep(10)
    win32api.SendMessage(hWnd, win32con.WM_KEYDOWN, 67, 0)
    win32api.SendMessage(hWnd, win32con.WM_KEYUP, 67, 0)
    win32api.SendMessage(hWnd, win32con.WM_KEYUP, win32con.VK_CONTROL, 0)
    win32api.Sleep(10)


"""

 接收端,程序B

import win32gui
import win32con
import win32api

import wx

class ListenWindow:
    def __init__(self,parent):
        wc = win32gui.WNDCLASS()
        hinst = wc.hInstance = win32gui.GetModuleHandle(None)
        self.message_map={
                win32con.WM_DESTROY:self.OnDestroy,
                win32con.WM_USER+779:self.OnMyMessage,
        }
        self.parent=parent
        wc.lpszClassName = "Spark"
        wc.lpfnWndProc = self.message_map
        classAtom = win32gui.RegisterClass(wc)

        style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
        self.hwnd = win32gui.CreateWindow( "Spark", "MSGWIN", style,
                        0, 0, win32con.CW_USEDEFAULT,win32con.CW_USEDEFAULT,
                        0, 0, hinst, None)

    def OnDestroy(self, hwnd, msg, wparam, lparam):
        print "OnDestroy"
        return 0

    def OnMyMessage(self, hwnd, msg, wparam, lparam):
        print wparam
        self.parent.OnMyMessage(wparam, lparam)
        print "I get it"
        return 0

class MyFrame(wx.Frame):
    def __init__(self, parent=None):
        wx.Frame.__init__(self, parent, -1, "Demo")
        listener = ListenWindow(self)
        self.listener = listener
        wx.Panel(self)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        #win32gui.SendMessage(self.listener.hwnd, win32con.WM_USER+779, 0, 0)

        wc = win32gui.WNDCLASS()
        self.message_map={
                win32con.WM_DESTROY:self.OnClose,
                win32con.WM_USER+779:self.OnMyMessage,
        }
        wc.lpszClassName = "DemoWND"
        wc.lpfnWndProc = self.message_map
        classAtom = win32gui.RegisterClass(wc)
  

    def OnMyMessage(self,wparam,lparam):
        print  'Frame'
        print wparam
        print  'End'
       
    def OnClose(self, evt):
        win32gui.SendMessage(self.listener.hwnd, win32con.WM_CLOSE, 0, 0)
        self.Destroy()

if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = MyFrame()
    app.SetTopWindow(frame)
    frame.Show()
    app.MainLoop()