::: µ¨ÆÄÀÌ Tip&Trick :::

µ¨ÆÄÀÌ Tip&Trick ¼º°Ý¿¡ ¸ÂÁö ¾Ê´Â ±¤°í,ºñ¹æ,Áú¹®ÀÇ ±ÛÀº Áï½Ã »èÁ¦Çϸç
³»¿ëÀ» º¹»çÇÏ¿© »ç¿ëÇÒ °æ¿ì ¹Ýµå½Ã À̰÷(http://www.howto.pe.kr)À» Ãâó·Î ¸í½ÃÇÏ¿© ÁÖ¼¼¿ä


Category

  ±è¿µ´ë(2003-03-07 20:06:14, Hit : 7898, Vote : 1488
 ÄÄÇ»ÅÍ/ÆÄÀÏ/Æú´õ ã±â È­¸é ¶ç¿ì±â

unit uFileOpen3;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, FileCtrl, ShellAPI, ShlObj, Buttons, OLE2, ActiveX;

type
  TForm1 = class(TForm)
    lbFiles: TFileListBox;
    lbDirectories: TDirectoryListBox;
    drvcbDrives: TDriveComboBox;
    btnFileProperties: TBitBtn;
    btnFindFiles: TBitBtn;
    btnQuit: TBitBtn;
    chkbMyComputer: TCheckBox;
    Label1: TLabel;
    btnBrowseTo: TBitBtn;
    btnSendToRecycle: TBitBtn;
    procedure btnFilePropertiesClick(Sender: TObject);
    procedure btnQuitClick(Sender: TObject);
    procedure btnFindFilesClick(Sender: TObject);
    procedure lbDirectoriesChange(Sender: TObject);
    procedure drvcbDrivesChange(Sender: TObject);
    procedure btnSendToRecycleClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure lbDirectoriesEnter(Sender: TObject);
    procedure drvcbDrivesEnter(Sender: TObject);
    procedure lbFilesEnter(Sender: TObject);
    procedure btnBrowseToClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure ShowProperties(sFileName :String);
    procedure SendToRecycleBin(sFileName :String);
    procedure BrowseTo(sURL, sBrowser, sDir :String);
  end;

var
  sei : TShellExecuteInfo;
  Form1: TForm1;
  b : Integer;

implementation

uses ShBrowse;
const
  AILeft = 1;
  AIRight = 2;
  AIBottom = 3;
  AITop = 4;


{$R *.DFM}

procedure TForm1.btnFilePropertiesClick(Sender: TObject);
begin
  case b of
  0:
    ShowMessage('You must select a drive, directory or file first');
  1:
    ShowProperties(drvcbDrives.Drive + ':');
  2:
    ShowProperties(lbFiles.FileName);
  3:
    ShowProperties(lbDirectories.Directory);
  end;
end;

procedure TForm1.ShowProperties(sFileName :String);
begin
  ZeroMemory(@sei, sizeof(sei));
  with sei do
  begin
    cbSize := SizeOf(sei);
    fMask  := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_INVOKEIDLIST or SEE_MASK_FLAG_NO_UI;
    Wnd   := Form1.Handle;
    lpVerb := 'properties';
    lpFile := PChar(sFileName);
    nShow := SW_SHOWNORMAL;
  end;
  ShellExecuteEX(@sei);
end;

procedure TForm1.btnQuitClick(Sender: TObject);
begin
  Close;
end;

procedure TForm1.btnFindFilesClick(Sender: TObject);
var
  pidl: PITEMIDLIST;
begin
  ZeroMemory(@sei, sizeof(sei));
  with sei do
  begin
    cbSize := SizeOf(sei);
    fMask := SEE_MASK_INVOKEIDLIST;
    lpVerb := 'find';
    if chkbMyComputer.Checked then
    begin
      SHGetSpecialFolderLocation(0,CSIDL_DRIVES,pidl);
      lpIDList := pidl;
    end
    else
    begin
      case b of
      0, 1:
        lpFile := PChar(String(drvcbDrives.Drive) + ':');
      2:
        begin
          ShowMessage('You can only use this on Drives and Directories');
          Exit;
        end;
      3:
        lpFile := PChar(lbDirectories.Directory);
      end;
    end;
  end;
  ShellExecuteEx(@sei);
end;

procedure TForm1.lbDirectoriesChange(Sender: TObject);
begin
  lbFiles.Directory := lbDirectories.Directory;
  if chkbMyComputer.Checked then
    chkbMyComputer.Checked := False;
end;

procedure TForm1.drvcbDrivesChange(Sender: TObject);
begin
  lbDirectories.Drive := drvcbDrives.Drive;
  if chkbMyComputer.Checked then
    chkbMyComputer.Checked := False;
end;

procedure TForm1.btnSendToRecycleClick(Sender: TObject);
var
s : string;
begin
  case b of
  0:
    ShowMessage('You must select a drive, directory or file first');
  1:
    ShowMessage('You can only use this on Files and Directories');
  2:
    SendToRecycleBin(lbFiles.FileName);
  3:
    begin
      s := lbDirectories.Directory;
      if Copy(s,Length(s)-1,2) = ':' then
      begin
        ShowMessage('This cannot be used on the Root directory');
        Exit;
      end;
      SendToRecycleBin(lbDirectories.Directory);
    end;
  end;
end;

procedure TForm1.SendToRecycleBin(sFileName :String);
begin
  ZeroMemory(@sei, sizeof(sei));
  with sei do
  begin
    cbSize := SizeOf(sei);
    fMask  := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_INVOKEIDLIST or SEE_MASK_FLAG_NO_UI;
    Wnd   := Form1.Handle;
    lpVerb := 'delete';
    lpFile := PChar(sFileName);
    nShow := SW_SHOWNORMAL;
  end;
  ShellExecuteEX(@sei);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  {
    Need a flag to tell if focus is on DirectoryListBox, FileListBox,
    or DriveComboBox because when the button is clicked,
    Form1.ActiveControl won't point to any of them. This flag is used
    in the case statements to operate differently on the differnet controls.
  }
  b := 0;
end;

procedure TForm1.lbDirectoriesEnter(Sender: TObject);
begin
  b := 3;
end;

procedure TForm1.drvcbDrivesEnter(Sender: TObject);
begin
  b := 1;
end;

procedure TForm1.lbFilesEnter(Sender: TObject);
begin
  b := 2;
end;

procedure TForm1.BrowseTo(sURL, sBrowser, sDir :String);
begin
  ZeroMemory(@sei, sizeof(sei));
  with sei do
  begin
    cbSize := SizeOf(sei);
    fMask  := SEE_MASK_NOCLOSEPROCESS;
    Wnd   := Form1.Handle;
    lpVerb := 'open';
    // Need to see if sBrowser empty, if so, pass url to lpFile parameter
    if sBrowser <> #0 then
      lpFile := PChar(sBrowser)
    else
      lpFile := PChar(sURL);
    lpParameters := PChar(sURL);
    lpDirectory := PChar(sDir);
    nShow := SW_SHOWNORMAL;
  end;
  ShellExecuteEX(@sei);
end;

procedure TForm1.btnBrowseToClick(Sender: TObject);
begin
  BrowseTo('http://www.informant.com/undu/index.htm', 'netscape.exe',
           '"C:Program FilesNetscapeNavigatorProgram"');
end;

end.





491   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] TRichEdit ÀÇ ¼±ÅÃµÈ ¿µ¿ª¸¸ ÀμâÇÏ±â  ±è¿µ´ë 2003/03/07 4597 755
490   [½Ã½ºÅÛ] CPU Á¾·ù ±¸ÇÏ±â  ±è¿µ´ë 2003/03/07 4921 1227
489   [½Ã½ºÅÛ] »ç¿îµåÆÄÀÏ ¾øÀÌ PC ½ºÇÇÄ¿·Î À½¾Ç¿¬ÁÖ  ±è¿µ´ë 2003/03/07 6852 930
488   [³×Æ®¿÷/ÀÎÅͳÝ] ÇÁ·Î±×·¥À¸·Î ³×Æ®¿öÅ© µå¶óÀÌºê ¿¬°á/ÇØÁ¦  ±è¿µ´ë 2003/03/07 6884 1264
487   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] À©µµ¿ìÁî Á¾·á¿Í °°Àº ±×´ÃÁø È­¸é ¸¸µé±â  ±è¿µ´ë 2003/03/07 3202 847
486   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ¾ÆÀÌÄÜ »çÀÌÆ®  ±è¿µ´ë 2003/03/07 3706 1087
485   [½Ã½ºÅÛ] À©µµ¿ìÁî ½Ã½ºÅÛ Ç¥ÁØ ÆùÆ® ±¸ÇÏ±â  ±è¿µ´ë 2003/03/07 3077 855
484   [³×Æ®¿÷/ÀÎÅͳÝ] RS232 Åë½Å  ±è¿µ´ë 2003/03/07 7088 1857
483   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ÁÖ¾îÁø ¿µ¿ªÀÇ È­¸é ĸó  ±è¿µ´ë 2003/03/07 3612 1016
482   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ¼ýÀÚ¸¦ ¿µ¹® Ç¥±â·Î ¹Ù²Ù±â  ±è¿µ´ë 2003/03/07 4303 902
481   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ¼ýÀÚ¸¦ ÇÑ±Û Ç¥±â·Î ¹Ù²Ù±â  ±è¿µ´ë 2003/03/07 3678 938
480   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] RichEdit ÀÇ ³»¿ëÀ» Bitmap À¸·Î ¸¸µé±â 2  ±è¿µ´ë 2003/03/07 3886 1439
479   [COM/OLE] MS-WORD Á¾·á½ÃŰ±â  ±è¿µ´ë 2003/03/07 2728 758
478   [À©µµ¿ìÁî API] ½Ã½ºÅÛ »ç¿îµå ¿¬ÁÖÇÏ±â  ±è¿µ´ë 2003/03/07 4893 1323
477   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Algorithm to sort a TStringGrid #2  ±è¿µ´ë 2003/03/07 4865 1218
476   [À©µµ¿ìÁî API] ¿ÜºÎ ÇÁ·Î±×·¥ÀÇ ÁÂÇ¥,»óÅ ±¸ÇÏ±â  ±è¿µ´ë 2003/03/07 3228 1026
475   [À©µµ¿ìÁî API] À©µµ¿ìÁî Telnet À¸·Î È£½ºÆ® Á¢¼ÓÇÏ±â  ±è¿µ´ë 2003/03/07 4130 1121
474   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ƯÁ¤ÇÑ Æú´õ·Î À̵¿ÇÑ DOS â ¶ç¿ì±â  ±è¿µ´ë 2003/03/07 4284 1139
473   [½Ã½ºÅÛ] DOS ¸í·É¾î ½ÇÇàÇÏ°í °á°ú ¹Þ¾Æ¿À±â  ±è¿µ´ë 2003/03/07 6657 1556
472   [À©µµ¿ìÁî API] NTÀÇ ÇöÀç user°¡ administrative privilege ¸¦ °¡Áö°í ÀÖ´ÂÁö?  ±è¿µ´ë 2003/03/07 3085 824
471   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] µÎ°³ÀÇ StringGrid sync ¸¶Ãß±â  ±è¿µ´ë 2003/03/07 3759 1018
470   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] À©µµ¿ìÀÇ title bar ÆùÆ® ¹Ù²Ù±â  ±è¿µ´ë 2003/03/07 3321 854
469   [³×Æ®¿÷/ÀÎÅͳÝ] ³×Æ®¿öÅ© °øÀ¯ ¼³Á¤/ÇØÁ¦ Çϱâ (Windows 9x)  ±è¿µ´ë 2003/03/07 4468 1087
468   [³×Æ®¿÷/ÀÎÅͳÝ] ³×Æ®¿öÅ© °øÀ¯ Á¤º¸ Àоî¿À±â (WIndows 9x)  ±è¿µ´ë 2003/03/07 3735 1018
467   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ´­·ÁÁø Űº¸µå ŰÀÇ ¸íĪ ±¸ÇÏ±â  ±è¿µ´ë 2003/03/07 7436 1444
466   [À©µµ¿ìÁî API] Windows98 ¿¡¼­ÀÇ SetForegroundWindow  ±è¿µ´ë 2003/03/07 5846 1503
465   [À©µµ¿ìÁî API] Task bar ¿¡ ³ªÅ¸³ªÁö ¾Ê´Â ÇÁ·Î±×·¥ ¸¸µé±â  ±è¿µ´ë 2003/03/07 5220 1516
464   [COM/OLE] Outlook »ç¿ëÇÏ±â  ±è¿µ´ë 2003/03/07 3572 1113
463   [½Ã½ºÅÛ] ÁöÁ¤ÇÑ drive°¡ CD-ROM ÀÎÁö °Ë»çÇÏ±â  ±è¿µ´ë 2003/03/07 6400 1662
462   [½Ã½ºÅÛ] ¾î¶² ¾îÇø®ÄÉÀ̼ÇÀÌ ½ÃÀÛ µÇ´ÂÁö hookÀ¸·Î ¾Ë¾Æ³»±â  ±è¿µ´ë 2003/03/07 5269 1567
461   [À©µµ¿ìÁî API] À©µµ¿ìÁî Ž»ö±âÀÇ ¾ÆÀÌÄÜ »Ì¾Æ³»¼­ »ç¿ëÇÏ±â  ±è¿µ´ë 2003/03/07 8120 1904
460   [À©µµ¿ìÁî API] System Images  ±è¿µ´ë 2003/03/07 8002 1844
  [À©µµ¿ìÁî API] ÄÄÇ»ÅÍ/ÆÄÀÏ/Æú´õ ã±â È­¸é ¶ç¿ì±â  ±è¿µ´ë 2003/03/07 7898 1488
