|
Can anybody aid me in creating a DLL for WinCE (intel)?
I have managed to compile this into a DLL.
But when i try to access it, i get "Entry Point not found"..
Thanks
Mikael
|
|
|
|
|
It works on WINCE6.0, but the keycode always 0
Why?
|
|
|
|
|
if yes, which IDE i should using to compile this?
|
|
|
|
|
|
Hello, I note that if you run 2 different applications both doing key hooks, if one stops hooking it will also kill the hooking on the other app. Any workarround for this?
JD
|
|
|
|
|
Did you use different data segment names?
#pragma data_seg(".HOOKDATA") // Shared data (memory) among all instances.
ie .HOOKDATA1 and .HOOKDATA2
I am not a daily programmer in C but I assume, you may have to use different export names in the apps:
__declspec(dllexport) LRESULT CALLBACK g_LLKeyboardHookCallback(
let us know, if one ar both changes work for you
regards
josef
|
|
|
|
|
Hi and thanks a lot for the informative article. I tried it and it works fine, but I noticed that I will not get key events when the focus is not on my application. That of course is normal, but my question is how to make this hook global, so that all key events are caought, even though input focus is lost?
|
|
|
|
|
Hello Prathmesh,
Its is great to succeed a keyboard hook on Windows Mobile 5.0 Pocket PC Emulator and using your posted code.
Thank you very much.
But, I found that whenever I use my desktop keyboard, application works fine, but whenever I use Emulator keyboard, it does not work.
So request you, please guide me to trap Emulator keyboard events.
I had used same code as per your article.
Thank you.
Shashikant
|
|
|
|
|
Hello Sir,
I had gone through your above article. It is very informative and helpful. Thank you for posting such article.
Well,
I have to code a hook in WinCE using SetWinEventHook.
I had tried your explained method as above, but not able to create hook. I am getting following errors -
Generating Code...
Compiling resources...
Linking...
MainFrm.obj : error LNK2019: unresolved external symbol "struct HWINEVENTHOOK__ * __cdecl SetWinEventHook(unsigned long,unsigned long,struct HINSTANCE__ *,void (__cdecl*)(struct HWINEVENTHOOK__ *,unsigned long,struct HWND__ *,long,long,unsigned long,unsigned long),unsigned long,unsigned long,unsigned long)" (?SetWinEventHook@@YAPAUHWINEVENTHOOK__@@KKPAUHINSTANCE__@@P6AXPAU1@KPAUHWND__@@JJKK@ZKKK@Z) referenced in function "protected: int __cdecl CMainFrame::OnCreate(struct tagCREATESTRUCTW *)" (?OnCreate@CMainFrame@@IAAHPAUtagCREATESTRUCTW@@@Z)
Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\Release/ScureApp.exe : fatal error LNK1120: 1 unresolved externals
Please have a quick look on my code as follows -
my MainFrm :: OnCreate() contains
g_hHkApiDLL = LoadLibrary(_T("user32.dll"));
g_hHkApiDLLBox = LoadLibrary(_T("coredll.dll"));
if((g_hHkApiDLLBox && g_hHkApiDLL) == NULL)
{
AfxMessageBox(_T("Error to load coredll.dll"));
//something is awfully wrong
//the dll has to be present
return false;
}
else
{
//load the SetWindowsHookEx API call
//the SetWindowsHookEx function installs an application-defined hook procedure into a hook chain.
//You would install a hook procedure to monitor the system for certain types of events.
//here we use use the hook to monitor kyeboard events
LPTSTR pSetWinEventHook;
pSetWinEventHook = (LPTSTR)GetProcAddress(g_hHkApiDLLBox, _T("SetWinEventHook"));
if(pSetWinEventHook == NULL)
{
AfxMessageBox(_T("Error to install hook procedure"));
//this means that MS has really stopped supporting this API in WinCE
return false;
}
else
{
//SetWindowRetProcHook (TRUE);
// hEvtHook = SetWinEventHook (EVENT_MIN, EVENT_MAX,
hEvtHook = SetWinEventHook (EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND,
NULL, ForegroundProc, 0, 0,
WINEVENT_OUTOFCONTEXT);
}
}
My ForgroundProc as follows -
VOID CALLBACK ForegroundProc( HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd,LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime )
{
AfxMessageBox(_T("Inside ForegroundProc"));
TCHAR buf[MAX_PATH];
HWND hWndForeGroundWin = GetForegroundWindow();
if (GetClassName(hWndForeGroundWin, buf, MAX_PATH))
{
if (!_tcsicmp (buf, TEXT("IEFRAME")) ||
_tcsstr (buf, TEXT("Internet Explorer")) ||
!_tcsicmp (buf, TEXT("MozillaUIWindowClass")))
{
AfxMessageBox(TEXT("Found Internet Explorer_Server"));
}
}
}
Also we have declared in WinceKBkook.h file -
HINSTANCE g_hHookApiDLL = NULL; //handle to coredll.dll, where all the hook related APIs are present
HHOOK g_hInstalledLLKBDhook = NULL; //g_hInstalledLLKBDhook represents handle to the installed KB hook
#define EVENT_SYSTEM_FOREGROUND 0x0003
#define WINEVENT_OUTOFCONTEXT 0x0000 // Events are ASYNC
typedef VOID (CALLBACK* WINEVENTPROC)(
HWINEVENTHOOK hWinEventHook,
DWORD event,
HWND hwnd,
LONG idObject,
LONG idChild,
DWORD idEventThread,
DWORD dwmsEventTime);
//typedef HWINEVENTHOOK (WINAPI *SetWinEventHook)(DWORD, DWORD, HMODULE, WINEVENTPROC, DWORD, DWORD, DWORD);
//extern "C"
WINUSERAPI
HWINEVENTHOOK
WINAPI
SetWinEventHook(
__in DWORD eventMin,
__in DWORD eventMax,
__in_opt HMODULE hmodWinEventProc,
__in WINEVENTPROC pfnWinEventProc,
__in DWORD idProcess,
__in DWORD idThread,
__in DWORD dwFlags);
Now request you, please look into the code, and suggest me where I am getting wrong.
Thanks.
Regards,
Shashikant
|
|
|
|
|
Hi,
i am new to wince. I followed the steps from the following docs but i did not succeed.
http://linuxtogo.org/~koen/letux/bootloader/bsp/DOC/DotNET420Guide.html
http://linuxtogo.org/~koen/letux/doc/NET410Guide.htm
http://arm.co.kr/programs/read.php?board=qna&uid=409&cp=3&field=&keyWord=&PHPSESSID=c20fb1f1438ba974d7c2beca9a4c89c2
http://www.embedinfo.com/english/download/winces3ceb2410.pdf
if any one knows how to port wince to smdk2410 board please help me.
amiya kumar das
|
|
|
|
|
Thanks man your code work really fine.
I'll give the 5. Well documented, and simple.
Many thanks.
Dr.Luiji
Trust and you'll be trusted.
|
|
|
|
|
when codes run to g_hInstalledLLKBDhook = SetWindowsHookEx(WH_KEYBOARD_LL, LLKeyboardHookCallbackFunction, hInstance, 0);
it always ruturn NULL,and the error code is 5, it seems Access denied error.Please help.
|
|
|
|
|
hi Master.
I Want Mouse Hook for Wince
please Sample Source(Mouse Hooking)
Thank you
|
|
|
|
|
The KB Hook is very useful
But..Could I get the other message?
I want to get the MOUSE Hook, but I can not use the method to get the message
Could you tell me which way I can get the message??
Thanx~
|
|
|
|
|
Can u tell me why do u need a MOUSE hook message in WinCE?
|
|
|
|
|
I want to record the mouse action (position, click and drap) to a script
and to re-play the script in Win-CE
or any other solution for the requirement?
thank you~
|
|
|
|
|
Hi
I am new to the winCE enviornment. In my application I have to capture the Keyboards events and mouse events and than playback. I am able to trap the Keyboards events but unable to succed with Mouse events. Could you help me with the ways I can capture the mouse events on winCE and than Playback.
Shishir
|
|
|
|
|
Hi~Shishir
I am new, too;P
I use the following functions:
EnumWindows: to find the window handle
GetWindowLong: to add a my defined process
any issue, welcome to discuss ^_^
|
|
|
|
|
Hi,
I am a WinCE 4.2 based application developer. I have to trap all global mouse and virtual keyboard events in an applicationj. Can anybody tell me How to do that. It's very urgent.
A lot of thanks for any HELP.
Thanks,
Rahul
|
|
|
|
|
Hi,
I am using your code in a dialog based application. But I am getting compilation error.
winceKBhook.h(47) : error C2501: 'WINCEKBHOOK_API' : missing storage-class or type specifiers
where WINCEKBHOOK_API has been defined? I just added your two files. Am I missing something? Can you post a sample application. It will help a lot.
Thanks in advance.
With regards
A.Santosh
-- modified at 2:39 Tuesday 23rd May, 2006
|
|
|
|
|
Remove WINCEKBHOOK_API and you should be good.
|
|
|
|
|
Hi,
i'm using your winceKBhook functions on IPAQ6515 ( evc++ 4.0 ) and all seems work correctly.
I have only a problem which is to disable the Contacts Manager Button ( 0xCA )
and the Messages Manager Button ( 0xCB ).
I used this code for other two keys ( Make a Call 0x72 - Drop a Call 0x73 )
and works only for these ones.
---------------------------------------------------------------------------
if( K_CODE == 0x72 || K_CODE == 0x73 || K_CODE == 0xCA || K_CODE == 0xCB )
{
// Disable KeyBoard functions
EnableHardwareKeyboard(FALSE);
//Generate the keyboard press event of the mapped key
keybd_event(0, 0, 0, 0);
//release the mapped key
keybd_event(0, 0, KEYEVENTF_KEYUP, 0);
}
---------------------------------------------------------------------------
thanks
Vittorio
|
|
|
|
|
Hi,
i'm developing a simple application on IPAQ6515 ( evc++ 4.0 ).
My first scope is to disable some keys and i used the LLKeyboardHookCallbackFunction
to catch each key pressing.
After the HookActivation all work great but when return, CallNextHookEx(g_hInstalledLLKBDhook, nCode,wParam, lParam) give me always an access violation
a typical situation is like this:
g_hInstalledLLKBDhook = 1
nCode = 0
wParam = 738393240
lParam = 256
thanks
|
|
|
|
|
Hi there!
I am assuming that you get an access violation when the flow of control is in the low level callback function.
MSDN info starts-------------
When the call is in this function....
*int nCode = Specifies a code the hook procedure uses to determine how to process the message.
*WPARAM wParam = Specifies the identifier of the keyboard message.This parameter can be one of the following messages: WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP.
*LPARAM lParam = Pointer to a KBDLLHOOKSTRUCT structure.
MSDN info ends-------------
So I think the access violation is mailnly due to the manipulations that you are doing. So if possible can you post the code where the acces violation occurs.
Cheers!
PK
|
|
|
|
|
..You think good..fortunately i solved the problem!
the error was that i put the LLKeyboardHookCallbackFunction in the cpp which defines the entry point for the application, so CallNextHookEx was NULL!
Now all work greatly!
thanks a lot for your help
|
|
|
|
|