Skal virksomheder stå stærkere mod angreb og kunne udvikle sig, skal sikkerhed, drift og forretning tænkes sammen. Det er tanken bag Jysk IT’s ambition om at skabe en “sikker fremtid” for kunderne.
type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.DFM}
uses shlobj;
function BrowseForComputer(const winhandle : THANDLE; const title : string = \'\'): string; //Show a dialog box and return a string with the selected computer var BrowseInfo: TBrowseInfo; IDRoot: PItemIDList; Path: array[0..MAX_PATH] of Char; begin // Get the Item ID for Network Neighborhood SHGetSpecialFolderLocation(winHandle, CSIDL_NETWORK, IDRoot); ZeroMemory(@BrowseInfo, SizeOf(TBrowseInfo)); ZeroMemory(@path, MAX_PATH); BrowseInfo.hwndOwner := winhandle; BrowseInfo.pidlRoot := IDRoot; BrowseInfo.lpszTitle := PChar(title); BrowseInfo.pszDisplayName := @path; // Include this flag to show computer only BrowseInfo.ulFlags := BIF_BROWSEFORCOMPUTER;// or BIF_RETURNONLYFSDIRS ; // Show the browse dialog, get the Item ID for the selected item and convert it to a path SHBrowseForFolder(BrowseInfo); result := path; end;
function BrowseForFolder(hndl: HWND; msg: string=\'\'): string; {hndl iscalling forms handle} var FolderName: string; GDir: string; PList: PItemIDList; bi: TBrowseInfo; begin FillChar(bi, SizeOf(TBrowseInfo), 0); FolderName:= StringOfChar(\' \', MAX_PATH); GDir:= StringOfChar(\' \', MAX_PATH);
with bi do begin hwndOwner:= hndl; pidlRoot:= nil; pszDisplayName:= PChar(FolderName); lpszTitle := PChar(msg); lpfn:= nil; ulFlags:= BIF_DONTGOBELOWDOMAIN or BIF_RETURNONLYFSDIRS or BIF_RETURNFSANCESTORS; end;
PList:= SHBrowseForFolder(bi); {<-- show the dialog}
if Plist<>nil then begin SHGetPathFromIDList(Plist, PChar(GDir)); setlength(GDir, pos(#0, gdir)-1); result:= GDir; end else result:= \'\'; end;
procedure TForm1.Button1Click(Sender: TObject); begin Caption := BrowseForFolder(Handle); end; procedure TForm1.Button2Click(Sender: TObject); begin Caption := BrowseForComputer(Handle); end;
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.