我能够将图像添加到按钮作为背景,但后来我想将文本添加到按钮作为“Weclome”,我尝试了使用 Settext、SendmessageA 的所有可能方式。请帮忙
#include <Windows.h>
int main()
{
MSG msg;
HWND hWnd = CreateWindow(TEXT("button"), TEXT("START"), WS_VISIBLE | WS_POPUP | WS_CHILD | WS_TABSTOP | BS_BITMAP,
250, 250, 500, 500, NULL, NULL, NULL, NULL);
HANDLE hImg = LoadImageW(NULL, L"Untitled.bmp", IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_LOADFROMFILE);
SendMessageW(hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hImg);
SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"Welcome");
//SendMessageW(hWnd, WM_SETTEXT, (WPARAM) 256,NULL);
while (GetMessage(&msg, NULL, 0, 0))
{
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int)msg.wParam;
}