2015년 12월 31일 목요일

델파이에서 다른 프로그램(탐색기)에서 드래그 드롭구현하기 2

사용시 드래그&드롭하려고 하려는 Edit를 크릭하여 포커스를 두고 드래그&드롭하면 원하는 에디터에 드롭됩니다. (Delphi, 델파이, Drag&Drop, 연습)

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses ShellApi;
{ TForm1 }

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  DragAcceptFiles(Handle, False)
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  DragAcceptFiles(Handle, True)
end;

procedure TForm1.WMDropFiles(var Msg: TWMDropFiles); // implement drag and drop
const
  MAX_PATH = 1024;
var
  CFileName: array [0 .. MAX_PATH] of Char;
begin
  try
    if DragQueryFile(Msg.Drop, 0, CFileName, MAX_PATH) > 0 then begin
      if Edit1.Focused then Edit1.Text := CFileName
      else if Edit2.Focused then Edit2.Text := CFileName;
      Msg.Result := 0;
    end;
  finally DragFinish(Msg.Drop);
  end;
end; // WMDropFiles

end.

tensorflow gpu 사용하기에서

 tensorflow 설치시 주의해야 한다. # Anything above 2.10 is not supported on the GPU on Windows Native python - m pip install "tensorflow<2.11...