Autor Beitrag
Dezipaitor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 220



BeitragVerfasst: Mi 26.03.08 01:21 
Hi,

ich suche eine Möglichkeit das Bild der Benutzers zu ermitteln, dass er beim EasyLogin (FUS) sehen kann. Bei Vista sieht man das Bild auch halb über dem geöffneten Starmenü. Die Standardbilder sind z.b. Katze und Schachfigur.

Weiß das jemand?

thx

CROSS

_________________
Windows, Tokens, Access Control List, Dateisicherheit, Desktop, Vista Elevation?
Goto: blog.delphi-jedi.net = JEDI API LIB & Windows Security Code Library (JWSCL)
.#R4id
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90

Windows XP Prof.
CodeGear Delphi 2007
BeitragVerfasst: Mi 26.03.08 03:24 
Hi user profile iconDezipaitor :wave:

ausblenden Delphi-Quelltext
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:
29:
30:
function TForm1.GetUserName(): string;
var
  Buffer: array [0..MAX_COMPUTERNAME_LENGTH + 1of Char;
  Size: DWord;
begin
  Size := Pred(SizeOf(Buffer));
  Windows.GetUserName(Buffer, Size);
  Result := StrPas(Buffer);
end;

function TForm1.GetUserPicture(): TBitmap;
var
  CommonDataPath, UserName: string;
begin
  Result := TBitmap.Create;

  UserName := GetUserName;
  CommonDataPath := 'C:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Microsoft\User Account Pictures\' + UserName + '.bmp';

  if FileExists(CommonDataPath) then
  begin
    Result.Handle := LoadImage(0, PChar(CommonDataPath), IMAGE_BITMAP, 00, LR_LOADFROMFILE);
  end
  else ShowMessage(Format('%s'#13#10'"%s"', ['File not found:', CommonDataPath]));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Image1.Picture.Bitmap := GetUserPicture;
end;

_________________
ausblenden Delphi-Quelltext
1:
if CopyAndPaste not avaible then Developer := Helpless;					
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 26.03.08 09:27 
ja vielleicht sollte man aber den Pfad nicht hardcoden, damit das dann auch unter Vista läuft :roll:

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Dezipaitor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 220



BeitragVerfasst: Mi 26.03.08 13:27 
Danke für den Aufwand.
Leider gibt es den Pfad (wenn Virtualisierung aus) und diese Datei (wenn Virtualisierung an) unter Vista nicht.

_________________
Windows, Tokens, Access Control List, Dateisicherheit, Desktop, Vista Elevation?
Goto: blog.delphi-jedi.net = JEDI API LIB & Windows Security Code Library (JWSCL)
.#R4id
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90

Windows XP Prof.
CodeGear Delphi 2007
BeitragVerfasst: Mi 26.03.08 13:47 
Tut mir wirklich leid, aber ich habe nur Windows XP, deshalb kann ich dir leider nicht sagen, wo bei Vista diese Datei liegt. :(

_________________
ausblenden Delphi-Quelltext
1:
if CopyAndPaste not avaible then Developer := Helpless;					
.#R4id
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90

Windows XP Prof.
CodeGear Delphi 2007
BeitragVerfasst: Mi 26.03.08 13:56 
Du könntest es aber so versuchen:

:arrow: TJvComputerInfoEx auf die Form

und dann:

ausblenden Delphi-Quelltext
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:
29:
30:
function TForm1.GetUserName(): string;
var
  Buffer: array [0..MAX_COMPUTERNAME_LENGTH + 1of Char;
  Size: DWord;
begin
  Size := Pred(SizeOf(Buffer));
  Windows.GetUserName(Buffer, Size);
  Result := StrPas(Buffer);
end;

function TForm1.GetUserPicture(): TBitmap;
var
  CommonDataPath, UserName: string;
begin
  Result := TBitmap.Create;

  UserName := GetUserName;
  CommonDataPath := JvComputerInfoEx1.Folders.CommonAppData + '\Microsoft\User Account Pictures\' + UserName + '.bmp';

  if FileExists(CommonDataPath) then
  begin
    Result.Handle := LoadImage(0, PChar(CommonDataPath), IMAGE_BITMAP, 00, LR_LOADFROMFILE);
  end
  else ShowMessage(Format('%s'#13#10'"%s"', ['File not found:', CommonDataPath]));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Image1.Picture.Bitmap := GetUserPicture;
end;

_________________
ausblenden Delphi-Quelltext
1:
if CopyAndPaste not avaible then Developer := Helpless;					
Dezipaitor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 220



BeitragVerfasst: Mi 26.03.08 14:27 
File not found:
"C:\ProgramData\Microsoft\User Account Pictures\Dezipaitor.bmp"

_________________
Windows, Tokens, Access Control List, Dateisicherheit, Desktop, Vista Elevation?
Goto: blog.delphi-jedi.net = JEDI API LIB & Windows Security Code Library (JWSCL)
.#R4id
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90

Windows XP Prof.
CodeGear Delphi 2007
BeitragVerfasst: Mi 26.03.08 14:31 
Hm...

Ich hab die Datei mit der Windows Suche gefunden:

Versteckte Ordner und System Dateien einblenden und dann unter Bildern nach "#username#.bmp" (#username# in deinen namen ändern) suchen.
Irgentwann (vllt. auch nicht) findest du die Datei und kannst sie so laden!

_________________
ausblenden Delphi-Quelltext
1:
if CopyAndPaste not avaible then Developer := Helpless;					
Dezipaitor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 220



BeitragVerfasst: Mi 26.03.08 15:24 
Du verwendest nicht Vista, oder?

_________________
Windows, Tokens, Access Control List, Dateisicherheit, Desktop, Vista Elevation?
Goto: blog.delphi-jedi.net = JEDI API LIB & Windows Security Code Library (JWSCL)
.#R4id
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90

Windows XP Prof.
CodeGear Delphi 2007
BeitragVerfasst: Mi 26.03.08 20:20 
user profile icon.#R4id hat folgendes geschrieben:
... aber ich habe nur Windows XP, deshalb kann ich dir leider nicht sagen, wo bei Vista diese Datei liegt.
Klartext: Nein, nur WinXP Prof.

_________________
ausblenden Delphi-Quelltext
1:
if CopyAndPaste not avaible then Developer := Helpless;