C++Builder相談室 Part4
■ このスレッドは過去ログ倉庫に格納されています
0638デフォルトの名無しさん
NGNGサブクラス化を行ってTEditにWM_DROPFILESメッセージを受け取らせる方法です。
--unit1.h
private:// ユーザー宣言
HWND wnd;
TWndMethod OldEditWndProc;
void __fastcall NewEditWindowProc(TMessage& Msg);
--unit1.cpp
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
OldEditWndProc = Edit1->WindowProc;
Edit1->WindowProc = NewEditWindowProc;
wnd = Edit1->Handle;
DragAcceptFiles(wnd, TRUE);
}
void __fastcall TForm1::NewEditWindowProc(TMessage& Msg)
{
char buff[MAX_PATH + 1];
if (Msg.Msg == WM_DROPFILES) {
DragQueryFile((HDROP)Msg.WParam, 0, buff, MAX_PATH);
Edit1->Text = buff;
DragFinish((HDROP)Msg.WParam);
}
OldEditWndProc(Msg);
}
■ このスレッドは過去ログ倉庫に格納されています