马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?站点注册
×
本帖最后由 菜鸟 于 2020-12-5 12:23 编辑
csdn发了一份,不给审核,所以这里再发一份
下面有gif演示;
代码很简单:取聊天窗口句柄,获取文本输入框,填充内容,模拟回车按键触发发送按钮;
- forward
- global type w_demo1 from window
- end type
- type st_4 from statictext within w_demo1
- end type
- type mle_msg from multilineedit within w_demo1
- end type
- type sle_number from singlelineedit within w_demo1
- end type
- type sle_name from singlelineedit within w_demo1
- end type
- type cb_1 from commandbutton within w_demo1
- end type
- type st_3 from statictext within w_demo1
- end type
- type st_2 from statictext within w_demo1
- end type
- type st_1 from statictext within w_demo1
- end type
- end forward
- global type w_demo1 from window
- integer width = 1763
- integer height = 1162
- boolean titlebar = true
- string title = "QQ炸群"
- boolean controlmenu = true
- boolean resizable = true
- long backcolor = 16777215
- string icon = "AppIcon!"
- boolean center = true
- st_4 st_4
- mle_msg mle_msg
- sle_number sle_number
- sle_name sle_name
- cb_1 cb_1
- st_3 st_3
- st_2 st_2
- st_1 st_1
- end type
- global w_demo1 w_demo1
- type prototypes
- function ulong FindWindowA (String lpClassName,String lpWindowName) Library "user32.dll"
- function ulong FindWindowExA( long hParent, long hChildAfter, String lpszClass, String lpszWindow ) Library "user32"
- function ulong SendMessageA(long hwnd,long wMsg,long wParam,long lParam) Library "user32.dll"
- FUNCTION ulong ShowWindow(ulong hWnd,ulong nCmdShow) LIBRARY "user32.dll"
- end prototypes
- on w_demo1.create
- this.st_4=create st_4
- this.mle_msg=create mle_msg
- this.sle_number=create sle_number
- this.sle_name=create sle_name
- this.cb_1=create cb_1
- this.st_3=create st_3
- this.st_2=create st_2
- this.st_1=create st_1
- this.Control[]={this.st_4,&
- this.mle_msg,&
- this.sle_number,&
- this.sle_name,&
- this.cb_1,&
- this.st_3,&
- this.st_2,&
- this.st_1}
- end on
- on w_demo1.destroy
- destroy(this.st_4)
- destroy(this.mle_msg)
- destroy(this.sle_number)
- destroy(this.sle_name)
- destroy(this.cb_1)
- destroy(this.st_3)
- destroy(this.st_2)
- destroy(this.st_1)
- end on
- type st_4 from statictext within w_demo1
- integer x = 33
- integer y = 886
- integer width = 457
- integer height = 74
- integer textsize = -12
- integer weight = 400
- fontcharset fontcharset = ansi!
- fontpitch fontpitch = variable!
- fontfamily fontfamily = swiss!
- string facename = "Arial"
- long textcolor = 33554432
- long backcolor = 16777215
- boolean focusrectangle = false
- end type
- type mle_msg from multilineedit within w_demo1
- integer x = 530
- integer y = 179
- integer width = 1108
- integer height = 461
- integer taborder = 20
- integer textsize = -12
- integer weight = 400
- fontcharset fontcharset = ansi!
- fontpitch fontpitch = variable!
- fontfamily fontfamily = swiss!
- string facename = "Arial"
- long textcolor = 33554432
- boolean hscrollbar = true
- boolean vscrollbar = true
- end type
- type sle_number from singlelineedit within w_demo1
- integer x = 530
- integer y = 694
- integer width = 457
- integer height = 106
- integer taborder = 10
- integer textsize = -12
- integer weight = 400
- fontcharset fontcharset = ansi!
- fontpitch fontpitch = variable!
- fontfamily fontfamily = swiss!
- string facename = "Arial"
- long textcolor = 33554432
- string text = "1"
- end type
- type sle_name from singlelineedit within w_demo1
- integer x = 530
- integer y = 38
- integer width = 1108
- integer height = 106
- integer taborder = 10
- integer textsize = -12
- integer weight = 400
- fontcharset fontcharset = ansi!
- fontpitch fontpitch = variable!
- fontfamily fontfamily = swiss!
- string facename = "Arial"
- long textcolor = 33554432
- end type
- type cb_1 from commandbutton within w_demo1
- integer x = 530
- integer y = 861
- integer width = 457
- integer height = 128
- integer taborder = 10
- integer textsize = -12
- integer weight = 400
- fontcharset fontcharset = ansi!
- fontpitch fontpitch = variable!
- fontfamily fontfamily = swiss!
- string facename = "Arial"
- string text = "QQ发送"
- end type
- event clicked;ULong ll_handle
- string ls_null
- long ll_num
- setNull(ls_null)
- ll_handle = FindWindowA(ls_null,sle_name.text)
- st_4.text = string(ll_handle)
- if ll_handle > 0 then
- ShowWindow(ll_handle, 9)
- for ll_num = 1 to long(sle_number.text)
- // 内容复制剪切板
- clipboard(mle_msg.text)
- //将剪切板中内容填充到窗口中
- SendMessageA(ll_handle, 770, 0, 0)
- //模拟回车
- SendMessageA(ll_handle, 256, 13, 0)
- next
- end if
- end event
- type st_3 from statictext within w_demo1
- integer x = 37
- integer y = 694
- integer width = 457
- integer height = 106
- integer textsize = -12
- integer weight = 400
- fontcharset fontcharset = ansi!
- fontpitch fontpitch = variable!
- fontfamily fontfamily = swiss!
- string facename = "Arial"
- long textcolor = 33554432
- long backcolor = 16777215
- string text = "次数:"
- alignment alignment = right!
- boolean focusrectangle = false
- end type
- type st_2 from statictext within w_demo1
- integer x = 37
- integer y = 42
- integer width = 479
- integer height = 106
- integer textsize = -12
- integer weight = 400
- fontcharset fontcharset = ansi!
- fontpitch fontpitch = variable!
- fontfamily fontfamily = swiss!
- string facename = "Arial"
- long textcolor = 33554432
- long backcolor = 16777215
- string text = "好友名-群名:"
- alignment alignment = right!
- boolean focusrectangle = false
- end type
- type st_1 from statictext within w_demo1
- integer x = 37
- integer y = 176
- integer width = 457
- integer height = 106
- integer textsize = -12
- integer weight = 400
- fontcharset fontcharset = ansi!
- fontpitch fontpitch = variable!
- fontfamily fontfamily = swiss!
- string facename = "Arial"
- long textcolor = 33554432
- long backcolor = 16777215
- string text = "内容:"
- alignment alignment = right!
- boolean focusrectangle = false
- end type
复制代码 |