Convertion

Signaler
-
 fabiin -
Salut, comment mettre ce code vb pour delphi :
svp aidez moi!!!!!

Public Function GetUser() As String
Dim aol As Long, mdi As Long, welcome As Long
Dim child As Long, UserString As String, UserString1 As String
aol& = FindWindow("AOL Frame25", vbNullString)
mdi& = FindWindowEx(aol&, 0&, "MDIClient", vbNullString)
child& = FindWindowEx(mdi&, 0&, "AOL Child", vbNullString)
UserString$ = getcaption(child&)
If InStr(UserString$, " Bienvenue, ") = 1 Then
UserString$ = Mid$(UserString$, 13, (InStr(UserString$, "!") - 13))
Exit Function
Else
Do
child& = FindWindowEx(mdi&, child&, "AOL Child", vbNullString)
UserString$ = getcaption(child&)
If InStr(UserString$, " Bienvenue, ") = 1 Then
UserString$ = Mid$(UserString$, 13, (InStr(UserString$, "!") - 13))
GetUser6$ = UserString$
Exit Function
End If
Loop Until child& = 0&
End If
GetUser$ = ""
End Function

1 réponse

ben,...comme on peu pas essayén je garanti pas ke ca marche, je suis meme sur ke ca marche pas ;)
mais essay ca :

Function GetUser():String
var
aol:integer;
mdi:integer;
welcome:integer;
child:integer;
UserString:String;
UserString1:String;

begin
aol:=FindWindow('AOL Frame25', '');
mdi:=FindWindowEx(aol, 0, 'MDIClient', '');
child = FindWindowEx(mdi, 0, 'AOL Child', '');
UserString = getcaption(child);

If InStr(1,UserString, ' Bienvenue, ') = 1 Then begin
UserString = Mid(UserString, 13, (InStr(1,UserString, '!') - 13));
Exit;
Else
while child<>0
child = FindWindowEx(mdi, child, 'AOL Child', '');
UserString = getcaption(child);
If InStr(1,UserString, ' Bienvenue, ') = 1 Then begin
UserString = Mid(UserString, 13, (InStr(1,UserString, '!') - 13));
GetUser6 = UserString;
Exit;
End;
wend
End;
GetUser = ''
End;

function InStr(sStart: integer; const sData: string; const
sFind: string): integer;
var
  c: integer;
label
  SkipFind;
begin
  c := sStart - 1;
  repeat
    if c > length(sData) then
    begin
      c := 0;
      goto SkipFind;
    end;
    inc(c);
  until copy(sData, c, length(sFind)) = sFind;
SkipFind:
  Result := c;
end;

function mid(const sData: string; nStart: integer;
nLength: integer): string; overload;
begin
  Result := copy(sData, nStart, nLength);
end;
function mid(const sData: string; nStart: integer): string;
overload;
begin
  Result := copy(sData, nStart, Length(sData) - (nStart - 1));
end;

la dedans y'a aussi les fonctions instr et mid necessaires

@+
Fabs|8D]
12waresoft
Vague Sonore