AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bezeichner
Thema durchsuchen
Ansicht
Themen-Optionen

SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bezeichner

Ein Thema von MCXSC · begonnen am 24. Jun 2009 · letzter Beitrag vom 18. Dez 2020
Antwort Antwort
MCXSC
(Gast)

n/a Beiträge
 
#1

SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bezeich

  Alt 24. Jun 2009, 21:13
Hallo!

Ich habe eine Frage zu dem Tutorial "Entwicklung für Windows Vista", bzw. mit dem Part "Wohin mit den Dateien?".

Und zwar habe ich folgenden Delphi-Code:

Delphi-Quellcode:
uses ShlObj, SysUtils;

function GetSpecialFolder(const AFolder: Integer): string;
var
  path: string
begin
  SetLength(path, 250);
  SHGetFolderPath(Application.Handle, AFolder, TOKEN_DEFAULTUSER, 0, PChar(path);
  result := PChar(path);
end;
Problem ist nun, dass "TOKEN_DEFAULTUSER" ein undefinierter Bezeichner ist; Google sagt mir dazu aber nichts... Jemand hier vielleicht eine Idee?

Danke,
MCXSC
  Mit Zitat antworten Zitat
Fridolin Walther

Registriert seit: 11. Mai 2008
Ort: Kühlungsborn
446 Beiträge
 
Delphi 2009 Professional
 
#2

Re: SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bez

  Alt 24. Jun 2009, 21:19
Aus der Dokumentation zu MSDN-Library durchsuchenSHGetFolderPath:
Zitat:
Assigning the hToken parameter a value of -1 indicates the Default User.
Entsprechend:
Delphi-Quellcode:
const
  TOKEN_DEFAULTUSER = -1;
Fridolin Walther
"While Mr. Kim, by virtue of youth and naiveté, has fallen prey to the inexplicable need for human contact, let me step in and assure you that my research will go on uninterrupted, and that social relationships will continue to baffle and repulse me."
  Mit Zitat antworten Zitat
MCXSC
(Gast)

n/a Beiträge
 
#3

Re: SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bez

  Alt 24. Jun 2009, 21:21
Hm, dann bekomme ich die Meldung "Konstantenausdruck verletzt untere Grenzen"...
  Mit Zitat antworten Zitat
Fridolin Walther

Registriert seit: 11. Mai 2008
Ort: Kühlungsborn
446 Beiträge
 
Delphi 2009 Professional
 
#4

Re: SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bez

  Alt 24. Jun 2009, 21:27
Sorry, muss natürlich so heißen:
Delphi-Quellcode:
const
  TOKEN_DEFAULTUSER = Cardinal(-1);
Fridolin Walther
"While Mr. Kim, by virtue of youth and naiveté, has fallen prey to the inexplicable need for human contact, let me step in and assure you that my research will go on uninterrupted, and that social relationships will continue to baffle and repulse me."
  Mit Zitat antworten Zitat
MCXSC
(Gast)

n/a Beiträge
 
#5

Re: SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bez

  Alt 24. Jun 2009, 21:41
Ah, danke schön!³
  Mit Zitat antworten Zitat
Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#6

Re: SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bez

  Alt 24. Jun 2009, 21:59
oder

Delphi-Quellcode:
const
  TOKEN_DEFAULTUSER = $FFFF;
Thomas
  Mit Zitat antworten Zitat
Fridolin Walther

Registriert seit: 11. Mai 2008
Ort: Kühlungsborn
446 Beiträge
 
Delphi 2009 Professional
 
#7

Re: SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bez

  Alt 24. Jun 2009, 22:05
Zitat von toms:
Delphi-Quellcode:
const
  TOKEN_DEFAULTUSER = $FFFF;
Wenn dann schon
Delphi-Quellcode:
const
  TOKEN_DEFAULTUSER = $FFFFFFFF;
Da hToken als THandle (-> DWORD) übergeben wird, würde bei Dir dann aus dem Word $FFFF ein $0000FFFF werden, was nicht -1 ist. Kannst es gerne auch kurz selbst nachprüfen .
Fridolin Walther
"While Mr. Kim, by virtue of youth and naiveté, has fallen prey to the inexplicable need for human contact, let me step in and assure you that my research will go on uninterrupted, and that social relationships will continue to baffle and repulse me."
  Mit Zitat antworten Zitat
dietru

Registriert seit: 29. Okt 2004
Ort: Leipzig
22 Beiträge
 
Delphi 10.3 Rio
 
#8

AW: SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bezeichner

  Alt 18. Dez 2020, 20:48
Hallo,

es ist zwar eine Weile her, ich muss die Sache aber nochmal aufwärmen. Ich hatte SHgetfolderpath vermutlich unter W7 zuletzt benutzt. Da hatte ich bei TOKEN_DEFAULT_USER eine 1 stehen und bekam das Verzeichnis des aktuellen users zurück. Habe jetzt Delphi 10.3 unter Win10/64. Dort klappt das nicht mehr.
Was muss ich jetzt eintragen, die Konstante heisst vermutlich TOKEN_CURRENTUSER?

Vielen Dank und freundliche Grüße
Dieter
DT

Geändert von dietru (18. Dez 2020 um 20:53 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Dalai
Dalai

Registriert seit: 9. Apr 2006
1.680 Beiträge
 
Delphi 5 Professional
 
#9

AW: SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bezeichner

  Alt 18. Dez 2020, 21:24
@dietru:
Einfach mal mit einer 0 probieren. Steht übrigens auch so in der Doku zu MSDN-Library durchsuchenSHGetFolderPath (die weiter oben auch schon verlinkt ist):
Zitat:
This parameter is usually set to NULL [...]
Grüße
Dalai
  Mit Zitat antworten Zitat
dietru

Registriert seit: 29. Okt 2004
Ort: Leipzig
22 Beiträge
 
Delphi 10.3 Rio
 
#10

AW: SHGetFolderPath -> TOKEN_DEFAULTUSER -> Undef. Bezeichner

  Alt 18. Dez 2020, 23:00
Hallo, Dalai,

danke, es hat geklappt.

MfG
Dieter
DT
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:54 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz