簡體   English   中英

Loadbitmap 與 x86 一樣編譯和運行良好,但在編譯為 x64 時不起作用

[英]Loadbitmap is compiling and working well as x86, but not working when compiling as x64

我是 C++ 的新手。 這是我從 WIN32 API 書中改編的代碼。 僅當調試中的 x86 模式打開時,它才能按需要工作。 當有 x64 時,它正在編譯但不工作。 我試圖將 GWL_HINSTANCE 更改為 GWLP_HINSTANCE 沒有結果。

hBmpBkgr = LoadBitmapW((HINSTANCE)GetWindowLongW(hWnd, GWLP_HINSTANCE), MAKEINTRESOURCEW(IDB_STONE));
hBkBrush = CreatePatternBrush(hBmpBkgr);
SetClassLongW(hWnd, GCLP_HBRBACKGROUND, (LONG)hBkBrush);

hBmpBall = LoadBitmapW((HINSTANCE)GetWindowLongW(hWnd, GWLP_HINSTANCE), MAKEINTRESOURCEW(IDB_BALL));
GetObjectW(hBmpBall, sizeof(bm), (LPSTR)&bm);

hMemDcFrame = CreateCompatibleDC(hdc);
hBmpFrame = CreateCompatibleBitmap(hdc, rect.right, rect.bottom);
SelectObject(hMemDcFrame, hBmpFrame);

SetGraphicsMode(hMemDcFrame, GM_ADVANCED);

SetClassLongW

Replaces the specified 32-bit (long) value at the specified offset into the extra class memory or the WNDCLASSEX structure for the class to which the specified window belongs.

注意:此 function 已被 SetClassLongPtr function 取代。 要編寫與 Windows 的 32 位和 64 位版本兼容的代碼,請使用SetClassLongPtr

此外,[ LoadBitmap可用於“要求”部分中指定的操作系統。 在后續版本中可能會更改或不可用。 相反,使用LoadImageDrawFrameControl 。]

更多詳情請參考: LoadBitmap

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM