Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development


Reply
 
Share Thread Tools Display Modes
Old 05-11-2008, 12:16 PM   #46
Maximum Bitrate
 
bes51659's Avatar
 
Join Date: Sep 2005
Location: Stockholm, Sweden
Posts: 652
bes51659 is on a distinguished road
And then what happened?

Quote: Originally Posted by god_of_cpu View Post
Heres the keyboard hook program I was talking about earlier. Its actually two programs a DLL that contains the hook and a tray application that uses it. The main program does not have any of the logic in it to replace the numbers input with letters, but all that you should have to do to is add that logic and clean up some of the code a bit and it will compile fine.

Right now all the program does is replace whatever key you pressed with a '0' when the scroll lock key is toggled on, when its not toggled on, the keyboard works normally.

The real magic to this program happens in the OnKeyPress function in TrayApp.cpp. To make this program work as a phone input thing, you woudl simply have to replace the line iNewKey = '0'; with the logic for whatever key should be output. Just set iNewKey = 0; if you don't want to return anything for a key press, but are simply just count it. The wParam parameter of the OnKeyPress function contains the virtual key code of key that was pressed and it should return the key that should be replaced. The extra logic in the function is to make sure that the same keycode is returned for the keyup and for the keydown messages.

I don't have time to write this program myself, but I will answer any questions about the code.

You could also use the Kbhook.DLL from visual basic. To use it from VB or any language, just call SetGetMsgHook(hWnd, 0,0); where hWnd is a handle to your window. Then just look for the message with the value of WM_USER + 1068 when you recieve this message, you should process it just like it is processed in the OnKeyPress function in TrayApp.cpp

You should also call KillGetMsgHook from the dll when the program exits.

Souce for the dll can be found under kbhook folder. Run TrayApp.exe to see the program run. Just type stuff and if numlock is on it will be a 0.

http://www.mp3car.com/vbulletin/atta...nekeyboard.zip

Still there God? Or did someone else do the work on the plate served by him? Maybe even with T9?

I downloaded the code and was quite ready to do it myself, but I could not open the project files. I've got VC++ and VB 6.0. Project file seems to have extension vcproj! Is this .NET or something?

As I said, I am quite happy to do the work if someone can help me get the IDE going.

This is exactly the thing I need. Then I can input text everywhere with my phone, or a numeric keyboard.

B-O
bes51659 is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 05-12-2008, 02:28 PM   #47
Maximum Bitrate
 
bes51659's Avatar
 
Join Date: Sep 2005
Location: Stockholm, Sweden
Posts: 652
bes51659 is on a distinguished road
I downloaded visual studio c++ 2008 express.
It converted the project successfully.
But it seems like MFC is no longer there, as it cannot find afxwin.h (for starters).

AboutDlg.cpp
c:\carputer\download\remotecontrols\keyb\stdafx.h( 34) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory


Should I get visual 2005? Ideas?

Edit: Tried 2005, no change. Seems like the full 2008 VS does support MFC still, but not the express package!

Last edited by bes51659; 05-12-2008 at 03:24 PM.
bes51659 is offline   Reply With Quote
Old 05-13-2008, 02:19 PM   #48
Maximum Bitrate
 
bes51659's Avatar
 
Join Date: Sep 2005
Location: Stockholm, Sweden
Posts: 652
bes51659 is on a distinguished road
Got Visual 2008 pro, and I can now build the system.

And now I realize why God did not complete the job. VC locks up in debug if you set a breakpoint in the keyboard hook! I guess I have to write the code correct at once or debug remote.

btw. Is this of any interest to anyone?

Last edited by bes51659; 05-13-2008 at 02:23 PM.
bes51659 is offline   Reply With Quote
Old 05-19-2008, 06:58 PM   #49
Maximum Bitrate
 
bes51659's Avatar
 
Join Date: Sep 2005
Location: Stockholm, Sweden
Posts: 652
bes51659 is on a distinguished road
I've commited myself to finishing god's code and I am struggling. I've got the 2008 studio pro.

First of all i did not get remote debugging to work. For some reason the IDE cannot detect the running monitor on remote PC (no firewall, same user login, monitor exe is shared to remote PC from debugging PC...). It is difficult to debug a keyboard handler locally...

Second is that I cannot understand why not the keyboard hook is used. Or rather why it isn't working.
SetWindowsHookEx(WH_KEYBOARD, lpfnHookProc, hKBDll, dwThread);

The getmessage hock is used instead.
SetWindowsHookEx(WH_GETMESSAGE, lpfnHookProc, hKBDll, dwThread);

Last edited by bes51659; 05-19-2008 at 07:01 PM.
bes51659 is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alpha Release: XMPC-CAR for XM gork Software & Software Development 88 01-11-2006 01:19 PM
GPS/MapPoint VB Source Code stevieg Software & Software Development 4 06-08-2004 03:24 PM
XMPC-CAR source code now available! gork Software & Software Development 6 04-06-2004 01:33 PM
Questions for developers SuperG35 ME Archive 28 08-26-2003 11:12 AM
Dos MP3 player/decoder source code? Fosgate Software & Software Development 4 03-23-2000 04:46 AM



All times are GMT -5. The time now is 12:57 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics