Added Drag*32 functions.

This commit is contained in:
Kai Morich 1998-10-24 12:02:54 +00:00 committed by Alexandre Julliard
parent 6a387e500e
commit 0913cdf00f
5 changed files with 191 additions and 56 deletions

View File

@ -8,10 +8,10 @@ type win16
5 pascal RegSetValue(long str long str long) RegSetValue16 5 pascal RegSetValue(long str long str long) RegSetValue16
6 pascal RegQueryValue(long str ptr ptr) RegQueryValue16 6 pascal RegQueryValue(long str ptr ptr) RegQueryValue16
7 pascal RegEnumKey(long long ptr long) RegEnumKey16 7 pascal RegEnumKey(long long ptr long) RegEnumKey16
9 pascal16 DragAcceptFiles(word word) DragAcceptFiles 9 pascal16 DragAcceptFiles(word word) DragAcceptFiles16
11 pascal16 DragQueryFile(word s_word ptr s_word) DragQueryFile 11 pascal16 DragQueryFile(word s_word ptr s_word) DragQueryFile16
12 pascal16 DragFinish(word) DragFinish 12 pascal16 DragFinish(word) DragFinish16
13 pascal16 DragQueryPoint(word ptr) DragQueryPoint 13 pascal16 DragQueryPoint(word ptr) DragQueryPoint16
20 pascal16 ShellExecute(word str str str str s_word) ShellExecute16 20 pascal16 ShellExecute(word str str str str s_word) ShellExecute16
21 pascal16 FindExecutable(str str ptr) FindExecutable16 21 pascal16 FindExecutable(str str ptr) FindExecutable16
22 pascal16 ShellAbout(word ptr ptr word) ShellAbout16 22 pascal16 ShellAbout(word ptr ptr word) ShellAbout16

View File

