Delphi Tip

Programming/Delphi 2012.04.13 10:41 Posted by 파란크리스마스

출처

http://rainflys.tistory.com/84
http://www.borlandforum.com/impboard/impboard.dll?action=read&db=del_qna&no=3570
http://bloodguy.tistory.com/entry/Delphi-바탕화면-시작메뉴프로그램-등-특수-디렉토리-가져오기

현재 실행 폴더 구하기

runpath:=ExtractFilePath(Application.ExeName);

Memo 스크롤 마지막으로 이동

procedure TForm1.Memo1Change(Sender: TObject);
begin
  Memo1.Perform(EM_LINESCROLL, 0, Memo1.Lines.Count);
end;

Format

 format('%0.10d',[10])

시스템 폴더 조회

// 시작 메뉴\프로그램 (C:\Documents and Settings\USER_NAME\시작 메뉴\프로그램)
SHGetFolderPath(0, CSIDL_PROGRAMS, 0, 0, PathPrograms);   
 
// 바탕 화면 (C:\Documents and Settings\USER_NAME\바탕 화면)
SHGetFolderPath(0, CSIDL_DESKTOP, 0, 0, PathDesktop);
unit Winapi.ShlObj;

  CSIDL_DESKTOP                 = $0000;          // 바탕화명 <desktop>
  CSIDL_INTERNET                = $0001;          // Internet Explorer (icon on desktop)
  CSIDL_PROGRAMS                = $0002;          //  시작메뉴\프로그램 Start Menu\Programs
  CSIDL_CONTROLS                = $0003;          // My Computer\Control Panel
  CSIDL_PRINTERS                = $0004;          // My Computer\Printers
  CSIDL_PERSONAL                = $0005;          // My Documents
  CSIDL_FAVORITES               = $0006;          // <user name>\Favorites
  CSIDL_STARTUP                 = $0007;          // Start Menu\Programs\Startup
  CSIDL_RECENT                  = $0008;          // <user name>\Recent
  CSIDL_SENDTO                  = $0009;          // <user name>\SendTo
  CSIDL_BITBUCKET               = $000a;          // <desktop>\Recycle Bin
  CSIDL_STARTMENU               = $000b;          // <user name>\Start Menu
  CSIDL_MYDOCUMENTS             = CSIDL_PERSONAL; // Personal was just a silly name for My Documents
  CSIDL_MYMUSIC                 = $000d;          // "My Music" folder
  CSIDL_MYVIDEO                 = $000e;          // "My Videos" folder
  CSIDL_DESKTOPDIRECTORY        = $0010;          // <user name>\Desktop
  CSIDL_DRIVES                  = $0011;          // My Computer
  CSIDL_NETWORK                 = $0012;          // Network Neighborhood (My Network Places)
  CSIDL_NETHOOD                 = $0013;          // <user name>\nethood
  CSIDL_FONTS                   = $0014;          // windows\fonts
  CSIDL_TEMPLATES               = $0015;

  CSIDL_COMMON_STARTMENU        = $0016;          // All Users\Start Menu
  CSIDL_COMMON_PROGRAMS         = $0017;          // All Users\Start Menu\Programs
  CSIDL_COMMON_STARTUP          = $0018;          // All Users\Startup
  CSIDL_COMMON_DESKTOPDIRECTORY = $0019;          // All Users\Desktop
  CSIDL_APPDATA                 = $001a;          // <user name>\Application Data
  CSIDL_PRINTHOOD               = $001b;          // <user name>\PrintHood
  CSIDL_LOCAL_APPDATA           = $001c;          // <user name>\Local Settings\Applicaiton Data (non roaming)
  CSIDL_ALTSTARTUP              = $001d;          // non localized startup
  CSIDL_COMMON_ALTSTARTUP       = $001e;          // non localized common startup
  CSIDL_COMMON_FAVORITES        = $001f;
  CSIDL_INTERNET_CACHE          = $0020;
  CSIDL_COOKIES                 = $0021;
  CSIDL_HISTORY                 = $0022;
  CSIDL_COMMON_APPDATA          = $0023;          // All Users\Application Data
  CSIDL_WINDOWS                 = $0024;          // GetWindowsDirectory()
  CSIDL_SYSTEM                  = $0025;          // GetSystemDirectory()
  CSIDL_PROGRAM_FILES           = $0026;          // C:\Program Files
  CSIDL_MYPICTURES              = $0027;          // C:\Program Files\My Pictures
  CSIDL_PROFILE                 = $0028;          // USERPROFILE
  CSIDL_SYSTEMX86               = $0029;          // x86 system directory on RISC
  CSIDL_PROGRAM_FILESX86        = $002a;          // x86 C:\Program Files on RISC
  CSIDL_PROGRAM_FILES_COMMON    = $002b;          // C:\Program Files\Common
  CSIDL_PROGRAM_FILES_COMMONX86 = $002c;          // x86 Program Files\Common on RISC
  CSIDL_COMMON_TEMPLATES        = $002d;          // All Users\Templates
  CSIDL_COMMON_DOCUMENTS        = $002e;          // All Users\Documents
  CSIDL_COMMON_ADMINTOOLS       = $002f;          // All Users\Start Menu\Programs\Administrative Tools
  CSIDL_ADMINTOOLS              = $0030;          // <user name>\Start Menu\Programs\Administrative Tools
  CSIDL_CONNECTIONS             = $0031;          // Network and Dial-up Connections
  CSIDL_COMMON_MUSIC            = $0035;          // All Users\My Music
  CSIDL_COMMON_PICTURES         = $0036;          // All Users\My Pictures
  CSIDL_COMMON_VIDEO            = $0037;          // All Users\My Video
  CSIDL_RESOURCES               = $0038;          // Resource Direcotry
  CSIDL_RESOURCES_LOCALIZED     = $0039;          // Localized Resource Direcotry
  CSIDL_COMMON_OEM_LINKS        = $003a;          // Links to All Users OEM specific apps
  CSIDL_CDBURN_AREA             = $003b;          // USERPROFILE\Local Settings\Application Data\Microsoft\CD Burning

  // unused                               0x003c
  CSIDL_COMPUTERSNEARME         = $003d;          // Computers Near Me (computered from Workgroup membership)
  CSIDL_FLAG_CREATE             = $8000;          // combine with CSIDL_ value to force folder creation in SHGetFolderPath()
  CSIDL_FLAG_DONT_VERIFY        = $4000;          // combine with CSIDL_ value to return an unverified folder path
  CSIDL_FLAG_DONT_UNEXPAND      = $2000;          // combine with CSIDL_ value to avoid unexpanding environment variables
  CSIDL_FLAG_NO_ALIAS           = $1000;          // combine with CSIDL_ value to insure non-alias versions of the pidl
  CSIDL_FLAG_PER_USER_INIT      = $0800;          // combine with CSIDL_ value to indicate per-user init (eg. upgrade)
  CSIDL_FLAG_MASK               = $FF00;          // mask for all possible flag values

파일 경로 얻어오기

path := ExtractFilePath(Application.exeName);

- end -

신고


 

티스토리 툴바