Implementation of OLE32.IsAccelerator
Dmitry Timoshkov
dmitry at sloboda.ru
Sun Apr 15 05:48:36 CDT 2001
Hello.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Implementation of OLE32.IsAccelerator.
diff -u cvs/hq/wine/dlls/ole32/ole2.c wine/dlls/ole32/ole2.c
--- cvs/hq/wine/dlls/ole32/ole2.c Mon Feb 12 09:22:01 2001
+++ wine/dlls/ole32/ole2.c Sun Apr 15 15:39:03 2001
@@ -21,12 +21,14 @@
#include "wine/obj_clientserver.h"
#include "wine/winbase16.h"
#include "wine/wingdi16.h"
+#include "wine/winuser16.h"
#include "debugtools.h"
#include "ole2ver.h"
#include "winreg.h"
#include "ole32_main.h"
DEFAULT_DEBUG_CHANNEL(ole);
+DECLARE_DEBUG_CHANNEL(accel);
/******************************************************************************
* These are static/global variables and internal data structures that the
@@ -1394,6 +1396,80 @@
}
return S_OK;
+}
+
+/******************************************************************************
+ * IsAccelerator [OLE32.75]
+ * Mostly copied from controls/menu.c TranslateAccelerator implementation
+ */
+BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* lpwCmd)
+{
+ /* YES, Accel16! */
+ LPACCEL16 lpAccelTbl;
+ int i;
+
+ if(!lpMsg) return FALSE;
+ if (!hAccel || !(lpAccelTbl = (LPACCEL16)LockResource16(hAccel)))
+ {
+ WARN_(accel)("invalid accel handle=%04x\n", hAccel);
+ return FALSE;
+ }
+ if((lpMsg->message != WM_KEYDOWN &&
+ lpMsg->message != WM_KEYUP &&
+ lpMsg->message != WM_SYSKEYDOWN &&
+ lpMsg->message != WM_SYSKEYUP &&
+ lpMsg->message != WM_CHAR)) return FALSE;
+
+ TRACE_(accel)("hAccel=%04x, cAccelEntries=%d,"
+ "msg->hwnd=%04x, msg->message=%04x, wParam=%08x, lParam=%08lx\n",
+ hAccel, cAccelEntries,
+ lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
+ for(i = 0; i < cAccelEntries; i++)
+ {
+ if(lpAccelTbl[i].key != lpMsg->wParam)
+ continue;
+
+ if(lpMsg->message == WM_CHAR)
+ {
+ if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY))
+ {
+ TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", lpMsg->wParam & 0xff);
+ goto found;
+ }
+ }
+ else
+ {
+ if(lpAccelTbl[i].fVirt & FVIRTKEY)
+ {
+ INT mask = 0;
+ TRACE_(accel)("found accel for virt_key %04x (scan %04x)\n",
+ lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff);
+ if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
+ if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
+ if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
+ if(mask == (lpAccelTbl[i].fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
+ TRACE_(accel)("incorrect SHIFT/CTRL/ALT-state\n");
+ }
+ else
+ {
+ if(!(lpMsg->lParam & 0x01000000)) /* no special_key */
+ {
+ if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000))
+ { /* ^^ ALT pressed */
+ TRACE_(accel)("found accel for Alt-%c\n", lpMsg->wParam & 0xff);
+ goto found;
+ }
+ }
+ }
+ }
+ }
+
+ WARN_(accel)("couldn't translate accelerator key\n");
+ return FALSE;
+
+found:
+ if(lpwCmd) *lpwCmd = lpAccelTbl[i].cmd;
+ return TRUE;
}
/***********************************************************************
diff -u cvs/hq/wine/dlls/ole32/ole2stubs.c wine/dlls/ole32/ole2stubs.c
--- cvs/hq/wine/dlls/ole32/ole2stubs.c Mon Feb 12 09:26:16 2001
+++ wine/dlls/ole32/ole2stubs.c Sun Apr 15 15:16:05 2001
@@ -67,15 +67,6 @@
}
/******************************************************************************
- * IsAccelerator [OLE32.75]
- */
-BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* lpwCmd)
-{
- FIXME("(%x,%i,%p,%p), stub!\n", hAccel, cAccelEntries, lpMsg, lpwCmd);
- return TRUE;
-}
-
-/******************************************************************************
* SetConvertStg [OLE32.142]
*/
HRESULT WINAPI SetConvertStg(LPSTORAGE pStg, BOOL fConvert)
diff -u cvs/hq/wine/dlls/ole32/ole32.spec wine/dlls/ole32/ole32.spec
--- cvs/hq/wine/dlls/ole32/ole32.spec Tue Apr 10 08:47:24 2001
+++ wine/dlls/ole32/ole32.spec Sun Apr 15 14:47:15 2001
@@ -10,7 +10,7 @@
import kernel32.dll
import ntdll.dll
-debug_channels (ole relay storage)
+debug_channels (ole relay storage accel)
1 stub BindMoniker # stdcall (ptr long ptr ptr) return 0,ERR_NOTIMPLEMENTED
2 stdcall CLSIDFromProgID(wstr ptr) CLSIDFromProgID
More information about the wine-patches
mailing list