@ -68,14 +68,40 @@ typedef WORD FILEOP_FLAGS;
typedef WORD PRINTEROP_FLAGS; typedef WORD PRINTEROP_FLAGS;
/****************************** /******************************
* DROPFILESTRUCT * DRAG&DROP API
*/ */
typedef struct { /* structure for dropped files */ typedef struct { /* structure for dropped files */
WORD wSize; WORD wSize;
POINT16 ptMousePos; POINT16 ptMousePos;
BOOL16 fInNonClientArea; BOOL16 fInNonClientArea;
/* memory block with filenames follows */ /* memory block with filenames follows */
} DROPFILESTRUCT, *LPDROPFILESTRUCT; } DROPFILESTRUCT16, *LPDROPFILESTRUCT16;
typedef struct { /* structure for dropped files */
DWORD lSize;
POINT32 ptMousePos;
BOOL32 fInNonClientArea;
BOOL32 fWideChar;
/* memory block with filenames follows */
} DROPFILESTRUCT32, *LPDROPFILESTRUCT32;
DECL_WINELIB_TYPE(DROPFILESTRUCT)
DECL_WINELIB_TYPE(LPDROPFILESTRUCT)
void WINAPI DragAcceptFiles16(HWND16 hWnd, BOOL16 b);
void WINAPI DragAcceptFiles32(HWND32 hWnd, BOOL32 b);
#define DragAcceptFiles WINELIB_NAME(DragAcceptFiles)
UINT16 WINAPI DragQueryFile16(HDROP16 hDrop, WORD wFile, LPSTR lpszFile, WORD wLength);
UINT32 WINAPI DragQueryFile32A(HDROP32 hDrop, UINT32 lFile, LPSTR lpszFile, UINT32 lLength);
UINT32 WINAPI DragQueryFile32W(HDROP32 hDrop, UINT32 lFile, LPWSTR lpszFile, UINT32 lLength);
#define DragQueryFile WINELIB_NAME_AW(DragQueryFile)
void WINAPI DragFinish32(HDROP32 h);
void WINAPI DragFinish16(HDROP16 h);
#define DragFinish WINELIB_NAME(DragFinish)
BOOL32 WINAPI DragQueryPoint32(HDROP32 hDrop, POINT32 *p);
BOOL16 WINAPI DragQueryPoint16(HDROP16 hDrop, POINT16 *p);
#define DragQueryPoint WINELIB_NAME(DragQueryPoint)
/**************************************************************************** /****************************************************************************
* NOTIFYICONDATA * NOTIFYICONDATA

View File

@ -65,76 +65,185 @@ static UINT16 uMsgWndDestroyed = 0;
static UINT16 uMsgShellActivate = 0; static UINT16 uMsgShellActivate = 0;
/************************************************************************* /*************************************************************************
* DragAcceptFiles [SHELL.9] * DragAcceptFiles32 [SHELL32.54]
*/ */
void WINAPI DragAcceptFiles(HWND16 hWnd, BOOL16 b) void WINAPI DragAcceptFiles32(HWND32 hWnd, BOOL32 b)
{ WND* wnd = WIN_FindWndPtr(hWnd); {
WND* wnd = WIN_FindWndPtr(hWnd);
if( wnd ) if( wnd )
wnd->dwExStyle = b? wnd->dwExStyle | WS_EX_ACCEPTFILES wnd->dwExStyle = b? wnd->dwExStyle | WS_EX_ACCEPTFILES
: wnd->dwExStyle & ~WS_EX_ACCEPTFILES; : wnd->dwExStyle & ~WS_EX_ACCEPTFILES;
} }
/*************************************************************************
* DragAcceptFiles16 [SHELL.9]
*/
void WINAPI DragAcceptFiles16(HWND16 hWnd, BOOL16 b)
{
DragAcceptFiles32(hWnd, b);
}
/************************************************************************* /*************************************************************************
* DragQueryFile [SHELL.11] * SHELL_DragQueryFile [internal]
*
*/ */
UINT16 WINAPI DragQueryFile(HDROP16 hDrop, WORD wFile, LPSTR lpszFile, static UINT32 SHELL_DragQueryFile(LPSTR lpDrop, LPWSTR lpwDrop, UINT32 lFile,
LPSTR lpszFile, LPWSTR lpszwFile, UINT32 lLength)
{
UINT32 i;
i = 0;
if (lpDrop) {
while (i++ < lFile) {
while (*lpDrop++); /* skip filename */
if (!*lpDrop)
return (lFile == 0xFFFFFFFF) ? i : 0;
}
}
if (lpwDrop) {
while (i++ < lFile) {
while (*lpwDrop++); /* skip filename */
if (!*lpwDrop)
return (lFile == 0xFFFFFFFF) ? i : 0;
}
}
if (lpDrop) i = lstrlen32A(lpDrop);
if (lpwDrop) i = lstrlen32W(lpwDrop);
i++;
if (!lpszFile && !lpszwFile) {
return i; /* needed buffer size */
}
i = (lLength > i) ? i : lLength;
if (lpszFile) {
if (lpDrop) lstrcpyn32A (lpszFile, lpDrop, i);
else lstrcpynWtoA(lpszFile, lpwDrop, i);
} else {
if (lpDrop) lstrcpynAtoW(lpszwFile, lpDrop, i);
else lstrcpyn32W (lpszwFile, lpwDrop, i);
}
return i;
}
/*************************************************************************
* DragQueryFile32A [SHELL32.81] [shell32.82]
*/
UINT32 WINAPI DragQueryFile32A(HDROP32 hDrop, UINT32 lFile, LPSTR lpszFile,
UINT32 lLength)
{ /* hDrop is a global memory block allocated with GMEM_SHARE
* with DROPFILESTRUCT as a header and filenames following
* it, zero length filename is in the end */
LPDROPFILESTRUCT32 lpDropFileStruct;
LPSTR lpCurrent;
UINT32 i;
TRACE(shell,"(%08x, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength);
lpDropFileStruct = (LPDROPFILESTRUCT32) GlobalLock32(hDrop);
if(!lpDropFileStruct)
return 0;
lpCurrent = (LPSTR) lpDropFileStruct + lpDropFileStruct->lSize;
i = SHELL_DragQueryFile(lpCurrent, NULL, lFile, lpszFile, NULL, lLength);
GlobalUnlock32(hDrop);
return i;
}
/*************************************************************************
* DragQueryFile32W [shell32.133]
*/
UINT32 WINAPI DragQueryFile32W(HDROP32 hDrop, UINT32 lFile, LPWSTR lpszwFile,
UINT32 lLength)
{
LPDROPFILESTRUCT32 lpDropFileStruct;
LPWSTR lpwCurrent;
UINT32 i;
TRACE(shell,"(%08x, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength);
lpDropFileStruct = (LPDROPFILESTRUCT32) GlobalLock32(hDrop);
if(!lpDropFileStruct)
return 0;
lpwCurrent = (LPWSTR) lpDropFileStruct + lpDropFileStruct->lSize;
i = SHELL_DragQueryFile(NULL, lpwCurrent, lFile, NULL, lpszwFile,lLength);
GlobalUnlock32(hDrop);
return i;
}
/*************************************************************************
* DragQueryFile16 [SHELL.11]
*/
UINT16 WINAPI DragQueryFile16(HDROP16 hDrop, WORD wFile, LPSTR lpszFile,
WORD wLength) WORD wLength)
{ /* hDrop is a global memory block allocated with GMEM_SHARE { /* hDrop is a global memory block allocated with GMEM_SHARE
* with DROPFILESTRUCT as a header and filenames following * with DROPFILESTRUCT as a header and filenames following
* it, zero length filename is in the end */ * it, zero length filename is in the end */
LPDROPFILESTRUCT lpDropFileStruct; LPDROPFILESTRUCT16 lpDropFileStruct;
LPSTR lpCurrent; LPSTR lpCurrent;
WORD i; WORD i;
TRACE(shell,"(%04x, %i, %p, %u)\n", TRACE(shell,"(%04x, %x, %p, %u)\n", hDrop,wFile,lpszFile,wLength);
hDrop,wFile,lpszFile,wLength);
lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock16(hDrop); lpDropFileStruct = (LPDROPFILESTRUCT16) GlobalLock16(hDrop);
if(!lpDropFileStruct) if(!lpDropFileStruct)
return 0; return 0;
lpCurrent = (LPSTR) lpDropFileStruct + lpDropFileStruct->wSize; lpCurrent = (LPSTR) lpDropFileStruct + lpDropFileStruct->wSize;
i = 0; i = (WORD)SHELL_DragQueryFile(lpCurrent, NULL, wFile==0xffff?0xffffffff:wFile,
while (i++ < wFile) lpszFile, NULL, wLength);
{ while (*lpCurrent++); /* skip filename */
if (!*lpCurrent)
return (wFile == 0xFFFF) ? i : 0;
}
i = strlen(lpCurrent);
if (!lpszFile)
return i+1; /* needed buffer size */
i = (wLength > i) ? i : wLength-1;
strncpy(lpszFile, lpCurrent, i);
lpszFile[i] = '\0';
GlobalUnlock16(hDrop); GlobalUnlock16(hDrop);
return i; return i;
} }
/************************************************************************* /*************************************************************************
* DragFinish [SHELL.12] * DragFinish32 [SHELL32.80]
*/ */
void WINAPI DragFinish(HDROP16 h) void WINAPI DragFinish32(HDROP32 h)
{ TRACE(shell,"\n");
GlobalFree32((HGLOBAL32)h);
}
/*************************************************************************
* DragFinish16 [SHELL.12]
*/
void WINAPI DragFinish16(HDROP16 h)
{ TRACE(shell,"\n"); { TRACE(shell,"\n");
GlobalFree16((HGLOBAL16)h); GlobalFree16((HGLOBAL16)h);
} }
/************************************************************************* /*************************************************************************
* DragQueryPoint [SHELL.13] * DragQueryPoint32 [SHELL32.135]
*/ */
BOOL16 WINAPI DragQueryPoint(HDROP16 hDrop, POINT16 *p) BOOL32 WINAPI DragQueryPoint32(HDROP32 hDrop, POINT32 *p)
{ LPDROPFILESTRUCT lpDropFileStruct; {
LPDROPFILESTRUCT32 lpDropFileStruct;
BOOL32 bRet;
TRACE(shell,"\n");
lpDropFileStruct = (LPDROPFILESTRUCT32) GlobalLock32(hDrop);
memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT32));
bRet = lpDropFileStruct->fInNonClientArea;
GlobalUnlock32(hDrop);
return bRet;
}
/*************************************************************************
* DragQueryPoint16 [SHELL.13]
*/
BOOL16 WINAPI DragQueryPoint16(HDROP16 hDrop, POINT16 *p)
{
LPDROPFILESTRUCT16 lpDropFileStruct;
BOOL16 bRet; BOOL16 bRet;
TRACE(shell,"\n"); TRACE(shell,"\n");
lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock16(hDrop); lpDropFileStruct = (LPDROPFILESTRUCT16) GlobalLock16(hDrop);
memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT16)); memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT16));
bRet = lpDropFileStruct->fInNonClientArea; bRet = lpDropFileStruct->fInNonClientArea;

