Bonjour,

dans mes applications, pour afficher du texte dans NotePad, j'utilise CreateProcess comme ceci :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ ====================================================================== }
Function TF_Princ.LanceNotePad(Fichier : String): dword;
// Lancement de Notepad avec CreateProcess
//  renvoie le Handle du process
//  il faut ajouter la déclaration :
//      function GetThreadId(Thread: THandle): dword; stdcall; external 'Kernel32.dll';
var
  StartupInfo: TStartupInfo;
  ProcessInfo: TProcessInformation;
  CommandLine: {$IFDEF UNICODE}WideString{$ELSE}string{$ENDIF};
Begin
  Result := 0 ;
  If not FileExists(Fichier) Then
    Begin
      MessageDlg('Fichier '+Fichier+' introuvable' , mtError, [mbOk], 0) ;
      Exit ;
    End ;
  CommandLine := '"Notepad.exe" "'+Fichier+'"' ;
  ZeroMemory(@StartupInfo, SizeOf(StartupInfo)) ;
  StartupInfo.cb := SizeOf(StartupInfo) ;
  if CreateProcess(nil, PChar(CommandLine), nil, nil, FALSE, 0, nil, nil, StartupInfo, ProcessInfo) then
    Begin
      Result := GetThreadID(ProcessInfo.hThread);
      CloseHandle(ProcessInfo.hProcess);
      CloseHandle(ProcessInfo.hThread);
    End;
End ;
{ ====================================================================== }
Est il possible de donner la position, la taille et le titre du Notepad qui s'ouvre ?

C'est dans StartupInfo ?

Merci
A+
Charly