git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@216 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-08 11:15:48 +00:00
parent 68e79e3d78
commit 12345525a5
7 changed files with 104 additions and 9 deletions

View File

@@ -108,9 +108,9 @@ MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) {
if(parent == NULL) {
u->old = NULL;
} else {
u->old = (WNDPROC)SetWindowLongPtr(r->hWnd, GWLP_WNDPROC, (LONG_PTR)wndproc);
u->old = (WNDPROC)SetWindowLongPtr(r->hWnd, GWLP_WNDPROC, (LPARAM)wndproc);
}
SetWindowLongPtr(r->hWnd, GWLP_USERDATA, (LONG_PTR)u);
SetWindowLongPtr(r->hWnd, GWLP_USERDATA, (LPARAM)u);
if(parent == NULL) {
RECT rc;
@@ -135,7 +135,7 @@ void MwLLDestroy(MwLL handle) {
MwLLDestroyCommon(handle);
/* for safety */
SetWindowLongPtr(handle->hWnd, GWLP_USERDATA, (LONG_PTR)NULL);
SetWindowLongPtr(handle->hWnd, GWLP_USERDATA, (LPARAM)NULL);
DestroyWindow(handle->hWnd);
free(handle);
@@ -361,7 +361,7 @@ void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
cursor = CreateCursor(GetModuleHandle(NULL), xs, ys, MwCursorDataHeight, MwCursorDataHeight, dmask, dimage);
SetClassLongPtr(handle->hWnd, GCLP_HCURSOR, (LONG_PTR)cursor);
SetClassLongPtr(handle->hWnd, GCLP_HCURSOR, (LPARAM)cursor);
SetCursor(cursor);
DestroyCursor(cursor);
@@ -372,7 +372,7 @@ void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask) {
void MwLLDetach(MwLL handle, MwPoint* point) {
RECT rc, rc2;
LONG_PTR style = GetWindowLongPtr(handle->hWnd, GWL_STYLE);
LPARAM style = GetWindowLongPtr(handle->hWnd, GWL_STYLE);
style |= WS_OVERLAPPEDWINDOW;

View File

@@ -7,7 +7,17 @@
#include <Mw/LowLevel.h>
#include <windows.h>
#ifndef GWLP_USERDATA
#define GWLP_USERDATA GWL_USERDATA
#define GWLP_WNDPROC GWL_WNDPROC
#define GCLP_HICON GCL_HICON
#define GCLP_HCURSOR GCL_HCURSOR
#define SetWindowLongPtr SetWindowLong
#define GetWindowLongPtr GetWindowLong
#define SetClassLongPtr SetClassLong
#define GetClassLongPtr GetClassLong
#endif
struct _MwLL {
HINSTANCE hInstance;
HWND hWnd;

View File

@@ -17,7 +17,7 @@ void setLastError(const char* fmt, ...) {
memset(out, 0, MAX_ERROR_LEN);
va_start(va, fmt);
vsnprintf(out, MAX_ERROR_LEN, fmt, va);
vsprintf(out, fmt, va);
va_end(va);
memcpy(error, out, MAX_ERROR_LEN);

View File

@@ -176,8 +176,8 @@ void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point) {
MwLLDetach(handle->lowlevel, point);
#ifdef _WIN32
SetWindowLongPtr(handle->lowlevel->hWnd, GWL_STYLE, (LONG_PTR)0);
SetWindowLongPtr(handle->lowlevel->hWnd, GWL_EXSTYLE, (LONG_PTR)WS_EX_TOOLWINDOW);
SetWindowLongPtr(handle->lowlevel->hWnd, GWL_STYLE, (LPARAM)0);
SetWindowLongPtr(handle->lowlevel->hWnd, GWL_EXSTYLE, (LPARAM)WS_EX_TOOLWINDOW);
#endif
MwLLShow(handle->lowlevel, 1);