458   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Unix-format time À» TDateTime ·Î ¹Ù²Ù±â  ±è¿µ´ë 2003/03/07 4148 1126
457   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ½ÇÇà½Ã component ¸¦ Move/Resize ½ÃŰ±â  ±è¿µ´ë 2003/03/07 3378 964
456   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] TMemo ¸¦ È­¸éÅ©±â·Î ÀμâÇÏ±â  ±è¿µ´ë 2003/03/07 2840 704
455   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] SpeedButton ¿¡ OnMouseEnter/OnMouseExit À̺¥Æ® ³Ö±â  ±è¿µ´ë 2003/03/07 4014 1047
454   [À©µµ¿ìÁî API] Űº¸µåÀÇ Scroll Lock Äѱâ/²ô±â  ±è¿µ´ë 2003/03/07 4265 1138
453   [µ¥ÀÌÅͺ£À̽º] table packing ÇÏ±â  ±è¿µ´ë 2003/03/07 3566 1014
452   [À©µµ¿ìÁî API] reboot Windows  ±è¿µ´ë 2003/03/07 3963 1133

[ÀÌÀü 10°³] [1]..[11][12] 13 [14][15][16][17][18][19][20]..[25] [´ÙÀ½ 10°³]
 

Copyright 1999-2023 Zeroboard / skin by zero