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

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


Category

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

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 5043 937
490   [½Ã½ºÅÛ] CPU Á¾·ù ±¸ÇÏ±â  ±è¿µ´ë 2003/03/07 5395 1388
489   [½Ã½ºÅÛ] »ç¿îµåÆÄÀÏ ¾øÀÌ PC ½ºÇÇÄ¿·Î À½¾Ç¿¬ÁÖ  ±è¿µ´ë 2003/03/07 7604 1138
488   [³×Æ®¿÷/ÀÎÅͳÝ] ÇÁ·Î±×·¥À¸·Î ³×Æ®¿öÅ© µå¶óÀÌºê ¿¬°á/ÇØÁ¦  ±è¿µ´ë 2003/03/07 7428 1428
487   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] À©µµ¿ìÁî Á¾·á¿Í °°Àº ±×´ÃÁø È­¸é ¸¸µé±â  ±è¿µ´ë 2003/03/07 3551 946
486   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ¾ÆÀÌÄÜ »çÀÌÆ®  ±è¿µ´ë 2003/03/07 4071 1209
485   [½Ã½ºÅÛ] À©µµ¿ìÁî ½Ã½ºÅÛ Ç¥ÁØ ÆùÆ® ±¸ÇÏ±â  ±è¿µ´ë 2003/03/07 3485 967
484   [³×Æ®¿÷/ÀÎÅͳÝ] RS232 Åë½Å  ±è¿µ´ë 2003/03/07 7592 2020
483   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ÁÖ¾îÁø ¿µ¿ªÀÇ È­¸é ĸó  ±è¿µ´ë 2003/03/07 3926 1119
482   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ¼ýÀÚ¸¦ ¿µ¹® Ç¥±â·Î ¹Ù²Ù±â  ±è¿µ´ë 2003/03/07 4693 1044
481   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ¼ýÀÚ¸¦ ÇÑ±Û Ç¥±â·Î ¹Ù²Ù±â  ±è¿µ´ë 2003/03/07 4029 1056
480   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] RichEdit ÀÇ ³»¿ëÀ» Bitmap À¸·Î ¸¸µé±â 2  ±è¿µ´ë 2003/03/07 4347 1610
479   [COM/OLE] MS-WORD Á¾·á½ÃÅ°±â  ±è¿µ´ë 2003/03/07 3044 853
478   [À©µµ¿ìÁî API] ½Ã½ºÅÛ »ç¿îµå ¿¬ÁÖÇÏ±â  ±è¿µ´ë 2003/03/07 5353 1455
477   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Algorithm to sort a TStringGrid #2  ±è¿µ´ë 2003/03/07 5291 1375
476   [À©µµ¿ìÁî API] ¿ÜºÎ ÇÁ·Î±×·¥ÀÇ ÁÂÇ¥,»óÅ ±¸ÇÏ±â  ±è¿µ´ë 2003/03/07 3672 1155
475   [À©µµ¿ìÁî API] À©µµ¿ìÁî Telnet À¸·Î È£½ºÆ® Á¢¼ÓÇÏ±â  ±è¿µ´ë 2003/03/07 4564 1247
474   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ƯÁ¤ÇÑ Æú´õ·Î À̵¿ÇÑ DOS â ¶ç¿ì±â  ±è¿µ´ë 2003/03/07 4649 1256
473   [½Ã½ºÅÛ] DOS ¸í·É¾î ½ÇÇàÇÏ°í °á°ú ¹Þ¾Æ¿À±â  ±è¿µ´ë 2003/03/07 7162 1680
472   [À©µµ¿ìÁî API] NTÀÇ ÇöÀç user°¡ administrative privilege ¸¦ °¡Áö°í ÀÖ´ÂÁö?  ±è¿µ´ë 2003/03/07 3541 966
471   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] µÎ°³ÀÇ StringGrid sync ¸¶Ãß±â  ±è¿µ´ë 2003/03/07 4125 1132
470   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] À©µµ¿ìÀÇ title bar ÆùÆ® ¹Ù²Ù±â  ±è¿µ´ë 2003/03/07 3649 960
469   [³×Æ®¿÷/ÀÎÅͳÝ] ³×Æ®¿öÅ© °øÀ¯ ¼³Á¤/ÇØÁ¦ Çϱâ (Windows 9x)  ±è¿µ´ë 2003/03/07 4878 1229
468   [³×Æ®¿÷/ÀÎÅͳÝ] ³×Æ®¿öÅ© °øÀ¯ Á¤º¸ Àоî¿À±â (WIndows 9x)  ±è¿µ´ë 2003/03/07 4130 1154
467   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ´­·ÁÁø Å°º¸µå Å°ÀÇ ¸íĪ ±¸ÇÏ±â  ±è¿µ´ë 2003/03/07 7879 1583
466   [À©µµ¿ìÁî API] Windows98 ¿¡¼­ÀÇ SetForegroundWindow  ±è¿µ´ë 2003/03/07 6390 1664
465   [À©µµ¿ìÁî API] Task bar ¿¡ ³ªÅ¸³ªÁö ¾Ê´Â ÇÁ·Î±×·¥ ¸¸µé±â  ±è¿µ´ë 2003/03/07 5663 1660
464   [COM/OLE] Outlook »ç¿ëÇÏ±â  ±è¿µ´ë 2003/03/07 4047 1335
463   [½Ã½ºÅÛ] ÁöÁ¤ÇÑ drive°¡ CD-ROM ÀÎÁö °Ë»çÇÏ±â  ±è¿µ´ë 2003/03/07 6905 1820
462   [½Ã½ºÅÛ] ¾î¶² ¾îÇø®ÄÉÀ̼ÇÀÌ ½ÃÀÛ µÇ´ÂÁö hookÀ¸·Î ¾Ë¾Æ³»±â  ±è¿µ´ë 2003/03/07 5787 1729
461   [À©µµ¿ìÁî API] À©µµ¿ìÁî Ž»ö±âÀÇ ¾ÆÀÌÄÜ »Ì¾Æ³»¼­ »ç¿ëÇÏ±â  ±è¿µ´ë 2003/03/07 8602 2063
460   [À©µµ¿ìÁî API] System Images  ±è¿µ´ë 2003/03/07 8529 1986
  [À©µµ¿ìÁî API] ÄÄÇ»ÅÍ/ÆÄÀÏ/Æú´õ ã±â È­¸é ¶ç¿ì±â  ±è¿µ´ë 2003/03/07 8552 1696
458   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Unix-format time À» TDateTime ·Î ¹Ù²Ù±â  ±è¿µ´ë 2003/03/07 4505 1240
457   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ½ÇÇà½Ã component ¸¦ Move/Resize ½ÃÅ°±â  ±è¿µ´ë 2003/03/07 3692 1067
456   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] TMemo ¸¦ È­¸éÅ©±â·Î ÀμâÇÏ±â  ±è¿µ´ë 2003/03/07 3197 809
455   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] SpeedButton ¿¡ OnMouseEnter/OnMouseExit À̺¥Æ® ³Ö±â  ±è¿µ´ë 2003/03/07 4374 1183
454   [À©µµ¿ìÁî API] Å°º¸µåÀÇ Scroll Lock Äѱâ/²ô±â  ±è¿µ´ë 2003/03/07 4755 1276
453   [µ¥ÀÌÅͺ£À̽º] table packing ÇÏ±â  ±è¿µ´ë 2003/03/07 4040 1119
452   [À©µµ¿ìÁî API] reboot Windows  ±è¿µ´ë 2003/03/07 5108 1343

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

Copyright 1999-2025 Zeroboard / skin by zero