From 864081102a5f252415f41950b3039a896b4ae9c5 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Mon, 8 Oct 2012 18:43:29 +0000 Subject: Awkwars's plugins - welcome to our trunk git-svn-id: http://svn.miranda-ng.org/main/trunk@1822 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Watrack/status/i_hotkey.inc | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 plugins/Watrack/status/i_hotkey.inc (limited to 'plugins/Watrack/status/i_hotkey.inc') diff --git a/plugins/Watrack/status/i_hotkey.inc b/plugins/Watrack/status/i_hotkey.inc new file mode 100644 index 0000000000..3ad23ae656 --- /dev/null +++ b/plugins/Watrack/status/i_hotkey.inc @@ -0,0 +1,62 @@ +{main hotkey code} +function InsertProc(wParam:WPARAM;lParam:LPARAM):int_ptr; cdecl; +var + CurWin:HWND; + s:pWideChar; + p:PAnsiChar; + isUnicode:boolean; + i:integer; + j:integer; + tt:tTemplateType; +begin + result:=0; + if DisablePlugin=dsPermanent then + exit; + if Loword(LastStatus)<>WAT_PLS_NORMAL then + exit; +// i:=CallService(MS_WAT_GETMUSICINFO,0,0); + if UseMessages=BST_CHECKED then + begin + CurWin:=GetFocus; + if CurWin<>0 then + begin +// j:=WndToContact(WaitFocusedWndChild(GetForegroundwindow){GetFocus}); + j:=WndToContact(CurWin); + p:=GetContactProtoAcc(j); +// p:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,j,0)); + if DBReadByte(j,p,'ChatRoom',0)=1 then + begin + isUnicode:=false; + tt:=tmpl_chat; + end + else + begin + isUnicode:=true; + tt:=tmpl_pm; + end; + if SimpleMode<>BST_UNCHECKED then + i:=0 + else + i:=FindProto(p); + s:=GetMacros(tt,i); + // not empty and not disabled + if (s<>nil) and (uint_ptr(s)<>uint_ptr(-1)) then + begin + if StrScanW(s,'{')<>nil then + SendRTF(CurWin,s,isUnicode,UserCP) + else + begin + if isUnicode then + SendMessageW(CurWin,EM_REPLACESEL,0,tlparam(s)) + else + begin + SendMessageA(CurWin,EM_REPLACESEL,0,tlparam(WideToAnsi(s,p,UserCP))); + mFreeMem(p); + end; + end; + mFreeMem(s); + end; + result:=1; + end; + end; +end; -- cgit v1.2.3