Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

ich habe ein programm geschrieben. in diesem programm soll der mauszeiger beim drücken der linken mousetaste und beim bewegen geändert werden (IDC_HAND2). beim loslassen der linken taste soll dann der alte mousezeiger wieder gewählt werden (IDC_HAND1). die nachrichtenverarbeitung ist folgende.


LRESULT CALLBACK WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static Bitmap* lpImage = NULL;
static POINT pScrollStart = {0,0};
static int xOffset = 0;
static int yOffset = 0;
static int cxImage = 0;
static int cyImage = 0;

switch(uMsg)
{
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
case WM_OPENFILE:
{
LPSTR lpstrFile = (LPSTR)lParam;
if (lpImage != NULL)
delete lpImage;
lpImage = new Bitmap(L"C:\\img.jpg");
cxImage = lpImage->GetWidth();
cyImage = lpImage->GetHeight();
}
case WM_ERASEBKGND:
{
return (LRESULT)1; // Say we handled it.
}
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(hWnd, &ps);

RECT rc;
GetClientRect(hWnd, &rc);
HDC hdcMem = CreateCompatibleDC(ps.hdc);
HBITMAP hbmMem = (HBITMAP)CreateCompatibleBitmap(ps.hdc,
rc.right-rc.left,
rc.bottom-rc.top);

HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, hbmMem);

HBRUSH hbrBkGnd = CreateSolidBrush(GetSysColor(COLOR_WINDOW));

FillRect(hdcMem, &rc, hbrBkGnd);

DeleteObject(hbrBkGnd);

Graphics g (hdcMem);
g.DrawImage(lpImage, 0, 0, xOffset, yOffset, cxImage - xOffset, cyImage - yOffset, UnitPixel);

BitBlt(ps.hdc,
rc.left, rc.top,
RC_WIDTH(rc), RC_HEIGHT(rc),
hdcMem,
0, 0,
SRCCOPY);

SelectObject(hdcMem, hbmOld);
DeleteObject(hbmMem);
DeleteDC(hdcMem);

EndPaint(hWnd, &ps);

break;
}
case WM_SIZE:
{
RECT rc;
GetClientRect(hWnd, &rc);
xOffset = min (xOffset, max(cxImage - RC_WIDTH(rc), 0));
yOffset = min (yOffset, max(cyImage - RC_HEIGHT(rc), 0));
}
case WM_LBUTTONDOWN:
{
GetCursorPos(&pScrollStart);
SetCursor(LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HAND2)));
break;
}
case WM_LBUTTONUP:
{
SetCursor(LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HAND1)));
break;
}
case WM_MOUSEMOVE:
{
if ((wParam & MK_LBUTTON) == MK_LBUTTON)
{
POINT pnt;
GetCursorPos(&pnt);

RECT rc;
GetClientRect(hWnd, &rc);

int xNewOffset = -pnt.x + pScrollStart.x;
xOffset = max (xOffset + xNewOffset, 0);
xOffset = min (xOffset, max(cxImage - RC_WIDTH(rc), 0));

int yNewOffset = -pnt.y + pScrollStart.y;
yOffset = max (yOffset + yNewOffset, 0);
yOffset = min (yOffset, max(cyImage - RC_HEIGHT(rc), 0));

InvalidateRect(hWnd, &rc, FALSE);
UpdateWindow(hWnd);

pScrollStart = pnt;
SetCursor(LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HAND2)));
}
else
{
SetCursor(LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HAND1)));
}
}
}

return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
[/PHP]

Problem ist, das bei dieser verarbeitung der mauszeiger beim drücken der taste einwandfrei geändert wird, beim bewegen der maus aber wieder der alte (IDC_HAND1) benutzt wird. Wenn ich den Code änder, das bei der Verarbeitung der Nachricht WM_MOUSEMOVE nur der Zeiger geändert wird, läuft alles nach meinen Wünschen. WARUM ???

jo war der richtige gedanke. läuft super. besten dank

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.