当前位置: 首页>>代码示例>>C++>>正文


C++ SetWindowTextA函数代码示例

本文整理汇总了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);
		}
	}
}
开发者ID:Piotrek1910,项目名称:Painter,代码行数:27,代码来源:NewImage.cpp

示例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;
		}
	}
}
开发者ID:Feoggou,项目名称:gen_ym10,代码行数:35,代码来源:ListSide.cpp

示例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);
}
开发者ID:Artogn,项目名称:licecap,代码行数:30,代码来源:win32_utf8.c

示例4: SetWindowTextForButton

	inline void SetWindowTextForButton(HWND hEdit, u32 buttonCode, const char *pszButtonName)
	{
		if (buttonCode == 0) {
			SetWindowTextA(hEdit, "Disable");
		} else {
			SetWindowTextA(hEdit, pszButtonName);
		}
	}
开发者ID:Tyestor,项目名称:ppsspp,代码行数:8,代码来源:WndMainWindow.cpp

示例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);
}
开发者ID:Jactry,项目名称:wine,代码行数:57,代码来源:updown.c

示例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);
}
开发者ID:nuigroup,项目名称:ccv-multiplexer,代码行数:53,代码来源:ofxIPImage.cpp

示例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);
}
开发者ID:Wu1994,项目名称:GameFinal,代码行数:12,代码来源:CCylinderBoundingWindow.cpp

示例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());
}
开发者ID:AntonGulkevich,项目名称:configuration-viewer-UIP,代码行数:52,代码来源:cv.cpp

示例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);
	}
}
开发者ID:tpunix,项目名称:ppsspp,代码行数:52,代码来源:DumpMemoryWindow.cpp

示例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);
}
开发者ID:1taplay,项目名称:winbolo,代码行数:40,代码来源:dialogNetworkInfo.c

示例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;
}
开发者ID:zemanmar,项目名称:LumixEngine,代码行数:33,代码来源:platform_interface.cpp

示例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);
}
开发者ID:Mr-Kumar-Abhishek,项目名称:httrack-windows,代码行数:7,代码来源:newlang.cpp

示例13: VDSetWindowTextW32

void VDSetWindowTextW32(HWND hwnd, const wchar_t *s) {
	if (VDIsWindowsNT()) {
		SetWindowTextW(hwnd, s);
	} else {
		SetWindowTextA(hwnd, VDTextWToA(s).c_str());
	}
}
开发者ID:Fluffiest,项目名称:mpc-hc,代码行数:7,代码来源:w32assist.cpp

示例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;
        }
    }
}
开发者ID:fromtherussia,项目名称:e2d,代码行数:35,代码来源:main.cpp

示例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;
}
开发者ID:ClericX,项目名称:Projects,代码行数:34,代码来源:Main.cpp


注:本文中的SetWindowTextA函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。