Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

delphi Ñ¡ÔñÎļþ¼Ð


function BrowseCallbackProc(Wnd: HWND; uMsg: UINT; lParam, lpData: LPARAM): Integer; stdcall;
begin
if uMsg = BFFM_INITIALIZED then
begin
SendMessage(Wnd, BFFM_SETSELECTION, 1, lpData);
SetWindowText(Wnd, 'Ñ¡ÔñÒ»¸öÄ¿±ê');
end;
Result := 0;
end;
//hdl: ´°¿Ú¾ä±ú
//Root: ¸ùĿ¼
//InitDir: ³õʼ»¯Â·¾¶
//Hint: ¶Ô»°¿òÌáʾÓï¾ä
function fBrowseFolder(hdl:THandle; const Root: String; const InitDir: string;
Hint: string = 'ÇëÑ¡ÔñÎļþ¼Ð'): string;
var
Info:TBrowseInfo;
Dir:array[0..260] of char;
ItemId, RootItemIDList:PItemIDList;
Eaten, Attribute: Cardinal;
ID: IShellFolder;
begin
FillChar(Info, SizeOf(TBrowseInfo), #0);
with Info do
begin
hwndOwner := hdl;
SHGetDesktopFolder(ID);
ID.ParseDisplayName(hdl, nil, POleStr(WideString(Root)), Eaten, RootItemIDList, Attribute);
pidlRoot := RootItemIDList;
pszDisplayName := nil;
lpszTitle:= PChar(Hint);
ulFlags:=BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE; //Èç²»ÐèҪн¨°´Å¥£¬Ò²¿É²»¼ÓBIF_NEWDIALOGSTYLE
lpfn := BrowseCallbackProc;
lParam := Integer(PChar(InitDir));
iImage := 0;
end;
ItemId := SHBrowseForFolder(Info);
if ItemId<>nil then
begin
SHGetPathfromIDList(ItemId,@Dir);
GlobalFreePtr(ItemId);
Result:=string(Dir);
end
else
Result:='';
end;


Ïà¹ØÎĵµ£º

delphi ¶Ô RESÎļþµÄʹÓÃ

Ò»¡¢Òý×Ó£º
     ÏÖÔÚµÄWindowsÓ¦ÓóÌÐò¼¸ºõ¶¼Ê¹ÓÃͼ±ê¡¢Í¼Æ¬¡¢¹â±ê¡¢ÉùÒôµÈ£¬ÎÒÃdzÆËüÃÇΪ×ÊÔ´£¨Resource£©¡£×î¼òµ¥µÄʹÓÃ×ÊÔ´µÄ°ì·¨ÊǰÑÕâЩ×ÊÔ´µÄÔ´Îļþ´òÈëÈí¼þ°ü£¬ÒÔ·½±ã³ÌÐòÐèÒªµÄʱºòµ÷Óá£×ÊÔ´ÊdzÌÐòµÄÒ»²¿·Ö£¬³ÌÐòÒªÕý³£ÔËÐоÍÀë²»ÁË×ÊÔ´Îļþ¡£µ«ÊÇËüÊDz»¿ÉÖ´ÐдúÂë¡£
   &n ......

DELPHI ²éÕÒ£¬Ôö¼Ó£¬Ð޸ģ¬É¾³ý

unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, DB, ADODB, StdCtrls;
type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Button ......

Delphi ´ò¿ªÎļþ¼Ð·½·¨

µÚÒ»ÖÖ·½·¨,ʹÓÃSelectDirectory º¯Êý ,ÔÚShellApiÖÐ
procedure TForm2.BtSelectPathClick(Sender: TObject);
var
    strCaption,strDirectory:String;
    wstrRoot:WideString;
    begin
    strCaption:='ÕâÊÇä¯ÀÀÎļþ¼ÐµÄ˵Ã÷ÎÄ×Ö£¬¿ÉÒÔ¸ù¾ÝÐèÒª½ ......

Delphi ÀàÓë¶ÔÏóÄÚ´æ½á¹¹Ç³Îö(ÏÂ)

¶ÔÏó¿Õ¼ä
ÄÚ´æ½á¹¹
¶ÔÏóµÄÄÚ´æ½á¹¹Êǹ̶¨µÄ£¬¶ÔÏó´´½¨Íê³Éºó¾ÍÎÞ·¨¸Ä±ä¡£ËüÖ÷Òª´æ´¢Á˶ÔÏóÖ±ÊôÀàµÄµØÖ·£¨µÈ¼ÛÓÚÀàµÄVMT£©£¬¶ÔÏó±¾ÉíµÄ³ÉÔ±Êý¾Ý£¬¶ÔÏóµÄ½Ó¿Ú·½·¨±íµØÖ·¡£½á¹¹ÈçͼËùʾ£º
˵Ã÷£ºÈôÀàδÉùÃ÷½Ó¿Ú£¬Ôò¶ÔÏó¿Õ¼ä²»´æ´¢½Ó¿Ú·½·¨±íµØÖ·¡£
 
Àà¿Õ¼äÓë¶ÔÏó¿Õ¼äµÄ¹ØÏµ
Àà¿Õ¼äÓë¶ÔÏó¿Õ¼ä£º
ʾÀý£º·ÖÎö¶ÔÏóµÄ» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