一个应用程序对另一个应用程序做这些操作有什么办法吗

jett 2002-01-16 03:45:57
1,返回另一应用程序是否已运行
2,对另一应用程序的窗口做一些操作(比如最大化,用SetWindowPos置于最顶部)
3,关闭正在运行中的另一应用程序
1,估计不难,2和3是否可行呢
...全文
110 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
jett 2002-01-17
  • 打赏
  • 举报
回复
to lx_king(天剑)
例子已收到,等我先调试,过回再结贴
lx_king 2002-01-17
  • 打赏
  • 举报
回复
标题都不知道??

那你就 用EnumWindows列出所有的窗体名称判断吧

给你个例子 看看吧
jett 2002-01-17
  • 打赏
  • 举报
回复
to lx_king(天剑) 
因为我不一定知道另一个应用程序的类是什么,所以光有findwindow不行
不过还是谢谢你
jett 2002-01-17
  • 打赏
  • 举报
回复
to Bardo(巴顿)
谢谢,最好是有例子了
jetying29@sina.com
lx_king 2002-01-17
  • 打赏
  • 举报
回复
不好 意思 错了

应该是

Dim hnd As Long
hnd=findwindow(vbNullString,"另一个程序的窗体标题")
lx_king 2002-01-17
  • 打赏
  • 举报
回复
HWND FindWindow(

LPCTSTR lpClassName, // pointer to class name
LPCTSTR lpWindowName // pointer to window name
);


Parameters

lpClassName

Points to a null-terminated string that specifies the class name or is an atom that identifies the class-name string. If this parameter is an atom, it must be a global atom created by a previous call to the GlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word of lpClassName; the high-order word must be zero.

lpWindowName

Points to a null-terminated string that specifies the window name (the window's title). If this parameter is NULL, all window names match.



Return Values

If the function succeeds, the return value is the handle to the window that has the specified class name and window name.
If the function fails, the return value is NULL. To get extended error information, call GetLastError
.

See Also

EnumWindows, FindWindowEx, GetClassName, GlobalAddAtom


这样找

dim hnd as long
hnd=findwindow(0,"另一个程序的窗体标题")
这就可以了
Bardo 2002-01-17
  • 打赏
  • 举报
回复
这类操作操作虽不是很难,但也要对系统编程熟悉。
我这里有一个类似于SpyXX的例子,是源于《VB6编程高手》
如需要可以发给你!
jett 2002-01-17
  • 打赏
  • 举报
回复
只要回答出问题,分数还会加
jett 2002-01-16
  • 打赏
  • 举报
回复
我的意思是说不一定能让另一应用程序返回hwnd,必须要由原来的那个应用程序想办法去取
jett 2002-01-16
  • 打赏
  • 举报
回复
看了
但有时候我并不一定能得到hwnd
wqb 2002-01-16
  • 打赏
  • 举报
回复
http://www.csdn.net/expert/Topic/477/477918.shtm

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