C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[4681] Re:[질문]저..드래그&드롭땜에 그러는데여..
il's [] 3249 읽음    2000-12-27 00:00
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
    TMemo *Memo1;
    void __fastcall FormCreate(TObject *Sender);
private:    // User declarations
public:        // User declarations
    AnsiString Files;
    void __fastcall WmDropFiles(TWMDropFiles DropFiles);
    __fastcall TForm1(TComponent* Owner);
BEGIN_MESSAGE_MAP
  MESSAGE_HANDLER(WM_DROPFILES, TWMDropFiles, WmDropFiles)
END_MESSAGE_MAP(TForm)

};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

위의 내용은 H 파일의 내용입니다....


//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{

}
//---------------------------------------------------------------------------
void __fastcall TForm1::WmDropFiles(TWMDropFiles DropFiles)
{
    char buf[MAX_PATH];
    HDROP hDrop = (HDROP)DropFiles.Drop;
    int NumFiles = DragQueryFile(hDrop, -1, NULL, NULL);
    Memo1->Clear();
    for (int i = 0; i < NumFiles ; i++)
    {
        DragQueryFile(hDrop, i, buf, sizeof(buf));
        if (NumFiles == 1)
            Memo1->Lines->LoadFromFile(buf);
        else
            Memo1->Lines->Add(buf);
    }
    DragFinish(hDrop);
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
    DragAcceptFiles(Handle, 1);
    Files = ParamStr(1);
//    ShowMessage(Files);
    if (Files !="")
        Memo1->Lines->LoadFromFile(Files);
}
//---------------------------------------------------------------------------


위는 메인 소스 내용입니다....

^^

그럼 즐거운 프로그램 하세요........


김미혜 님이 쓰신 글 :
: 저 탐색기에 있는 파일을 매모장처럼 프로그램을 연상태에서
: 드래그&그롭해거 그 파일에 있는 내용을 보게끔할려면 어떻게 해야하나여????
:

+ -

관련 글 리스트
4678 [질문]저..드래그&드롭땜에 그러는데여.. 김미혜 2965 2000/12/27
4681     Re:[질문]저..드래그&드롭땜에 그러는데여.. il's 3249 2000/12/27
4687         [내용무]호 일스님 여기서두 보네요 ^^ 경호 2960 2000/12/28
4684         Re:Re:[질문]저..드래그&드롭땜에 그러는데여.. 김미혜 2998 2000/12/27
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.