一:怎样判断一个应用程序运行在内存中。
二:在窗口一上点一下按钮后运行另一窗口(窗口一和窗口是两个不同的应用程序),同时窗口一最小化(windowstate:=wsnormal最小化后是停留在屏幕的最下方,我想最小化后停留在桌面工具栏的上面),不知怎样实现。能详细就详细些,谢。
二:在窗口一上点一下按钮后运行另一窗口(窗口一和窗口是两个不同的应用程序),同时窗口一最小化(windowstate:=wsnormal最小化后是停留在屏幕的最下方,我想最小化后停留在桌面工具栏的上面),不知怎样实现。能详细就详细些,谢。
2,Application.Minimize;
最小化后是停留在最下面的,我想让最小化的窗口停留在桌面工具条的上面。
其中,最主要的几条语句有:
fwnd:=FindWindow('SciCalc','计算器');
函数原型为(详见Delphi的帮助):
HWND FindWindow(
LPCTSTR lpClassName, // pointer to class name
LPCTSTR lpWindowName // pointer to window name
);
此处,'SciCalc' 为计算器的类名,'计算器'为计算器的窗口标题}
setWindowPos(fwnd,HWND_NOTOPMOST,0,0,0,0,SWP_SHOWWINDOW or SWP_NOSIZE or SWP_NOMOVE);
函数原型为:
BOOL SetWindowPos(
HWND hWnd, // handle of window
HWND hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
UINT uFlags // window-positioning flags
);
ShowWindow(fwnd,SW_RESTORE); //显示已打开的「计算器」
函数原型为:
BOOL ShowWindow(
HWND hWnd, // handle of window
int nCmdShow // show state of window
);
Ret:=WinExec('c:\windows\calc.exe',SW_SHOWNORMAL); //启动计算器
函数原型为:
UINT WinExec(
LPCSTR lpCmdLine, // address of command line
UINT uCmdShow // window style for new application
);
运行“计算器”程序并检测返回值(从而利用返回值来判断可能发生的错误)上面是我找到的例子希望对你有用
该函数通过指定的类名和窗口名来检索指定的高层窗口句柄,如果检索成功,则返回窗口句柄,否则返回空;另外,需注意改函数不能用于查找子窗口。函数如下:
HWND FindWindow(LPCTSTR lpClassName, //类名指针
LPCTSTR lpWindowName //窗口名指针
);
这个例子也不错