View File

@ -103,7 +103,7 @@ LRESULT NOTEPAD_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
case WM_DROPFILES: case WM_DROPFILES:
DragQueryFiles(wParam, 0, szFileName, sizeof(szFileName)); DragQueryFile(wParam, 0, szFileName, sizeof(szFileName));
printf("file %s to be opened by drag and drop !\n", szFileName); printf("file %s to be opened by drag and drop !\n", szFileName);
DragFinish(wParam); DragFinish(wParam);
break; break;

View File

@ -59,7 +59,7 @@ init Shell32LibMain
51 stdcall PathResolve(str long long) PathResolve 51 stdcall PathResolve(str long long) PathResolve
52 stdcall PathGetArgs(str) PathGetArgs 52 stdcall PathGetArgs(str) PathGetArgs
53 stub DoEnvironmentSubstW@8 # exported by name 53 stub DoEnvironmentSubstW@8 # exported by name
54 stdcall DragAcceptFiles(long long) DragAcceptFiles # exported by name 54 stdcall DragAcceptFiles(long long) DragAcceptFiles32
55 stub PathQuoteSpaces 55 stub PathQuoteSpaces
56 stdcall PathUnquoteSpaces(str) PathUnquoteSpaces 56 stdcall PathUnquoteSpaces(str) PathUnquoteSpaces
57 stdcall PathGetDriveNumber (str) PathGetDriveNumber32 57 stdcall PathGetDriveNumber (str) PathGetDriveNumber32
@ -85,9 +85,9 @@ init Shell32LibMain
77 stdcall SHMapPIDLToSystemImageListIndex(long long long) SHMapPIDLToSystemImageListIndex 77 stdcall SHMapPIDLToSystemImageListIndex(long long long) SHMapPIDLToSystemImageListIndex
78 stdcall OleStrToStrN(str long wstr long) OleStrToStrN 78 stdcall OleStrToStrN(str long wstr long) OleStrToStrN
79 stdcall StrToOleStrN(wstr long str long) StrToOleStrN 79 stdcall StrToOleStrN(wstr long str long) StrToOleStrN
80 stub DragFinish # exported by name 80 stdcall DragFinish(long) DragFinish32
81 stub DragQueryFile # exported by name 81 stdcall DragQueryFile(long long ptr long) DragQueryFile32A
82 stub DragQueryFileA # exported by name 82 stdcall DragQueryFileA(long long ptr long) DragQueryFile32A
83 stub CIDLData_CreateFromIDArray 83 stub CIDLData_CreateFromIDArray
84 stub SHIsBadInterfacePtr 84 stub SHIsBadInterfacePtr
85 stdcall OpenRegStream(long long long long) OpenRegStream 85 stdcall OpenRegStream(long long long long) OpenRegStream
@ -138,9 +138,9 @@ init Shell32LibMain
130 stub DAD_DragEnter 130 stub DAD_DragEnter
131 stub DAD_DragEnterEx 131 stub DAD_DragEnterEx
132 stub DAD_DragLeave 132 stub DAD_DragLeave
133 stub DragQueryFileW # exported by name 133 stdcall DragQueryFileW(long long ptr long) DragQueryFile32W
134 stub DAD_DragMove 134 stub DAD_DragMove
135 stub DragQueryPoint # exported by name 135 stdcall DragQueryPoint(long ptr) DragQueryPoint32
136 stub DAD_SetDragImage 136 stub DAD_SetDragImage
137 stdcall DAD_ShowDragImage (long) DAD_ShowDragImage 137 stdcall DAD_ShowDragImage (long) DAD_ShowDragImage
138 stub DuplicateIcon # exported by name 138 stub DuplicateIcon # exported by name