Commit cc3dcc4a authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Implementation of OLE32.IsAccelerator.

parent 973355f6
......@@ -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
......@@ -1396,6 +1398,80 @@ HRESULT WINAPI OleSetMenuDescriptor(
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;
}
/***********************************************************************
* ReleaseStgMedium [OLE32.140]
*/
......
......@@ -67,15 +67,6 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
}
/******************************************************************************
* 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)
......
......@@ -10,7 +10,7 @@ import rpcrt4.dll
import kernel32.dll
import ntdll.dll
debug_channels (ole relay storage)
debug_channels (accel ole relay storage)
1 stub BindMoniker # stdcall (ptr long ptr ptr) return 0,ERR_NOTIMPLEMENTED
2 stdcall CLSIDFromProgID(wstr ptr) CLSIDFromProgID
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment