Delphi ´ò¿ªÎļþ¼Ð·½·¨
µÚÒ»ÖÖ·½·¨,ʹÓÃSelectDirectory º¯Êý ,ÔÚShellApiÖÐ
procedure TForm2.BtSelectPathClick(Sender: TObject);
var
strCaption,strDirectory:String;
wstrRoot:WideString;
begin
strCaption:='ÕâÊÇä¯ÀÀÎļþ¼ÐµÄ˵Ã÷ÎÄ×Ö£¬¿ÉÒÔ¸ù¾ÝÐèÒª½øÐÐÊéд¡£'
+#13#10+'Ò»°ã¶þÐÐÎÄ×Ö¾ÍÂúÁË¡£';
//¸Ã²ÎÊýÊÇä¯ÀÀÎļþ¼Ð´°¿ÚµÄÏÔʾ˵Ã÷²¿·Ö
wstrRoot:='';
//Õâ¸ö²ÎÊý±íʾËùÏÔʾµÄä¯ÀÀÎļþ¼Ð´°¿ÚÖеĸùĿ¼£¬Ä¬ÈÏ»ò¿Õ±íʾ“ÎҵĵçÄÔ”¡£
SelectDirectory(strCaption,wstrRoot,strDirectory);
EdLocalPath.Text:=strDirectory;
end;
µÚ¶þÖÖ·½·¨
ÒªÇó£ºÀûÓÃWin32 API SHBrowseForFolder¿ªÆôÒ»¸öÑ¡ÔñÎļþĿ¼µÄ¶Ô»°¿ò£¬Ô¤Ïȶ¨Î»µ½Ä¬ÈϵÄĿ¼£¬×îºó·µ»ØËùÑ¡ÔñµÄ½á¹û£¬Èç¹ûûÓнøÐÐÑ¡Ôñ£¨¼´µ¥»÷“È¡Ïû”½áÊøÑ¡Ôñ£©Ôò·µ»Ø¿Õ''¡£
´úÂëÈçÏÂ:(ÒÔÏÂÁ½¸öº¯Êý¶¨ÒåÐèÒªÔÚusesÖÐÒýÈëÁ½¸öµ¥ÔªShlObj,Windows;)
function BrowseCallbackProc(Wnd: HWND; uMsg: UINT; lParam, lpData: LPARAM): Integer stdcall;
begin
case uMsg of
BFFM_INITIALIZED: SendMessage(Wnd, BFFM_SETSELECTION, 1, lpData);
end;
Result := 0;
end;
function BrowsFolder(const Folder: string): string;
var
TitleName: string;
lpItemID: PItemIDList;
BrowseInfo: TBrowseInfo;
DisplayName: array[0..MAX_PATH] of char;
TempPath: array[0..MAX_PATH] of char;
begin
Result := Folder;
FillChar(BrowseInfo, sizeof(TBrowseInfo), #0);
BrowseInfo.hwndOwner := GetActiveWindow;
BrowseInfo.pszDisplayName := @DisplayName;
TitleName := 'ÇëÑ¡ÔñÒ»¸öĿ¼';
BrowseInfo.lpszTitle := PChar(TitleName);
BrowseInfo.ulFlags := BIF_RETURNONLYFSDIRS;
BrowseInfo.lpfn := BrowseCallbackProc;
BrowseInfo.lParam := Integer(PChar(Folder));
lpItemID := SHBrowseForFolder(BrowseInfo);
if Assigned(lpItemId) then
begin
SHGetPathfromIDList(lpItemID, TempPath);
GlobalFreePtr(lpItemID);
Result := string(TempPath);
end
else
Ïà¹ØÎĵµ£º
³£Íü¼Ç£¬ÔÚ´Ë×ö±Ê¼Ç¡£
Õ⼸¸öº¯Êý¶¼°üº¬ÔÚStrUtilsÖУ¬ËùÒÔÐèÒªuses StrUtils;
¼ÙÉè×Ö·û´®ÊÇ Dstr := ’Delphi is the BEST’, ÄÇô
LeftStr(Dstr, 5) := ’Delph’
MidStr(Dstr, 6, 7) := ’ ......
DirectoryExists('C:\WINDOWS'):Boolean;¼ì²âÎļþ¼ÐÊÇ·ñ´æÔÚ£¡
FileExists('c:\Dir.txt'):Boolean;¼ì²âÎļþÊÇ·ñ´æÔÚ£¡
EDIT×é¼þ
OnChange µ±±à¼¿òÖеÄÄÚÈÝ·¢Éú±ä»¯Ê±´¥·¢¸Ãʼþ
OnKeyPress µ±°´ÏÂÒ»¸ö°´¼üʱ£¬´¥·¢¸Ãʼþ
OnEnter ±à¼¿ò»ñµÃÊäÈë½¹µãʱ£¬´¥·¢¸Ãʼþ
MEMO×éºÏ
WordWrap ÓÃÓÚÉ趨Momo×é¼þÊÇ·ñ¾ßÓÐ×Ô¶ ......
DELPHI Ö¸ÕëʹÓÃÓõÄһƪºÃÎÄ ÊÕ²Ø
DelphiÀï×Ô¼º¹ÜÀíÄÚ´æµÄÁ½¶Ôº¯Êý new(),dispose()ºÍgetmem(),freemem()
´ó¼Ò¶¼ÈÏΪ£¬CÓïÑÔÖ®ËùÒÔÇ¿´ó£¬ÒÔ¼°Æä×ÔÓÉÐÔ£¬ºÜ´ó²¿·ÖÌåÏÖÔÚÆäÁé»îµÄÖ¸ÕëÔËÓÃÉÏ¡£Òò´Ë£¬ËµÖ¸ÕëÊÇCÓïÑÔµÄÁé»ê£¬Ò»µã¶¼²»Îª¹ý¡£Í ......
Delphi7 µ÷Óà C#µÄWebservice ²»ÄÜ´«Èë²ÎÊý
½â¾ö°ì·¨£º
ÔÚDelphiµ¼ÈëWSDLºóÉú³ÉµÄµ¥ÔªµÄ×îºóÒ»ÐУ¬¼´initializationÀïµÄ³õʼ»¯¶Ë¿ÚµÄ´úÂëÖмÓÈë´úÂë
InvRegistry.RegisterInvokeOptions(TypeInfo(½Ó¿ÚÃû), ioDocument);
¼´¿É
......
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 ......