本文整理汇总了C++中SetWindowTextA函数的典型用法代码示例。如果您正苦于以下问题:C++ SetWindowTextA函数的具体用法?C++ SetWindowTextA怎么用?C++ SetWindowTextA使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetWindowTextA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateDialogParam
CNewImage::CNewImage()
{
MSG msg;
BOOL ret;
m_hWnd = CreateDialogParam(GetModuleHandle(0), MAKEINTRESOURCE(IDD_NEWIMAGE), CRenderer::Get()->GetHWnd(), DialogProc, 0);
SetWindowTextA(GetDlgItem(m_hWnd, IDC_NWIDTH), "300");
SetWindowTextA(GetDlgItem(m_hWnd, IDC_NHEIGHT), "200");
SetWindowTextA(GetDlgItem(m_hWnd, IDC_NR), "255");
SetWindowTextA(GetDlgItem(m_hWnd, IDC_NG), "255");
SetWindowTextA(GetDlgItem(m_hWnd, IDC_NB), "255");
ShowWindow(m_hWnd, SW_SHOW);
while ((ret = GetMessage(&msg, 0, 0, 0)) != 0) {
if (ret == -1)
return;
if (!IsDialogMessage(m_hWnd, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
示例2: AddLine
void CListSide::AddLineAt(int nLine)
{
AddLine();
int nrLines = m_Lines.size();
for (int i = nrLines - 2; i>= nLine; i--)
{
HWND hWnd = m_Lines.at(i).edSecond.m_hWnd;
int len = GetWindowTextLengthA(hWnd);
char* str = NULL;
if (len)
{
len++;
str = new char[len];
GetWindowTextA(hWnd, str, len);
SetWindowTextA(hWnd, "0:00");
hWnd = m_Lines.at(i+1).edSecond.m_hWnd;
SetWindowTextA(hWnd, str);
delete[] str;
}
hWnd = m_Lines.at(i).edText.m_hWnd;
len = GetWindowTextLengthA(hWnd);
if (len)
{
len++;
str = new char[len];
GetWindowTextA(hWnd, str, len);
SetWindowTextA(hWnd, "");
hWnd = m_Lines.at(i+1).edText.m_hWnd;
SetWindowTextA(hWnd, str);
delete[] str;
}
}
}
示例3: SetWindowTextUTF8
BOOL SetWindowTextUTF8(HWND hwnd, LPCTSTR str)
{
if (WDL_HasUTF8(str) AND_IS_NOT_WIN9X)
{
DWORD pid;
if (GetWindowThreadProcessId(hwnd,&pid) == GetCurrentThreadId() &&
pid == GetCurrentProcessId() &&
!(GetWindowLong(hwnd,GWL_STYLE)&WS_CHILD))
{
LPARAM tmp = SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LPARAM)__forceUnicodeWndProc);
BOOL rv = SetWindowTextA(hwnd, str);
SetWindowLongPtr(hwnd, GWLP_WNDPROC, tmp);
return rv;
}
else
{
MBTOWIDE(wbuf,str);
if (wbuf_ok)
{
BOOL rv = SetWindowTextW(hwnd, wbuf);
MBTOWIDE_FREE(wbuf);
return rv;
}
MBTOWIDE_FREE(wbuf);
}
}
return SetWindowTextA(hwnd,str);
}
示例4: SetWindowTextForButton
inline void SetWindowTextForButton(HWND hEdit, u32 buttonCode, const char *pszButtonName)
{
if (buttonCode == 0) {
SetWindowTextA(hEdit, "Disable");
} else {
SetWindowTextA(hEdit, pszButtonName);
}
}
示例5: test_UDS_SETBUDDYINT
static void test_UDS_SETBUDDYINT(void)
{
HWND updown;
DWORD style, ret;
CHAR text[10];
/* cleanup buddy */
text[0] = '\0';
SetWindowTextA(g_edit, text);
/* creating without UDS_SETBUDDYINT */
updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);
/* try to set UDS_SETBUDDYINT after creation */
style = GetWindowLongA(updown, GWL_STYLE);
SetWindowLongA(updown, GWL_STYLE, style | UDS_SETBUDDYINT);
style = GetWindowLongA(updown, GWL_STYLE);
ok(style & UDS_SETBUDDYINT, "Expected UDS_SETBUDDY to be set\n");
SendMessageA(updown, UDM_SETPOS, 0, 20);
GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
ok(lstrlenA(text) == 0, "Expected empty string\n");
DestroyWindow(updown);
/* creating with UDS_SETBUDDYINT */
updown = create_updown_control(UDS_SETBUDDYINT | UDS_ALIGNRIGHT, g_edit);
GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
/* 50 is initial value here */
ok(lstrcmpA(text, "50") == 0, "Expected '50', got '%s'\n", text);
/* now remove style flag */
style = GetWindowLongA(updown, GWL_STYLE);
SetWindowLongA(updown, GWL_STYLE, style & ~UDS_SETBUDDYINT);
SendMessageA(updown, UDM_SETPOS, 0, 20);
GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
ok(lstrcmpA(text, "20") == 0, "Expected '20', got '%s'\n", text);
/* set edit text directly, check position */
strcpy(text, "10");
SetWindowTextA(g_edit, text);
ret = SendMessageA(updown, UDM_GETPOS, 0, 0);
expect(10, ret);
strcpy(text, "11");
SetWindowTextA(g_edit, text);
ret = SendMessageA(updown, UDM_GETPOS, 0, 0);
expect(11, LOWORD(ret));
expect(0, HIWORD(ret));
/* set to invalid value */
strcpy(text, "21st");
SetWindowTextA(g_edit, text);
ret = SendMessageA(updown, UDM_GETPOS, 0, 0);
expect(11, LOWORD(ret));
expect(TRUE, HIWORD(ret));
/* set style back */
style = GetWindowLongA(updown, GWL_STYLE);
SetWindowLongA(updown, GWL_STYLE, style | UDS_SETBUDDYINT);
SendMessageA(updown, UDM_SETPOS, 0, 30);
GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
ok(lstrcmpA(text, "30") == 0, "Expected '30', got '%s'\n", text);
DestroyWindow(updown);
}
示例6: GetWindowLongPtr
LRESULT CALLBACK ofxIPImage::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
static CREATESTRUCT *cs;
static HWND id,connected;
ofxIPImage* camera = (ofxIPImage*) GetWindowLongPtr(hwnd,GWLP_USERDATA);
if (camera!=NULL)
{
if (!camera->isSettedDefaultSettings)
{
camera->isSettedDefaultSettings = true;
int firstValue, secondValue, minValue, maxValue;
bool isEnabled,isAuto;
camera->getCameraFeature(BASE_ID,&firstValue,&secondValue,&isAuto,&isEnabled,&minValue,&maxValue);
SendMessage(GetDlgItem(hwnd, 0), TBM_SETPOS, TRUE, firstValue);
string id1 = ofToString(firstValue);
cout<<"valueof id:"<<id1<<endl;
SetWindowTextA(id,id1.c_str());
camera->getCameraFeature(BASE_CONNECTED,&firstValue,&secondValue,&isAuto,&isEnabled,&minValue,&maxValue);
SendMessage(GetDlgItem(hwnd, 1), TBM_SETPOS, TRUE, firstValue);
SetWindowTextA(connected,firstValue ? "Connected" : "Not Connected");
}
}
switch (iMsg)
{
case WM_CREATE:
{
CreateWindow("STATIC", "Client ID:", SS_LEFT | WS_CHILD | WS_VISIBLE,
10, 10, 140, 20, hwnd, NULL, NULL, NULL);
id = CreateWindow("static", " ",SS_LEFT | WS_CHILD | WS_VISIBLE,
70, 10, 145, 25,hwnd,(HMENU)0, NULL, NULL);
CreateWindow("STATIC", "Connection Status:", SS_LEFT | WS_CHILD | WS_VISIBLE,
10, 30, 140, 20, hwnd, NULL, NULL, NULL);
connected = CreateWindow("static", " ",SS_LEFT | WS_CHILD | WS_VISIBLE,
135, 30, 145, 25,hwnd,(HMENU)1, NULL, NULL);
}
break;
case WM_CLOSE :
DestroyWindow(hwnd);
break;
case WM_DESTROY :
PostQuitMessage(0);
break;
}
return DefWindowProc(hwnd, iMsg, wParam, lParam);
}
示例7: sprintf_s
void CCylinderBoundingWindow::ShowInfo(SBoundingShape* shape)
{
SCylinderBounding* cylinder = (SCylinderBounding*)shape;
char text[256];
sprintf_s(text, "%f", cylinder->Height);
SetWindowTextA(mHeightTextField, text);
sprintf_s(text, "%f", cylinder->Radius);
SetWindowTextA(mRadiusTextField, text);
}
示例8: onLoadCMClicked
void onLoadCMClicked(HWND hWnd)
{
setStatusBarText(L"Загрузка...");
if (currentDeviceNumber < 0)
{
setStatusBarText(L"Не выбрано устройство!");
return;
}
auto szFileName = new char[MAX_PATH];
GetWindowTextA(confWayLE, szFileName, MAX_PATH);
std::string pathToCommodFile(szFileName);
delete[] szFileName;
if (!isFileExists(pathToCommodFile)) {
setStatusBarText(L"Не найден файл конфигурации");
return;
}
auto manager = new StrategyDeployment(pathToCommodFile);
incrProgressBar(hWnd, 20);
bool isOK;
if (fileSize(pathToCommodFile) > 0x10000)
{
manager->setZip(true);
manager->setCreateCompressedFile(true);
manager->setZipLocation(getZipLocation(hWnd));
manager->setParse(true);
manager->setzipCompressionLevel(7);
isOK = manager->convert();
}
incrProgressBar(hWnd, 30);
isOK = manager->validateCurrentConfiguration();
if (!isOK)
{
incrProgressBar(hWnd, 50);
SetWindowTextA(stateSB, "Ошибка: неверная конфигурация! Отмена загрузки.");
manager->saveLog();
delete manager;
return;
}
incrProgressBar(hWnd, 20);
isOK = manager->loadConfiguration(currentDeviceNumber);
manager->saveLog();
auto resultLog(manager->getLastConfName());
delete manager;
incrProgressBar(hWnd, 30);
isOK ? resultLog.append(" - конфигурация загружена успешно.") :
resultLog.append(" -конфигурация не загружена.");
SetWindowTextA(stateSB, resultLog.c_str());
}
示例9: SendMessage
void DumpMemoryWindow::changeMode(HWND hwnd, Mode newMode)
{
char buffer[128];
selectedMode = newMode;
SendMessage(GetDlgItem(hwnd,IDC_DUMP_USERMEMORY),BM_SETCHECK,selectedMode == MODE_RAM ? BST_CHECKED : BST_UNCHECKED,0);
SendMessage(GetDlgItem(hwnd,IDC_DUMP_VRAM),BM_SETCHECK,selectedMode == MODE_VRAM ? BST_CHECKED : BST_UNCHECKED,0);
SendMessage(GetDlgItem(hwnd,IDC_DUMP_SCRATCHPAD),BM_SETCHECK,selectedMode == MODE_SCRATCHPAD ? BST_CHECKED : BST_UNCHECKED,0);
SendMessage(GetDlgItem(hwnd,IDC_DUMP_CUSTOMRANGE),BM_SETCHECK,selectedMode == MODE_CUSTOM ? BST_CHECKED : BST_UNCHECKED,0);
if (selectedMode == MODE_CUSTOM)
{
EnableWindow(GetDlgItem(hwnd,IDC_DUMP_STARTADDRESS),TRUE);
EnableWindow(GetDlgItem(hwnd,IDC_DUMP_SIZE),TRUE);
if (filenameChosen == false)
SetWindowTextA(GetDlgItem(hwnd,IDC_DUMP_FILENAME),"Custom.dump");
} else {
u32 start, size;
const char* defaultFileName;
switch (selectedMode)
{
case MODE_RAM:
start = PSP_GetUserMemoryBase();
size = PSP_GetUserMemoryEnd()-start;
defaultFileName = "RAM.dump";
break;
case MODE_VRAM:
start = PSP_GetVidMemBase();
size = PSP_GetVidMemEnd()-start;
defaultFileName = "VRAM.dump";
break;
case MODE_SCRATCHPAD:
start = PSP_GetScratchpadMemoryBase();
size = PSP_GetScratchpadMemoryEnd()-start;
defaultFileName = "Scratchpad.dump";
break;
}
sprintf(buffer,"0x%08X",start);
SetWindowTextA(GetDlgItem(hwnd,IDC_DUMP_STARTADDRESS),buffer);
EnableWindow(GetDlgItem(hwnd,IDC_DUMP_STARTADDRESS),FALSE);
sprintf(buffer,"0x%08X",size);
SetWindowTextA(GetDlgItem(hwnd,IDC_DUMP_SIZE),buffer);
EnableWindow(GetDlgItem(hwnd,IDC_DUMP_SIZE),FALSE);
if (filenameChosen == false)
SetWindowTextA(GetDlgItem(hwnd,IDC_DUMP_FILENAME),defaultFileName);
}
}
示例10: dialogNetInfoSetup
/*********************************************************
*NAME: dialogNetInfoSetup
*AUTHOR: John Morrison
*CREATION DATE: 3/3/99
*LAST MODIFIED: 29/4/00
*PURPOSE:
* Sets up the dialog box
*
*ARGUMENTS:
* hWnd - The dialog window handle
*********************************************************/
void dialogNetInfoSetup(HWND hWnd) {
char str[FILENAME_MAX]; /* Our address as a string */
char addr[FILENAME_MAX];
/* Setup languages */
SetWindowTextA(hWnd, langGetText(STR_DLGNETINFO_TITLE));
SetDlgItemTextA(hWnd, IDC_SERVERS, langGetText(STR_DLGNETINFO_SERVERADDRESS));
SetDlgItemTextA(hWnd, IDC_THISADDRESSS, langGetText(STR_DLGNETINFO_THISGAMEADDRESS));
SetDlgItemTextA(hWnd, IDC_SERVERPINGS, langGetText(STR_DLGNETINFO_SERVERPING));
SetDlgItemTextA(hWnd, IDC_PPSPLS, langGetText(STR_DLGNETINFO_PACKETS));
SetDlgItemTextA(hWnd, IDC_NETSTATUSS, langGetText(STR_DLGNETINFO_STATUS));
SetDlgItemTextA(hWnd, IDC_NETERRORSS, langGetText(STR_DLGNETINFO_ERRORS));
/* We are in a client and playing a networked game.. */
if (threadsGetContext() == FALSE && netGetType() != netSingle)
{
playersGetPlayerLocation(screenGetPlayers(),playersGetSelf(screenGetPlayers()),addr);
netGetOurAddressStr(str);
strcat(addr,strchr(str,':'));
SendDlgItemMessageA(hWnd, IDC_THISADDRESS, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) (addr));
}
else /* Single player game, no networking */
{
netGetOurAddressStr(str);
SendDlgItemMessageA(hWnd, IDC_THISADDRESS, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) (str));
}
timerNetInfo = SetTimer(hWnd, timerNetInfo, SECOND, NULL);
dialogNetInfoUpdate(hWnd);
}
示例11: createWindow
void createWindow(SystemEventHandler* handler)
{
g_platform_data.m_handler = handler;
HINSTANCE hInst = GetModuleHandle(NULL);
WNDCLASSEX wnd;
memset(&wnd, 0, sizeof(wnd));
wnd.cbSize = sizeof(wnd);
wnd.style = CS_HREDRAW | CS_VREDRAW;
wnd.lpfnWndProc = msgProc;
wnd.hInstance = hInst;
wnd.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wnd.hCursor = LoadCursor(NULL, IDC_ARROW);
wnd.lpszClassName = "lmxa";
wnd.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassExA(&wnd);
g_platform_data.m_hwnd = CreateWindowA(
"lmxa", "lmxa", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 800, 600, NULL, NULL, hInst, 0);
SetWindowTextA(g_platform_data.m_hwnd, "Lumix Studio");
RAWINPUTDEVICE Rid;
Rid.usUsagePage = 0x01;
Rid.usUsage = 0x02;
Rid.dwFlags = 0;
Rid.hwndTarget = 0;
RegisterRawInputDevices(&Rid, 1, sizeof(Rid));
timeBeginPeriod(1);
trackMouse();
Lumix::Renderer::setInitData(g_platform_data.m_hwnd);
ImGui::GetIO().ImeWindowHandle = g_platform_data.m_hwnd;
}
示例12: SetWindowTextUTF8
BOOL SetWindowTextUTF8(HWND hWnd, LPCSTR lpString) {
_bstr_t s = ConvertCodepage(lpString, CP_UTF8);
if (s.length() != 0)
return SetWindowTextW(hWnd, s);
else
return SetWindowTextA(hWnd, lpString);
}
示例13: VDSetWindowTextW32
void VDSetWindowTextW32(HWND hwnd, const wchar_t *s) {
if (VDIsWindowsNT()) {
SetWindowTextW(hwnd, s);
} else {
SetWindowTextA(hwnd, VDTextWToA(s).c_str());
}
}
示例14: renderScene
void renderScene() {
FrameTimeCounter counter;
int avgFps = 0;
int iterations = 0;
while (!complete) {
counter.BeginCounting();
physicsWorld->Simulate(1.0f / 10.0f);
contextPtr->BeginScene();
contextPtr->ApplyCamera(*cameraPtr);
//contextPtr->RenderLine(vec2(0.0f, 0.0f), vec2(100.0f, 100.0f));
for (int i = 0; i < physicsBodies.size(); ++i) {
physicsBodies[i].DebugRender(debugRenderer);
}
for (int i = 0; i < physicsJoints.size(); ++i) {
physicsJoints[i].DebugRender(debugRenderer);
}
contextPtr->EndScene();
counter.EndCounting();
avgFps += counter.GetFps();
iterations++;
if (iterations > 10) {
SetWindowTextA(hWnd, formatString("fps: %d", avgFps / iterations).c_str());
iterations = 0;
avgFps = 0;
}
}
}
示例15: main
//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
int main()
{
SetWindowTextA(GetConsoleWindow(), "BlockEnv Debug");
// Initialize everything we need.
Application::Initialize("BlockEnv", 0.01f, 1, 800, 600);
Application::InitializeWindow();
Application::InitializeOpenGL();
Input::Initialize();
Application::InitializeWinsock();
Application::CreateClientSocket();
Application::ResolveHost();
Application::ServerIP = "127.0.0.1";
Application::ConnectToServer();
Application::StartRecievingData();
// Load the default font, probably change this up later.
Application::TextTexture.Load("res/Font.png");
GUI::Chatbox::Init();
GUI::GetDesktop()->Hide();
Block::LoadAllBlockTypeInfo();
Block::LoadAllBlockTypeTextures();
// Run the program and handle it's termination appropriately.
Application::WindowMessageLoop();
Application::ReleaseOpenGL();
Application::Unload();
// Return the exit code for the process.
return Application::Msg.wParam;
}