这里有段代码看对你有无帮助
type
TExecState = (esNormal, esMinimized, esMaximized, esHidden);
const
ShowCommands: array[TExecState] of Integer =
(SW_SHOWNORMAL, SW_MINIMIZE, SW_SHOWMAXIMIZED, SW_HIDE);
function FileExecute(const FileName, Params, StartDir: string;
InitialState: TExecState): THandle;
begin
Result := ShellExecute(Application.Handle, nil, PChar(FileName),
PChar(Params), PChar(StartDir), ShowCommands[InitialState]);
end;
得到记事本句柄
myHWnd:=FindWindow('Notepad',nil);
要向记事本传递字串,还得要枚举出Edit子窗口