1、VB怎么调用这个光标
(如果Me.Show不影响你的Project整体效果的话)
在Text1.SetFocus一句上边加上Me.Show就OK了~
2、visal C++6.0 读鼠标形状
LoadCursor
函数原型
HCURSOR LoadCursor
(
HINSTANCE hInstance,
LPCTSTR lpCursorName
);
参数一是实例句柄,
参数二是鼠标的样式名称
其中系统自定义了几种
IDC_APPSTARTING
Standard arrow and small hourglass
IDC_ARROW
Standard arrow
IDC_CROSS
Crosshair
IDC_HAND
Windows 98/Me, Windows 2000/XP: Hand
IDC_HELP
Arrow and question mark
IDC_IBEAM
I-beam
IDC_ICON
Obsolete for applications marked version 4.0 or later.
IDC_NO
Slashed circle
IDC_SIZE
Obsolete for applications marked version 4.0 or later. Use IDC_SIZEALL.
IDC_SIZEALL
Four-pointed arrow pointing north, south, east, and west
IDC_SIZENESW
Double-pointed arrow pointing northeast and southwest
IDC_SIZENS
Double-pointed arrow pointing north and south
IDC_SIZENWSE
Double-pointed arrow pointing northwest and southeast
IDC_SIZEWE
Double-pointed arrow pointing west and east
IDC_UPARROW
Vertical arrow
IDC_WAIT
Hourglass
当然也可以自己定义,添加资源,选中curson这个选项之后,把你做的cur鼠标图标选进来,编辑一下ID号就可以了,
然后SetCursor就可以了,
程序可以这样
HCURSOR hCurs;
hCurs = LoadCursor(NULL, IDC_WAIT);
SetCursor(hCurs);
如果你想设置鼠标位置
SetCursorPos(x,y);
这样鼠标就出来了。
3、VC++ 鼠标光标移动到按钮上时变成IDC_SIZEWE光标!如何实现???
BOOL CMFCTestDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)因为内WM_SetCursor是由OnMouseMove(鼠标移动)容事件发送的,鼠标移动一次,便发送一次WM_SetCursor消息,所以你的程序才会运行时就会改变光标。
4、怎样改变光标形状
HCURSOR LoadCursor( HINSTANCE hInstance, // handle to application instance LPCTSTR lpCursorName // name or resource identifier ); 第二个参数可选 IDC_APPSTARTING Standard arrow and small hourglass IDC_ARROW Standard arrow IDC_CROSS Crosshair IDC_HAND Windows 98/Me, Windows 2000/XP: Hand IDC_HELP Arrow and question mark IDC_IBEAM I-beam IDC_ICON Obsolete for applications marked version 4.0 or later. IDC_NO Slashed circle IDC_SIZE Obsolete for applications marked version 4.0 or later. Use IDC_SIZEALL. IDC_SIZEALL Four-pointed arrow pointing north, south, east, and west IDC_SIZENESW Double-pointed arrow pointing northeast and southwest IDC_SIZENS Double-pointed arrow pointing north and south IDC_SIZENWSE Double-pointed arrow pointing northwest and southeast IDC_SIZEWE Double-pointed arrow pointing west and east IDC_UPARROW Vertical arrow IDC_WAIT Hourglass
采纳哦
5、wndcls.hIcon=LoadIcon(NULL,IDC_ERROR); wndcls.hCursor=LoadCursor(NULL,IDC_HELP);
HCURSOR LoadCursor(
HINSTANCE hInstance, // handle to application instance
LPCTSTR lpCursorName // name string or cursor resource identifier
);
装载系统定义的鼠标,hInstance为零
装载其他进程的鼠标,才要设置hInstance
系统定义的鼠标有:
IDC_APPSTARTING Standard arrow and small hourglass
IDC_ARROW Standard arrow
IDC_CROSS Crosshair
IDC_HAND Windows NT 5.0 and later: Hand
IDC_HELP Arrow and question mark
IDC_IBEAM I-beam
IDC_ICON Obsolete for applications marked version 4.0 or later.
IDC_NO Slashed circle
IDC_SIZE Obsolete for applications marked version 4.0 or later. Use IDC_SIZEALL.
IDC_SIZEALL Four-pointed arrow pointing north, south, east, and west
IDC_SIZENESW Double-pointed arrow pointing northeast and southwest
IDC_SIZENS Double-pointed arrow pointing north and south
IDC_SIZENWSE Double-pointed arrow pointing northwest and southeast
IDC_SIZEWE Double-pointed arrow pointing west and east
IDC_UPARROW Vertical arrow
IDC_WAIT Hourglass
6、MFC视类和框架类窗口问题
mfc源码
BOOL CView::PreCreateWindow(CREATESTRUCT & cs)
{
ASSERT(cs.style & WS_CHILD);
if (cs.lpszClass == NULL)
{
VERIFY(AfxDeferRegisterClass(AFX_WNDFRAMEORVIEW_REG));
cs.lpszClass = _afxWndFrameOrView; // COLOR_WINDOW background
}
if (afxData.bWin4 && (cs.style & WS_BORDER))
{
cs.dwExStyle |= WS_EX_CLIENTEDGE;
cs.style &= ~WS_BORDER;
}
return TRUE;
}
7、MFC编程中Windows系统提供的19种标准光标有哪些?
16种图标分别是:
IDC_APPSTARTING 标准的箭头和小沙漏
IDC_ARROW 标准的箭头
IDC_CROSS 十字光标
IDC_HAND Windows 98/Me, Windows 2000/XP: Hand
IDC_HELP 标准的箭头和问号
IDC_IBEAM 工字光标
IDC_ICON Obsolete for applications marked version 4.0 or later.
IDC_NO 禁止圈
IDC_SIZE Obsolete for applications marked version 4.0 or later. Use IDC_SIZEALL.
IDC_SIZEALL 四向箭头指向东、西、南、北
IDC_SIZENESW 双箭头指向东北和西南
IDC_SIZENS 双箭头指向南北
IDC_SIZENWSE 双箭头指向西北和东南
IDC_SIZEWE 双箭头指向东西
IDC_UPARROW 垂直箭头
IDC_WAIT 沙漏,Windows7系统下会显示为选择的圆圈表示等待
8、MFC中,MAKEINTRESOURCE(32649)是什么意思
这个不需要奇怪,这个数字只是系统预定义的图标资源的ID号。
在win95系统中开始有这些通用图标资源,但HAND是特殊的,从win2000(ME)才有。因此弄了这么个宏判断(#ifndef)
系统图标在系统头文件winuser.h中已经定义如下:
#define IDC_ARROW MAKEINTRESOURCE(32512)至于那个MAKEINTRESOURCE,只是一个预定义的宏,没有什么意义,只是从ID号转换为内部资源编号的一个强制转换罢了,定义如下:
#define MAKEINTRESOURCE(i) (LPSTR)((DWORD)((WORD)(i)))
9、sdk 分隔窗口 代码
|#include <windows.h>
#include <commctrl.h>
#pragma comment(lib, "comctl32.lib")
#include "resource.h"
HINSTANCE hInst;
HWND hMain, hTree, hList, hStatus, hSplitter;
LRESULT CALLBACK ProcSplitter(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
static int x;
switch (Msg)
{
case WM_LBUTTONDOWN:
{
HDC hdc;
RECT rectTree;
SetCapture(hwnd);
GetWindowRect(hTree, &rectTree);
hdc = GetDC(GetParent(hwnd));
SelectObject(hdc, CreatePen(PS_SOLID, 2, 0));
SetROP2(hdc, R2_NOTXORPEN);
x = rectTree.right - rectTree.left;
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, rectTree.bottom - rectTree.top);
ReleaseDC(GetParent(hwnd), hdc);
}
break;
case WM_LBUTTONUP:
{
HDWP hdwp;
HDC hdc;
RECT rect, rectTree, rectStatus;
GetClientRect(GetParent(hwnd), &rect);
GetWindowRect(hTree, &rectTree);
GetClientRect(hStatus, &rectStatus);
hdc = GetDC(GetParent(hwnd));
SelectObject(hdc, CreatePen(PS_SOLID, 2, 0));
SetROP2(hdc, R2_NOTXORPEN);
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, rectTree.bottom - rectTree.top);
ReleaseDC(GetParent(hwnd), hdc);
ReleaseCapture();
hdwp = BeginDeferWindowPos(3);
DeferWindowPos(hdwp, hTree, NULL, 0, 0, x, rect.bottom - rectStatus.bottom, SWP_NOMOVE | SWP_NOZORDER);
DeferWindowPos(hdwp, hSplitter, NULL, x, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
DeferWindowPos(hdwp, hList, NULL, x + 2, 0, rect.right - x - 2, rect.bottom - rectStatus.bottom, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
}
break;
case WM_MOUSEMOVE:
{
if ((wParam & MK_LBUTTON) == MK_LBUTTON && GetCapture() == hwnd)
{
HDC hdc;
RECT rectTree;
GetWindowRect(hTree, &rectTree);
hdc = GetDC(GetParent(hwnd));
SelectObject(hdc, CreatePen(PS_SOLID, 2, 0));
SetROP2(hdc, R2_NOTXORPEN);
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, rectTree.bottom - rectTree.top);
x = rectTree.right - rectTree.left + (short)LOWORD(lParam);
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, rectTree.bottom - rectTree.top);
ReleaseDC(GetParent(hwnd), hdc);
}
}
break;
default:
return DefWindowProc(hwnd, Msg, wParam, lParam);
}
return 0;
}
void RegisterSplitter(void)
{
WNDCLASS wc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH)COLOR_BTNSHADOW;
wc.hCursor = LoadCursor(NULL, IDC_SIZEWE);
wc.hIcon = NULL;
wc.hInstance = hInst;
wc.lpfnWndProc = (WNDPROC)ProcSplitter;
wc.lpszClassName = "MySplitter";
wc.lpszMenuName = NULL;
wc.style = 0;
RegisterClass(&wc);
}
LRESULT CALLBACK ProcMain(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_INITDIALOG:
{
hTree = GetDlgItem(hDlg, IDC_TREE1);
hList = GetDlgItem(hDlg, IDC_LIST1);
hStatus = CreateStatusWindow(WS_CHILD | WS_VISIBLE, "", hDlg, 1003);
RegisterSplitter();
hSplitter = CreateWindowEx(0, "MySplitter", "Splitter Demo", WS_VISIBLE | WS_CHILD, 180, 0, 3, 15, hDlg, (HMENU)1004, hInst, NULL);
SendMessage(hDlg, WM_SIZE, 0, 0);
}
break;
case WM_CLOSE:
EndDialog(hDlg, 0);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_SIZE:
{
HDWP hdwp;
RECT rect, rectStatus, rectTree;
hdwp = BeginDeferWindowPos(4);
GetClientRect(hDlg, &rect);
GetClientRect(hStatus, &rectStatus);
GetWindowRect(hTree, &rectTree);
DeferWindowPos(hdwp, hStatus, NULL, 0, rect.bottom - rectStatus.bottom, rect.right, rectStatus.bottom, SWP_NOZORDER);
DeferWindowPos(hdwp, hTree, NULL, 0, 0, rectTree.right - rectTree.left, rect.bottom - rectStatus.bottom, SWP_NOMOVE | SWP_NOZORDER);
DeferWindowPos(hdwp, hSplitter, NULL, rectTree.right - rectTree.left, 0, 2, rect.bottom - rectStatus.bottom, SWP_NOZORDER);
DeferWindowPos(hdwp, hList, NULL, rectTree.right - rectTree.left + 2, 0, rect.right - rectTree.right + rectTree.left - 2, rect.bottom - rectStatus.bottom, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
}
break;
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
InitCommonControls();
hInst = hInstance;
DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_DLG_MAIN), NULL, (DLGPROC)ProcMain, 0);
return 0;
}
10、如何获取系统当前 鼠标指针样式的值
HCURSOR hcur = GetCursor();
HCURSOR harrow = AfxGetApp()-> LoadStandardCursor(IDC_ARROW);
if(hcur == harrow)
{
}
IDC_APPSTARTING 标准的箭头和小沙漏
IDC_ARROW 标准的箭头
IDC_CROSS 十字光标
IDC_HELP 标准的箭头和问号内
IDC_IBEAM 工字光标
IDC_NO 禁止圈
IDC_SIZEALL 四向箭容头指向东、西、南、北
IDC_SIZENESW 双箭头指向东北和西南
IDC_SIZENS 双箭头指向南北
IDC_SIZENWSE 双箭头指向西北和东南
IDC_SIZEWE 双箭头指向东西
IDC_UPARROW 垂直箭头
IDC_WAIT 沙漏