阅读:1653回复:16
如何用SDK函数替换鼠标光标?
绝对给分,有源码
救命!! |
|
|
沙发#
发布于:2002-07-25 13:35
SetClassLong(hWnd,GCL_HCURSOR,LoadCursorFromFile(\"c:\\\\*.ico\"));
|
|
|
板凳#
发布于:2002-07-25 13:46
HCURSOR hCursor = AfxGetApp()->LoadCursor(IDC_CUR_HAND);
::SetCursor(hCursor); ... ... ... 给分吧~ |
|
地板#
发布于:2002-07-25 13:46
请问斑竹,我用一个check box来触发 替换光标动作
其中的消息处理过程以及函数怎样? 我已经自己做了一个透明光标加在资源文件里面。 |
|
|
地下室#
发布于:2002-07-25 13:50
HCURSOR hCursor = AfxGetApp()->LoadCursor(IDC_CUR_HAND); 我并没有使用windows的类,不过为了鼓励,加分 |
|
|
5楼#
发布于:2002-07-25 13:56
TO LEO_CYL
对不起,我真的找不到那个加分的按钮了,下次一定。 只有先谢谢回复啦。 |
|
|
6楼#
发布于:2002-07-25 14:00
[quote]HCURSOR hCursor = AfxGetApp()->LoadCursor(IDC_CUR_HAND); 我并没有使用windows的类,不过为了鼓励,加分 [/quote] 呵呵……有没有分无所谓啦!我只是告诉你方法而已。你也可以用SDK函数: HCURSOR LoadCursor( HINSTANCE hInstance, // handle to application instance LPCTSTR lpCursorName // name or resource identifier ); |
|
7楼#
发布于:2002-07-25 14:10
呵呵……有没有分无所谓啦!我只是告诉你方法而已。你也可以用SDK函数:
HCURSOR LoadCursor( HINSTANCE hInstance, // handle to application instance LPCTSTR lpCursorName // name or resource identifier ); [/quote] 这个函数取得了一个光标句柄,我还用了另外一个函数SetCursor来设置光标。 但是没有效果,我不知道是不是捕捉的消息不对(BN_CLICKED) |
|
|
8楼#
发布于:2002-07-25 14:31
SetCursor:
The cursor is set only if the new cursor is different from the previous cursor; otherwise, the function returns immediately. The cursor is a shared resource. A window should set the cursor shape only when the cursor is in its client area or when the window is capturing mouse input. In systems without a mouse, the window should restore the previous cursor before the cursor leaves the client area or before it relinquishes control to another window. If your application must set the cursor while it is in a window, make sure the class cursor for the specified window\'s class is set to NULL. If the class cursor is not NULL, the system restores the class cursor each time the mouse is moved. The cursor is not shown on the screen if the internal cursor display count is less than zero. This occurs if the application uses the ShowCursor function to hide the cursor more times than to show the cursor. 用SetClassLong在整个窗口,光标有效。 |
|
|
9楼#
发布于:2002-07-25 15:25
我没有用微软的类,只使用sdk提供的函数解决怎么办?
|
|
|
10楼#
发布于:2002-07-25 15:28
SetClassLong(hWnd,GCL_HCURSOR,LoadCursorFromFile(\"c:\\\\*.ico\"));
这都是SDK函数啊。 |
|
|
11楼#
发布于:2002-07-25 15:36
多谢,要在头文件里面声明点什么东西吗?
忘记说明了,程序用的是c和api函数结合,没有类。 |
|
|
12楼#
发布于:2002-07-25 15:57
windows.h
你能显示出窗口就可以调用这些函数。 |
|
|
13楼#
发布于:2002-07-25 16:20
完蛋了完蛋了,编译通过但还是没有作用 :(
|
|
|
14楼#
发布于:2002-07-26 11:18
我找到了一个更好的函数
BOOL SetSystemCursor ( HCURSOR hcur, // handle to cursor DWORD id // system cursor identifier ); 好用! |
|
|
15楼#
发布于:2002-07-29 02:23
我找到了一个更好的函数 这样你好象只能使用系统提供的标准光标吧. |
|
16楼#
发布于:2002-07-29 11:03
是吗,不过我的问题到现在还没有解决
第一个取得光标句柄就出了问题,如何解决设置和取得全局变量? 第二个就是CHECK_BOX被触发后的消息是什么? |
|
|