本文整理汇总了C++中LoadCursorW函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadCursorW函数的具体用法?C++ LoadCursorW怎么用?C++ LoadCursorW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LoadCursorW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitApplication
static BOOL InitApplication(HINSTANCE hInstance)
{
WNDCLASSEXW wc;
/* Load the application description strings */
LoadStringW(hInstance, IDS_DESCRIPTION, szTitle, sizeof(szTitle)/sizeof(WCHAR));
/* Fill in window class structure with parameters that describe the
main window */
wc.cbSize = sizeof(WNDCLASSEXW);
wc.style = CS_HREDRAW | CS_VREDRAW; /* Class style(s) */
wc.lpfnWndProc = WndProc; /* Window Procedure */
wc.cbClsExtra = 0; /* No per-class extra data */
wc.cbWndExtra = 0; /* No per-window extra data */
wc.hInstance = hInstance; /* Owner of this class */
wc.hIcon = NULL;
wc.hIconSm = NULL;
wc.hCursor = LoadCursorW(NULL, (LPWSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); /* Default color */
wc.lpszMenuName = szAppName; /* Menu name from .rc */
wc.lpszClassName = szAppName; /* Name to register as */
if (!RegisterClassExW(&wc)) return FALSE;
/* Call module specific initialization functions here */
return TRUE;
}
示例2: _glfwRegisterWindowClass
// Registers the GLFW window class
//
GLboolean _glfwRegisterWindowClass(void)
{
WNDCLASSW wc;
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) windowProc;
wc.cbClsExtra = 0; // No extra class data
wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer
wc.hInstance = GetModuleHandleW(NULL);
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
wc.hbrBackground = NULL; // No background
wc.lpszMenuName = NULL; // No menu
wc.lpszClassName = _GLFW_WNDCLASSNAME;
// Load user-provided icon if available
wc.hIcon = LoadIconW(GetModuleHandleW(NULL), L"GLFW_ICON");
if (!wc.hIcon)
{
// No user-provided icon found, load default icon
wc.hIcon = LoadIconW(NULL, IDI_WINLOGO);
}
if (!RegisterClassW(&wc))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to register window class");
return GL_FALSE;
}
return GL_TRUE;
}
示例3: main
int main(int argc, char *argv[])
{
WNDCLASSW wc;
MSG msg;
ZeroMemory(&wc, sizeof (WNDCLASSW));
wc.lpszClassName = L"mainwin";
wc.lpfnWndProc = wndProc;
wc.hInstance = GetModuleHandle(NULL);
wc.hIcon = LoadIconW(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
RegisterClassW(&wc);
mainwin = CreateWindowExW(0,
L"mainwin", L"mainwin",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
400, 400,
NULL, NULL, GetModuleHandle(NULL), NULL);
if (argc > 1)
dialog = CreateWindowExW(WS_EX_CONTROLPARENT,
WC_DIALOG, L"",
WS_CHILD | WS_VISIBLE,
100, 100, 200, 200,
mainwin, NULL, GetModuleHandle(NULL), NULL);
else {
const BYTE dlgtemplate[] = {
0x01, 0x00, // version
0xFF, 0xFF, // signature
0x00, 0x00, 0x00, 0x00, // help
0x00, 0x00, 0x01, 0x00, // WS_EX_CONTROLPARENT
0x00, 0x00, 0x00, 0x50, // WS_CHILD | WS_VISIBLE
0x00, 0x00, // no controls
100, 0, // X/Y/Width/Height
100, 0,
100, 0,
100, 0,
0x00, 0x00, // menu
0x00, 0x00, // class
0x00, 0x00, // title
0x00, 0x00, 0x00, 0x00, // some padding
0x00, 0x00, 0x00, 0x00, // more padding
0x00, 0x00, 0x00, 0x00, // just to be safe
};
dialog = CreateDialogIndirectW(GetModuleHandle(NULL), (LPCDLGTEMPLATEW) dlgtemplate, mainwin, dlgproc);
}
printf("%I32X\n", EnableThemeDialogTexture(dialog, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB));
ShowWindow(mainwin, SW_SHOWDEFAULT);
UpdateWindow(mainwin);
while (GetMessageW(&msg, NULL, 0, 0) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
示例4: RegisterSystemControls
BOOL WINAPI RegisterSystemControls(VOID)
{
WNDCLASSEXW WndClass;
UINT i;
ATOM atom;
if (RegisterDefaultClasses) return TRUE;
ZeroMemory(&WndClass, sizeof(WndClass));
WndClass.cbSize = sizeof(WndClass);
for (i = 0; i != sizeof(g_SysClasses) / sizeof(g_SysClasses[0]); i++)
{
WndClass.lpszClassName = g_SysClasses[i].desc->name;
// Set Global bit!
WndClass.style = g_SysClasses[i].desc->style|CS_GLOBALCLASS;
WndClass.lpfnWndProc = g_SysClasses[i].desc->procW;
WndClass.cbWndExtra = g_SysClasses[i].desc->extra;
WndClass.hCursor = LoadCursorW(NULL, g_SysClasses[i].desc->cursor);
WndClass.hbrBackground= g_SysClasses[i].desc->brush;
atom = RegisterClassExWOWW( &WndClass,
0,
g_SysClasses[i].fnid,
0,
FALSE);
if (atom)
RegisterDefaultClasses |= ICLASS_TO_MASK(g_SysClasses[i].ClsId);
}
return TRUE;
}
示例5: _glfwRegisterWindowClassWin32
// Registers the GLFW window class
//
GLFWbool _glfwRegisterWindowClassWin32(void)
{
WNDCLASSEXW wc;
ZeroMemory(&wc, sizeof(wc));
wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) windowProc;
wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer
wc.hInstance = GetModuleHandleW(NULL);
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
wc.lpszClassName = _GLFW_WNDCLASSNAME;
// Load user-provided icon if available
wc.hIcon = LoadImageW(GetModuleHandleW(NULL),
L"GLFW_ICON", IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED);
if (!wc.hIcon)
{
// No user-provided icon found, load default icon
wc.hIcon = LoadImageW(NULL,
IDI_APPLICATION, IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED);
}
if (!RegisterClassExW(&wc))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to register window class");
return GLFW_FALSE;
}
return GLFW_TRUE;
}
示例6: GetModuleHandleW
void Window::Register()
try {
HINSTANCE instanceHandle = GetModuleHandleW(nullptr);
WNDCLASSEXW windowClass;
ZeroMemory(&windowClass, sizeof(windowClass));
windowClass.cbSize = sizeof(WNDCLASSEXW);
windowClass.style = CS_OWNDC;
windowClass.lpfnWndProc = WindowHandleMessage;
windowClass.hInstance = instanceHandle;
windowClass.hIcon = LoadIconW(instanceHandle, MAKEINTRESOURCEW(IDI_ICON1));
windowClass.hCursor = LoadCursorW(nullptr, MAKEINTRESOURCEW(IDI_APPLICATION));
windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
windowClass.lpszMenuName = nullptr;
windowClass.lpszClassName = CLASS_NAME;
if (!RegisterClassExW(&windowClass)) {
throw std::runtime_error("Registration of Window failed");
}
wasRegistered = true;
} catch (std::runtime_error error) {
MessageBoxA(0, error.what(), "Error!", MB_ICONEXCLAMATION | MB_OK);
PostQuitMessage(-1);
}
示例7: RegisterIMEClass
BOOL
WINAPI
RegisterIMEClass(VOID)
{
WNDCLASSEXW WndClass;
ATOM atom;
ZeroMemory(&WndClass, sizeof(WndClass));
WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = imeW;
WndClass.style = CS_GLOBALCLASS;
WndClass.lpfnWndProc = ImeWndProcW;
WndClass.cbWndExtra = sizeof(LONG_PTR);
WndClass.hCursor = LoadCursorW(NULL, IDC_ARROW);
atom = RegisterClassExWOWW( &WndClass,
0,
FNID_IME,
0,
FALSE);
if (atom)
{
RegisterDefaultClasses |= ICLASS_TO_MASK(ICLS_IME);
TRACE("Register IME Class!\n");
return TRUE;
}
ERR("Failed to register IME Class!\n");
return FALSE;
}
示例8: RefreshTreeView
BOOL RefreshTreeView(HWND hwndTV)
{
HTREEITEM hItem;
HTREEITEM hSelectedItem;
HCURSOR hcursorOld;
HTREEITEM hRoot;
WINE_TRACE("\n");
hSelectedItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CARET, 0);
hcursorOld = SetCursor(LoadCursorW(NULL, (LPCWSTR)IDC_WAIT));
SendMessageW(hwndTV, WM_SETREDRAW, FALSE, 0);
hRoot = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_ROOT, 0);
hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hRoot);
while (hItem) {
RefreshTreeItem(hwndTV, hItem);
hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem);
}
SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0);
InvalidateRect(hwndTV, NULL, FALSE);
SetCursor(hcursorOld);
/* We reselect the currently selected node, this will prompt a refresh of the listview. */
SendMessageW(hwndTV, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hSelectedItem);
return TRUE;
}
示例9: registerWindowClass
/*--------------------------------------
* Function: registerWindowClass()
*------------------------------------*/
static void registerWindowClass(void) {
WNDCLASSEXW wcx = { 0 };
wchar_t* class_name = wstrdup(ClassName);
wcx.cbSize = sizeof(WNDCLASSEXW);
wcx.style = CS_HREDRAW | CS_VREDRAW;
wcx.lpfnWndProc = WindowProc;
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hInstance = GetModuleHandleW(NULL);
wcx.hIcon = LoadIconW(NULL, IDI_APPLICATION);
wcx.hCursor = LoadCursorW(NULL, IDC_ARROW);
wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcx.lpszMenuName = NULL;
wcx.lpszClassName = class_name;
wcx.hIconSm = NULL;
if (!RegisterClassExW(&wcx)) {
free(class_name);
error("could not register window class");
}
free(class_name);
}
示例10: register_classes
static BOOL WINAPI register_classes( INIT_ONCE *once, void *param, void **context )
{
WNDCLASSW wndClass;
ZeroMemory(&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS | CS_IME | CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc = IME_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 2 * sizeof(LONG_PTR);
wndClass.hInstance = x11drv_module;
wndClass.hCursor = LoadCursorW(NULL, (LPWSTR)IDC_ARROW);
wndClass.hIcon = LoadIconW(NULL, (LPWSTR)IDI_APPLICATION);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW +1);
wndClass.lpszMenuName = 0;
wndClass.lpszClassName = UI_CLASS_NAME;
RegisterClassW(&wndClass);
WM_MSIME_SERVICE = RegisterWindowMessageA("MSIMEService");
WM_MSIME_RECONVERTOPTIONS = RegisterWindowMessageA("MSIMEReconvertOptions");
WM_MSIME_MOUSE = RegisterWindowMessageA("MSIMEMouseOperation");
WM_MSIME_RECONVERTREQUEST = RegisterWindowMessageA("MSIMEReconvertRequest");
WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert");
WM_MSIME_QUERYPOSITION = RegisterWindowMessageA("MSIMEQueryPosition");
WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed");
return TRUE;
}
示例11: sizeof
// 初始化
HRESULT ThisApp::Initialize(HINSTANCE hInstance, int nCmdShow){
HRESULT hr = E_FAIL;
//register window class
WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = ThisApp::WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = sizeof(LONG_PTR);
wcex.hInstance = hInstance;
wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW);
wcex.hbrBackground = nullptr;
wcex.lpszMenuName = nullptr;
wcex.lpszClassName = L"Direct2DTemplate";
wcex.hIcon = nullptr;
// 注册窗口
::RegisterClassExW(&wcex);
// 计算窗口大小
RECT window_rect = { 0, 0, WNDWIDTH, WNDHEIGHT };
DWORD window_style = WS_OVERLAPPEDWINDOW;
::AdjustWindowRect(&window_rect, window_style, FALSE);
window_rect.right -= window_rect.left;
window_rect.bottom -= window_rect.top;
window_rect.left = (::GetSystemMetrics(SM_CXFULLSCREEN) - window_rect.right) / 2;
window_rect.top = (::GetSystemMetrics(SM_CYFULLSCREEN) - window_rect.bottom) / 2;
// 创建窗口
m_hwnd = ::CreateWindowExW(
#ifdef USING_DirectComposition
WS_EX_NOREDIRECTIONBITMAP,
#else
0,
#endif
wcex.lpszClassName, TITLE, window_style,
window_rect.left, window_rect.top, window_rect.right, window_rect.bottom,
0, 0, hInstance, this
);
hr = m_hwnd ? S_OK : E_FAIL;
// 设置窗口句柄
if (SUCCEEDED(hr)) {
hr = m_ImagaRenderer.SetHwnd(m_hwnd);
}
// 显示窗口
if (SUCCEEDED(hr)) {
::ShowWindow(m_hwnd, nCmdShow);
::UpdateWindow(m_hwnd);
m_threadRender.std::thread::~thread();
m_threadRender.std::thread::thread(
[this]() {
::CoInitialize(nullptr);
while (true) {
m_ImagaRenderer.OnRender(1);
if (m_bExit) break;
}
::CoUninitialize();
return S_OK;
}
);
}
return hr;
}
示例12: SdtSaveListToFile
/*
* SdtSaveListToFile
*
* Purpose:
*
* Dump table to the selected file
*
*/
VOID SdtSaveListToFile(
_In_ HWND hwndDlg
)
{
WCHAR ch;
INT BufferSize = 0;
INT numitems;
INT row, subitem;
SIZE_T sz, k;
LPWSTR pItem = NULL;
HCURSOR hSaveCursor;
HCURSOR hHourGlass;
WCHAR szTempBuffer[MAX_PATH + 1];
RtlSecureZeroMemory(szTempBuffer, sizeof(szTempBuffer));
_strcpy(szTempBuffer, TEXT("list.txt"));
if (supSaveDialogExecute(hwndDlg, (LPWSTR)&szTempBuffer, TEXT("Text files\0*.txt\0\0"))) {
hHourGlass = LoadCursorW(NULL, IDC_WAIT);
ch = (WCHAR)0xFEFF;
supWriteBufferToFile(szTempBuffer, &ch, sizeof(WCHAR), FALSE, FALSE);
SetCapture(hwndDlg);
hSaveCursor = SetCursor(hHourGlass);
numitems = ListView_GetItemCount(SdtDlgContext.ListView);
for (row = 0; row < numitems; row++) {
output[0] = 0;
for (subitem = 0; subitem < SdtDlgContext.lvColumnCount; subitem++) {
sz = 0;
pItem = supGetItemText(SdtDlgContext.ListView, row, subitem, &sz);
if (pItem) {
_strcat(output, pItem);
HeapFree(GetProcessHeap(), 0, pItem);
}
if (subitem == 1) {
for (k = 54; k > sz / sizeof(WCHAR); k--) {
_strcat(output, TEXT(" "));
}
}
else {
_strcat(output, TEXT("\t"));
}
}
_strcat(output, L"\r\n");
BufferSize = (INT)_strlen(output);
supWriteBufferToFile(szTempBuffer, output, BufferSize * sizeof(WCHAR), FALSE, TRUE);
}
SetCursor(hSaveCursor);
ReleaseCapture();
}
}
示例13: InitInstance
static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
WCHAR empty = 0;
WNDCLASSEXW wndclass = {0};
/* Frame class */
wndclass.cbSize = sizeof(WNDCLASSEXW);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = FrameWndProc;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT));
wndclass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
wndclass.lpszClassName = szFrameClass;
wndclass.hIconSm = LoadImageW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
RegisterClassExW(&wndclass);
/* Child class */
wndclass.lpfnWndProc = ChildWndProc;
wndclass.cbWndExtra = sizeof(HANDLE);
wndclass.lpszClassName = szChildClass;
RegisterClassExW(&wndclass);
hMenuFrame = LoadMenuW(hInstance, MAKEINTRESOURCEW(IDR_REGEDIT_MENU));
hPopupMenus = LoadMenuW(hInstance, MAKEINTRESOURCEW(IDR_POPUP_MENUS));
/* Initialize the Windows Common Controls DLL */
InitCommonControls();
/* register our hex editor control */
HexEdit_Register();
nClipboardFormat = RegisterClipboardFormatW(strClipboardFormat);
hFrameWnd = CreateWindowExW(0, szFrameClass, szTitle,
WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
if (!hFrameWnd) {
return FALSE;
}
/* Create the status bar */
hStatusBar = CreateStatusWindowW(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
&empty, hFrameWnd, STATUS_WINDOW);
if (hStatusBar) {
/* Create the status bar panes */
SetupStatusBar(hFrameWnd, FALSE);
CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
}
ShowWindow(hFrameWnd, nCmdShow);
UpdateWindow(hFrameWnd);
return TRUE;
}
示例14: FillTreeView
/******************************************************************************
* FillTreeView [Internal]
*
* For each child (given by lpe) of the parent shell folder, which is given by
* lpsf and whose PIDL is pidl, insert a treeview-item right under hParent
*
* PARAMS
* info [I] data for the dialog
* lpsf [I] IShellFolder interface of the parent shell folder
* pidl [I] ITEMIDLIST of the parent shell folder
* hParent [I] The treeview item that represents the parent shell folder
* lpe [I] An iterator for the children of the parent shell folder
*/
static void FillTreeView( browse_info *info, IShellFolder * lpsf,
LPITEMIDLIST pidl, HTREEITEM hParent, IEnumIDList* lpe)
{
HTREEITEM hPrev = 0;
LPITEMIDLIST pidlTemp = 0;
ULONG ulFetched;
HRESULT hr;
HWND hwnd = GetParent( info->hwndTreeView );
TRACE("%p %p %p %p\n",lpsf, pidl, hParent, lpe);
/* No IEnumIDList -> No children */
if (!lpe) return;
SetCapture( hwnd );
SetCursor( LoadCursorA( 0, (LPSTR)IDC_WAIT ) );
while (NOERROR == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))
{
ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;
IEnumIDList* pEnumIL = NULL;
IShellFolder* pSFChild = NULL;
IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs);
if (ulAttrs & SFGAO_FOLDER)
{
hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild);
if (SUCCEEDED(hr))
{
DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
hr = IShellFolder_EnumObjects(pSFChild, hwnd, flags, &pEnumIL);
if (hr == S_OK)
{
if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) ||
FAILED(IEnumIDList_Reset(pEnumIL)))
{
IEnumIDList_Release(pEnumIL);
pEnumIL = NULL;
}
}
IShellFolder_Release(pSFChild);
}
}
if (!(hPrev = InsertTreeViewItem(info, lpsf, pidlTemp, pidl, pEnumIL, hParent)))
goto done;
SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */
pidlTemp=NULL;
}
done:
ReleaseCapture();
SetCursor(LoadCursorW(0, (LPWSTR)IDC_ARROW));
SHFree(pidlTemp);
}
示例15: hugsprim_LoadCursorW_1
static void hugsprim_LoadCursorW_1(HugsStackPtr hugs_root)
{
HsPtr arg1;
HsPtr arg2;
HsPtr res1;
arg1 = hugs->getPtr();
arg2 = hugs->getPtr();
res1 = LoadCursorW(arg1, arg2);
hugs->putPtr(res1);
hugs->returnIO(hugs_root,1);
}