반응형
드래그 드랍을 지원하기 위해서는 다음과 같은 속성을 윈도우에 주어야 한다.
hWnd = CreateWindowEx(WS_EX_ACCEPTFILES,.... )
저렇게해야만 드래그앤 드랍이 가능해 진다.
그리고 다음과 같은 메세지를 받을수 있다.
switch(iMessage) {
case WM_DROPFILES:
DragQueryFile((HDROP)wParam, 0, d_filename,1024);
loadFile(DROP_OK);
DragFinish((HDROP) wParam);
return 0;
.....
d_filename 으로 화일명을 받아 들일수 있다.
여기서 1024는 화일명이 받을수 있는 크기이다.
다음은msdn의 DragQueryFile 함수이다.
DragQueryFile Function
--------------------------------------------------------------------------------
Retrieves the names of dropped files that result from a successful drag-and-drop operation.
Syntax
UINT DragQueryFile( HDROP hDrop,
UINT iFile,
LPTSTR lpszFile,
UINT cch
);
Parameters
hDrop
Identifier of the structure containing the file names of the dropped files.
iFile
Index of the file to query. If the value of the iFile parameter is 0xFFFFFFFF, DragQueryFile returns a count of the files dropped. If the value of the iFile parameter is between zero and the total number of files dropped, DragQueryFile copies the file name with the corresponding value to the buffer pointed to by the lpszFile parameter.
lpszFile
Address of a buffer to receive the file name of a dropped file when the function returns. This file name is a null-terminated string. If this parameter is NULL, DragQueryFile returns the required size, in characters, of the buffer.
cch
Size, in characters, of the lpszFile buffer.
--------------------------------------------------------------
Return Value
When the function copies a file name to the buffer, the return value is a count of the characters copied, not including the terminating null character.
If the index value is 0xFFFFFFFF, the return value is a count of the dropped files. Note that the index variable itself returns unchanged, and will therefore remain 0xFFFFFFFF.
If the index value is between zero and the total number of dropped files and the lpszFile buffer address is NULL, the return value is the required size, in characters, of the buffer, not including the terminating null character.
Windows 95/98/Me: DragQueryFile is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
hWnd = CreateWindowEx(WS_EX_ACCEPTFILES,.... )
저렇게해야만 드래그앤 드랍이 가능해 진다.
그리고 다음과 같은 메세지를 받을수 있다.
switch(iMessage) {
case WM_DROPFILES:
DragQueryFile((HDROP)wParam, 0, d_filename,1024);
loadFile(DROP_OK);
DragFinish((HDROP) wParam);
return 0;
.....
d_filename 으로 화일명을 받아 들일수 있다.
여기서 1024는 화일명이 받을수 있는 크기이다.
다음은msdn의 DragQueryFile 함수이다.
DragQueryFile Function
--------------------------------------------------------------------------------
Retrieves the names of dropped files that result from a successful drag-and-drop operation.
Syntax
UINT DragQueryFile( HDROP hDrop,
UINT iFile,
LPTSTR lpszFile,
UINT cch
);
Parameters
hDrop
Identifier of the structure containing the file names of the dropped files.
iFile
Index of the file to query. If the value of the iFile parameter is 0xFFFFFFFF, DragQueryFile returns a count of the files dropped. If the value of the iFile parameter is between zero and the total number of files dropped, DragQueryFile copies the file name with the corresponding value to the buffer pointed to by the lpszFile parameter.
lpszFile
Address of a buffer to receive the file name of a dropped file when the function returns. This file name is a null-terminated string. If this parameter is NULL, DragQueryFile returns the required size, in characters, of the buffer.
cch
Size, in characters, of the lpszFile buffer.
--------------------------------------------------------------
Return Value
When the function copies a file name to the buffer, the return value is a count of the characters copied, not including the terminating null character.
If the index value is 0xFFFFFFFF, the return value is a count of the dropped files. Note that the index variable itself returns unchanged, and will therefore remain 0xFFFFFFFF.
If the index value is between zero and the total number of dropped files and the lpszFile buffer address is NULL, the return value is the required size, in characters, of the buffer, not including the terminating null character.
Windows 95/98/Me: DragQueryFile is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
반응형
'공부 > 컴퓨터' 카테고리의 다른 글
시간 관련 함수. (0) | 2004.01.04 |
---|---|
Assert 사용하기 - JDK 1.4 이상 지원 (0) | 2004.01.03 |
EDIT 컨트롤 (0) | 2004.01.02 |
키보드의 특수 문자 읽는법 (0) | 2003.12.21 |
자바 프로그램의 성능 향상 기법 - 비트웹 김명호 기술이사 (0) | 2003.12.12 |