阅读:3739回复:58
SOS!SOS!1SOS!!!
紧急求救了!
我是一个在这里连菜鸟都不是的小菜鸟 毕业的课题竟然被分到了\"远程控制系统\" 我是学习C#的 可是小组的其他人都要用DELPHI来编程!我一个弱女子也不能和他们争辩,但是现在我的东西就是做不出来, 请这里的DELPHI高手指点一二! 谁能告诉我远程控制服务器端的鼠标和键盘该如何来做? 我的好朋友.X.T.I.M不是学DELPHI的 他说这里的高手很多,让我在这里求救,请大师们多多指点! 不胜感激! |
|
最新喜欢:![]() |
沙发#
发布于:2002-06-10 15:49
这里不是驱动开发论坛吗?怎么有很多Delphi高手?我学过一点Delphi,不知你说的是做什么鼠标和键盘?
|
|
|
板凳#
发布于:2002-06-10 15:51
另外,你不给分谁愿意回答呀!
|
|
|
地板#
发布于:2002-06-10 16:38
另外,你不给分谁愿意回答呀! hi,楼上的,你怎么把MM吓跑了? |
|
地下室#
发布于:2002-06-10 16:41
没有吓跑呀!
|
|
|
5楼#
发布于:2002-06-10 16:47
没有吓跑呀! 难道你是MM吗? |
|
6楼#
发布于:2002-06-10 16:47
DELPHI可以调用API吧
|
|
7楼#
发布于:2002-06-10 19:17
其实你在客户端把鼠标事件记下来并记住对应于远程的坐标。 在远程再产生相应的鼠标事件就行了.......远程的图片要分成很小的矩形, 然后只传变化的区域!
|
|
|
8楼#
发布于:2002-06-11 13:27
呵呵~~我来了我来了~~大家支持支持!!LOW是我的好朋友!SDK里面实现是很简单的!可惜她们的导师想让她用DELPHI来做~~我还真的连DELPHI都没装过!这样吧~~我说说SDK里面的实现!并贴点代码~~大家帮着给她指点一下下面一贴的C在DELPHI里面该怎么做~~先谢了!就当帮助我吧~~改天如果我能帮的上的不用客气!
|
|
|
9楼#
发布于:2002-06-11 14:12
首先先来说说WINDOWS SDK环境下面的键盘响应机制!其实在WINDOWS SDK 环境下面所有的键盘和鼠标的输入输出都是靠消息来驱动的!也就是靠:
BOOL GetMessage( LPMSG lpMsg, // message information HWND hWnd, // handle to window UINT wMsgFilterMin, // first message UINT wMsgFilterMax // last message ); 这个函数来获得消息!然后使用: BOOL TranslateMessage( CONST MSG *lpMsg // message information ); 函数来翻译按键消息,这个时候我们就可以对消息做相应的处理了!我想在DELPHI里面应该也可以调用这两个函数来获得消息和翻译消息!如果是在C/SDK环境下开发!也就是拥有窗口过程的回调函数,就必须得使用这个函数将消息发给窗口过程回调函数!但是我想在DELPHI里面应该只要用上面两个函数就可以获得鼠标的消息了! LRESULT DispatchMessage( CONST MSG *lpmsg // message information ); 不过我也把原形放出来~如果要用得上就用~~一般应该是用不上的!除非你的窗口也是用CREATEWINDOWS函数来创建的!但是我想不会有人在DELPHI里面干这事!我建议在DELPHI里面可以把调用这个函数换成调用自己定义的键盘响应过程函数!比如你定义了一个函数名字叫做MYKEYPROC(),当然名字可以随便你起~~,因为是你自己定义的函数嘛,然后把消息当作参数传递过去~~下面再给出WINDOWS的MESSAGE的数据结构: typedef struct tagMSG { HWND hwnd; UINT message; WPARAM wParam; //重点! LPARAM lParam; //重点! DWORD time; POINT pt; } MSG, *PMSG; 另外也顺便给出鼠标坐标要用的坐标系数据结: typedef struct tagPOINT { LONG x; LONG y; } POINT, *PPOINT; 另外如果是要获得换档键之类的键是不是也同时按下了!我们可以使用这个函数: SHORT GetKeyState( int nVirtKey // virtual-key code ); 比方说,你要截获CTRL+ALT+X这三个键是不是同时按下了!你可以先响应X的消息[怎么响应下面详细的说!]!然后在消息响应里面做对CTRL和ALT两个键的状态检查~~如果都是TRUE那就是按下了!同理可知,因为你响应的是X的消息,而且CTRL和ALT的状态都是TRUE那么这三个键已经被同时按下了! 为了方面我再开一个贴! |
|
|
10楼#
发布于:2002-06-11 14:19
下面我给出SDK里面给出的键盘函数!
ActivateKeyboardLayout: Sets the input locale identifier for the calling thread or the current process. BlockInput: Blocks keyboard and mouse input events from reaching applications. EnableWindow: Enables or disables mouse and keyboard input to the specified window or control. GetActiveWindow: Retrieves the window handle to the active window attached to the calling thread\'s message queue. GetAsyncKeyState: Determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState. GetFocus: Retrieves the handle to the window that has the keyboard focus. GetKeyboardLayout: Retrieves the active input locale identifier for the specified thread. GetKeyboardLayoutList: Retrieves the input locale identifiers corresponding to the current set of input locales in the system. GetKeyboardLayoutName: Retrieves the name of the active input locale identifier. GetKeyboardState: Copies the status of the 256 virtual keys to the specified buffer. GetKeyNameText: Retrieves a string that represents the name of a key. GetKeyState: Retrieves the status of the specified virtual key. GetLastInputInfo: Retrieves the time of the last input event. IsWindowEnabled: Determines whether the specified window is enabled for mouse and keyboard input. keybd_event: Synthesizes a keystroke. LoadKeyboardLayout: Loads a new input locale identifier. MapVirtualKey: Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. MapVirtualKeyEx: Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. OemKeyScan Maps: OEM ASCII codes 0 through 0x0FF into the OEM scan codes and shift states. RegisterHotKey: Defines a system-wide hot key. SendInput: Synthesizes keystrokes, mouse motions, and button clicks. SetActiveWindow: Activates a window. SetFocus: Sets the keyboard focus to the specified window. SetKeyboardState: Copies a 256-byte array of keyboard key states into the calling thread\'s keyboard input-state table. ToAscii: Translates the specified virtual-key code and keyboard state to the corresponding character or characters. ToAsciiEx: Translates the specified virtual-key code and keyboard state to the corresponding character or characters. ToUnicode: Translates the specified virtual-key code and keyboard state to the corresponding Unicode character or characters. ToUnicodeEx: Translates the specified virtual-key code and keyboard state to the corresponding Unicode character or characters. UnloadKeyboardLayout: Unloads an input locale identifier. UnregisterHotKey Frees a hot key previously registered by the calling thread. VkKeyScan: Translates a character to the corresponding virtual-key code and shift state for the current keyboard. VkKeyScanEx: Translates a character to the corresponding virtual-key code and shift state. |
|
|
11楼#
发布于:2002-06-11 14:24
按的方法大同小异就不说
|
|
12楼#
发布于:2002-06-11 14:28
这些是所有的键盘功能键的消息
前面第一项是消息名 然后是消息的值 接着的是消息的作用的描述! “-”代表没有使用的消息! VK_LBUTTON 01 Left mouse button VK_RBUTTON 02 Right mouse button VK_CANCEL 03 Control-break processing VK_MBUTTON 04 Middle mouse button (three-button mouse) VK_XBUTTON1 05 Windows 2000 or later: X1 mouse button VK_XBUTTON2 06 Windows 2000 or later: X2 mouse button ― 07 Undefined VK_BACK 08 BACKSPACE key VK_TAB 09 TAB key ― 0A |
|
|
13楼#
发布于:2002-06-11 14:46
这些是响应的按键动作的消息:
WM_ACTIVATE WM_APPCOMMAND WM_CHAR //输入的非系统字符比如A-Z、数字、符号等!注意消息对按键的响应是单个字符的!比如输入了“ABCD”那么就要响应4次这个消息,并从MSG结构的WPARAM项里面得到按下的那个字符! WM_DEADCHAR //这个名字起的不怎么好听呵呵~~这个是响应非系统死键被按下的!比如一些特殊键盘的特殊键被按下! WM_GETHOTKEY //得到热键的时候响应的消息! WM_HOTKEY //热键被按下,具体是哪个热键按下要在响应WPARAM,并且这个热键必须是注册过的!前面给出过注册热键的函数! WM_KEYDOWN 一个非系统键被按下!同样可以在这里响应VK消息!消息是保存在MSG结构的WPARAM项里面的!LPARAM项是保留来传递子消息[如VK消息或其他]要传递的值的!可以为空! WM_KEYUP //一个非系统键被松开! WM_KILLFOCUS /失去焦点!!焦点的概念就是那个窗口正在被鼠标/键盘操作! WM_SETFOCUS //得到焦点! WM_SETHOTKEY //设置热键的时候响应的消息! WM_SYSCHAR //系统字符的输入,比如 WM_SYSDEADCHAR //系统死键,不用解释了!和非系统死键是一个概念! WM_SYSKEYDOWN //系统键被按下,比如END、HOME、PAGEUP、PAGEDOWN等! WM_SYSKEYUP //系统键被释放! WM_UNICHAR //宽字符输入! |
|
|
14楼#
发布于:2002-06-11 14:59
下面是鼠标的消息和主要消息的解释:
WM_APPCOMMAND WM_CAPTURECHANGED WM_LBUTTONDBLCLK //左键双击 WM_LBUTTONDOWN //左键按下 WM_LBUTTONUP //左键释放 WM_MBUTTONDBLCLK //双击! WM_MBUTTONDOWN //键被按下 WM_MBUTTONUP //键被释放 WM_MOUSEACTIVATE //鼠标被激活的时候响应的消息! WM_MOUSEHOVER //鼠标停留在CLIENT上的时候响应的消息,WINDOWS的任务栏自动隐藏的时候显示就靠这个玩意! WM_MOUSELEAVE //当鼠标离开当前CLIENT的时候响应的消息,WINDOWS的任务栏就是响应这个消息才隐藏的! WM_MOUSEMOVE //鼠标移动 WM_MOUSEWHEEL //鼠标轮被转动!有的鼠标没轮~~ WM_NCHITTEST WM_NCLBUTTONDBLCLK WM_NCLBUTTONDOWN WM_NCLBUTTONUP WM_NCMBUTTONDBLCLK WM_NCMBUTTONDOWN WM_NCMBUTTONUP WM_NCMOUSEHOVER WM_NCMOUSELEAVE WM_NCMOUSEMOVE WM_NCRBUTTONDBLCLK WM_NCRBUTTONDOWN WM_NCRBUTTONUP WM_NCXBUTTONDBLCLK WM_NCXBUTTONDOWN WM_NCXBUTTONUP WM_RBUTTONDBLCLK //右键双击 WM_RBUTTONDOWN //右键被按下 WM_RBUTTONUP //右键被释放 WM_XBUTTONDBLCLK WM_XBUTTONDOWN WM_XBUTTONUP |
|
|
15楼#
发布于:2002-06-11 15:02
鼠标函数:
DragDetect: Captures the mouse and tracks its movement until the user performs one or more specified actions. GetCapture: Gets a handle to the window that has captured the mouse. GetDoubleClickTime: Gets the double-click time for the mouse. GetMouseMovePointsEx: Gets the previous coordinates of the mouse or pen. GetLastInputInfo: Gets the time of the last input event. mouse_event: Synthesizes mouse motion and button clicks. ReleaseCapture: Releases the mouse capture and restores mouse input processing. SetCapture: Sets the mouse capture to a window. SetDoubleClickTime: Sets the double-click time for the mouse. SwapMouseButton: Reverses the left- and right-mouse buttons. TrackMouseEvent: or _TrackMouseEvent Posts messages when a mouse leaves a window or hovers over a window. |
|
|
16楼#
发布于:2002-06-11 15:08
如果这MM是美女的话,叫她陪我吃顿饭,我帮她做 :( :( :(
|
|
|
17楼#
发布于:2002-06-11 15:11
XTIM立马装个DELPHI就可以给她指导了,从C转向DELPHI应该很快。
可惜,我也是用C的帮不上忙。 |
|
18楼#
发布于:2002-06-11 15:18
再说说实现的流程,先在DELPHI里面调用函数获取和翻译消息!然后把这些消息传递到你自己定义的一个函数里面响应!
MSG数据结构的message项是个无符号整数,里面是WM开头的消息! WPARAM是其他子消息比如VK开头的消息! LPARAM是消息传递来的值,比如响应鼠标消息的时候坐标就在这里面!高位是Y,低位是X可以用强制转换成POINT数据结构的方法分离!但是DELPHI里面怎么实现高低位分离我就不知道了~~但是如果实在不行就先转换成一个字符串然后用LEFT、RIGHT两函数分别取高低位!然后再换成整数就可以了!我相信DELPHI里面一定也有LEFT和RIGHT功能的对应库函数,由于和C的不通用我就不说了! #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff)) #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) 这是C里面取高位和低位宏的定义~~ |
|
|
19楼#
发布于:2002-06-11 15:20
老X啊,这些大家都懂,相信低低小姐也懂,她只是不会Delphi啊 :( :( :(
btw,为什么你有女子朋友而我没有? :( :( :( |
|
|
上一页
下一页