Пример #1
0
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
0
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
0
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
0
	inline void SetWindowTextForButton(HWND hEdit, u32 buttonCode, const char *pszButtonName)
	{
		if (buttonCode == 0) {
			SetWindowTextA(hEdit, "Disable");
		} else {
			SetWindowTextA(hEdit, pszButtonName);
		}
	}
Пример #5
0
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
0
/***********************************************************************
 *         NPS_ProxyPasswordDialog
 */
static INT_PTR WINAPI NPS_ProxyPasswordDialog(
    HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    HWND hitem;
    LPAUTHDLGSTRUCTA lpAuthDlgStruct;

    if( uMsg == WM_INITDIALOG )
    {
        TRACE("WM_INITDIALOG (%08lx)\n", lParam);

        /* save the parameter list */
        lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) lParam;
        SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam );

        if( lpAuthDlgStruct->lpExplainText )
        {
            hitem = GetDlgItem( hdlg, IDC_EXPLAIN );
            SetWindowTextA( hitem, lpAuthDlgStruct->lpExplainText );
        }

        /* extract the Realm from the proxy response and show it */
        if( lpAuthDlgStruct->lpResource )
        {
            hitem = GetDlgItem( hdlg, IDC_REALM );
            SetWindowTextA( hitem, lpAuthDlgStruct->lpResource );
        }

        return TRUE;
    }

    lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) GetWindowLongPtrW( hdlg, GWLP_USERDATA );

    switch( uMsg )
    {
    case WM_COMMAND:
        if( wParam == IDOK )
        {
            hitem = GetDlgItem( hdlg, IDC_USERNAME );
            if( hitem )
                GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername );

            hitem = GetDlgItem( hdlg, IDC_PASSWORD );
            if( hitem )
                GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword );

            EndDialog( hdlg, WN_SUCCESS );
            return TRUE;
        }
        if( wParam == IDCANCEL )
        {
            EndDialog( hdlg, WN_CANCEL );
            return TRUE;
        }
        break;
    }
    return FALSE;
}
Пример #7
0
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);
}
Пример #8
0
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);
}
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());
}
Пример #10
0
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);
	}
}
Пример #11
0
/*********************************************************
*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);
}
Пример #12
0
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;
}
Пример #13
0
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);
}
Пример #14
0
void VDSetWindowTextW32(HWND hwnd, const wchar_t *s) {
	if (VDIsWindowsNT()) {
		SetWindowTextW(hwnd, s);
	} else {
		SetWindowTextA(hwnd, VDTextWToA(s).c_str());
	}
}
Пример #15
0
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;
        }
    }
}
Пример #16
0
//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;
}
Пример #17
0
void CGlobalSettingWindow::UpdateShowing()
{
	EditorScene* scene = EditorScene::getInstance();

	char text[256];
	ILightNode* light = scene->mDirectionalLightNode;

	sprintf_s(text, "%.5f", scene->mSceneManager->getAmbient().x);
	SetWindowTextA(mAmbientTextField, text);

	sprintf_s(text, "%.5f", light->getDiffuse().x);
	SetWindowTextA(mDiffuseTextField, text);

	sprintf_s(text, "%.5f", light->getSpecular().x);
	SetWindowTextA(mSpecularTextField, text);
}
Пример #18
0
int teamAbout(void)
{
	int i;
	HWND hwnd = GetForegroundWindow();
	SetWindowTextA(hwnd, "离散数学实验室 - 团队信息");

	
	loginui();
	printf("\n\n");
	printf("\t\t\t\t     程序作者\n\n\t\t\t\t      张博强\n\n\t\t\t辽宁工程技术大学 软件学院 15级9班\n\n\t\t\t\t    ");
	//printf("\t\t\t\t     团队信息\n\n\t\t\t    张博强、李昕、范守峰、王妍\n\n\t\t\t辽宁工程技术大学 软件学院 15级9班\n\n\t\t\t\t    ");
	printf("\n\t\t\t\t     指导老师\n\n\t\t\t\t      冯永安\n\n");

	printf("\n\n");
	printf("\n\t本软件在最终发布前对功能进行了测试,确保功能都尽量准确执行,但由\n\t于团队水平和开发经验有限,错误和疏漏在所难免,还望各位不吝赐教。\n");
	printf("\n\t\t\t\t\t\t\t  ");
	printf(DATENOW);
	
	i = 1;
	while (_getch() == ' ')
	{
		i++;
		if (i > 7)
		{
			gameStart();
			break;
		}
	}
	

	return 1000;
	
	
}
Пример #19
0
LRESULT Win32Assistant::CBTProc (int nCode, WPARAM wParam, LPARAM lParam)
{
  switch (nCode)
  {
    // when the MB is first activated we change the button text
  case HCBT_ACTIVATE:
    {
      // The MBs we request always have just one button (OK)
      HWND Button = FindWindowEx ((HWND)wParam, 0, "Button", 0);
      if (Button)
      {
	if (cswinIsWinNT ())
	{
          SetWindowTextW (Button, csCtoW (msgOkMsg));
	}
	else
	{
          SetWindowTextA (Button, cswinCtoA (msgOkMsg));
	}
      }
      LRESULT ret = CallNextHookEx (msgBoxOkChanger,
	nCode, wParam, lParam);
      // The work is done, remove the hook.
      UnhookWindowsHookEx (msgBoxOkChanger);
      msgBoxOkChanger = 0;
      return ret;
    }
    break;
  }
  return CallNextHookEx (msgBoxOkChanger,
    nCode, wParam, lParam);
}
Пример #20
0
void CMainDlg::ReadSysIni()
{
	int icustom = 0;
	char szTemp[MAX_PATH] = { 0 };
	readINI("system", "custom_choose", icustom);
	readINI("system", "auto_update", szTemp);
	m_strUpdate = szTemp;
	memset(szTemp, 0, MAX_PATH);
	readINI("system", "software_title", szTemp);
	m_strTitle = szTemp;
	SetWindowTextA(m_hWnd, m_strTitle.c_str());
	memset(szTemp, 0, MAX_PATH);
	readINI("system", "default_homepage", szTemp);
	m_strDefaultUrl = szTemp;
	if (m_strDefaultUrl.size())
	{
		WriteLog("ok: 读取到默认主页地址:%s", m_strDefaultUrl);
	}
	else
	{
		m_strDefaultUrl = "http://baidu.com";
		MessageBox(L"error: 读取到默认主页地址为空,请设置...");
		WriteLog("error: 读取到默认主页地址为空");
	}
	if (icustom)
	{
		memset(szTemp, 0, MAX_PATH);
		readINI("system", "custom_homepage", szTemp);
		m_strCustomUrl = szTemp;
		if (m_strCustomUrl.size())
		{
			m_strDefaultUrl = m_strCustomUrl;
		}
	}
}
Пример #21
0
void AddComboItem (HWND hComboBox, char *lpszFileName, BOOL saveHistory)
{
	LPARAM nIndex;

	if (!saveHistory)
	{
		SendMessage (hComboBox, CB_RESETCONTENT, 0, 0);
		SetWindowTextA (hComboBox, lpszFileName);
		return;
	}

	nIndex = SendMessage (hComboBox, CB_FINDSTRINGEXACT, (WPARAM) - 1, (LPARAM) & lpszFileName[0]);

	if (nIndex == CB_ERR && *lpszFileName)
	{
		time_t lTime = time (NULL);
		nIndex = SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) & lpszFileName[0]);
		if (nIndex != CB_ERR)
			SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) lTime);
	}

	if (nIndex != CB_ERR && *lpszFileName)
		nIndex = SendMessage (hComboBox, CB_SETCURSEL, nIndex, 0);

	if (*lpszFileName == 0)
	{
		SendMessage (hComboBox, CB_SETCURSEL, (WPARAM) - 1, 0);
	}
}
Пример #22
0
BOOL CALLBACK CWindowsFunctions::CB_EnumChildProc(HWND hwnd, LPARAM lParam)
{
	int length = GetWindowTextLengthA(hwnd);

	if (length > 0)
	{
		length++; // NULL character

		char* jpn = new char[length];
	
		length = GetWindowTextA(hwnd, jpn, length);

		if (length > 0)
		{
			char className[6];
			GetClassNameA(hwnd, className, sizeof(className));

			if (strcmp(className, "Edit") != 0)
			{
				bool result = m_resources->TranslateUserInterface(jpn, m_uiBuffer, UI_BUFFER);

				if (result)
				{
					SetWindowTextA(hwnd, m_uiBuffer);
				}
			}
		}

		delete[] jpn;
	}

	return TRUE;
}
Пример #23
0
BOOL fileToEdit(LPCSTR fileName){
    HANDLE hFile;
    BOOL bLoaded = false; 
    currentFile = fileName;
    hFile = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
    if (hFile != INVALID_HANDLE_VALUE)
    {
        DWORD dwFileSize = GetFileSize(hFile, NULL);
        if (dwFileSize != 0xFFFFFFFF)
        {
            char* pszFileText = (char*)malloc(dwFileSize + 1);

            DWORD dwRead;
            if (ReadFile(hFile, pszFileText, dwFileSize, &dwRead, NULL))
            {
                // Add null character to end since ReadFile doesn't do it
                pszFileText[dwFileSize] = '\0';

                // Set editbox text
                SetWindowTextA(hwndEdit, pszFileText);

                bLoaded = TRUE;
            }

            free(pszFileText);
        }
        CloseHandle(hFile);
    }
    else{
        MessageBeep(0);
    }
    return bLoaded;
}
Пример #24
0
static void DrawTime( WININFO *info, float t )
{
    static int      frame=0;
    static float    to=0.0;
    static int      fps=0;
    char            str[64];
    int             s, m;


    if( t<0.0f) return;
    if( info->full ) return;

    frame++;
    if( (t-to)>1.0f )
        {
        fps = frame;
        to = t;
        frame = 0;
        }

    if( !(frame&3) )
        {
          
        m = floorf( t/60.0f );
        s = floorf( t-60.0f*(float)m );

        sprintf( str, "%d fps, %02d:%02d", fps, m, s );

        SetWindowTextA( info->hWnd, str );
        }
}
Пример #25
0
	LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
	{
		if (pCtrlDlgState->pCtrlMap->GetTargetDevice() == CONTROLS_KEYBOARD_INDEX) {
			HWND hEdit = GetFocus();
			UINT nCtrlID = GetDlgCtrlID(hEdit);
			if (nCtrlID < CONTROLS_IDC_EDIT_BIGIN || nCtrlID > CONTROLS_IDC_EDIT_END) {
				return CallNextHookEx(pCtrlDlgState->pKeydownHook, nCode, wParam, lParam);
			}
			if (!(lParam&(1<<31))) {
				// key down
				HWND hDlg = GetParent(hEdit);
				const char *str = getVirtualKeyName(wParam);
				if (str) {
					if (nCtrlID >= IDC_EDIT_KEY_ANALOG_UP) {
						pCtrlDlgState->pCtrlMap->SetBindCode(wParam, CONTROLS_KEYBOARD_ANALOG_INDEX,
							nCtrlID - IDC_EDIT_KEY_ANALOG_UP);
					} else {
						pCtrlDlgState->pCtrlMap->SetBindCode(wParam);
					}
					SetWindowTextA(hEdit, str);
					RECT rc = getRedrawRect(hEdit);
					InvalidateRect(hDlg, &rc, false);
				}
				else
					MessageBoxA(hDlg, "Not supported!", "controller", MB_OK);
			}
		}
		return 1;
	}
VOID SetEdit1TextFromMPZ(HWND hDlg, mpz_t _P)
{
 char b[2048];
 LPSTR buf=(LPSTR)b;
 INT ii=(INT)SendMessage(GetDlgItem(hDlg, IDC_BASE_LIST), LB_GETCURSEL, 0, 0);
 UINT i, Base, Bits, Trues;
  switch(ii)
  {
   case 0: Base=10; break;
   case 1: case 2: Base=16; break;
   case 3: Base=32; break;
   case 4: Base=62; break;
   default: return;
  }
  mpz_get_str(&b[0], Base, _P);
   if(ii==2)
   {
    for(i=0; i<2048; i++)
    {
      if(b[i]>='0'&&b[i]<='9')continue;
       else if(b[i]>='a'&&b[i]<='z')b[i]-=('a'-'A');       
        else break;
    }
   }
  SetWindowTextA(GetDlgItem(hDlg, IDC_EDIT1), &b[0]);

    Bits=mpz_sizeinbase(_P, 2);
    SetLabelUI(hDlg, IDC_TRUES_STT, Bits);
    Trues=0;
      for(i=0; i<Bits; i++)
       if(mpz_tstbit(_P, i))Trues++;
    SetLabelUI(hDlg, IDC_BITS_STT,  Bits);
    SetLabelUI(hDlg, IDC_TRUES_STT, Trues);
}//--//
Пример #27
0
void WindowsHost::SetWindowTitle(const char *message)
{
	// Really need a better way to deal with versions.
	std::string title = PPSSPP_VERSION_STR " - ";
	title += message;

	int size = MultiByteToWideChar(CP_UTF8, 0, message, (int) title.size(), NULL, 0);
	if (size > 0)
	{
		wchar_t *utf16_title = new wchar_t[size + 1];
		if (utf16_title)
			size = MultiByteToWideChar(CP_UTF8, 0, message, (int) title.size(), utf16_title, size);
		else
			size = 0;

		if (size > 0)
		{
			utf16_title[size] = 0;
			// Don't use SetWindowTextW because it will internally use DefWindowProcA.
			DefWindowProcW(mainWindow_, WM_SETTEXT, 0, (LPARAM) utf16_title);
			delete[] utf16_title;
		}
	}

	// Something went wrong, fall back to using the local codepage.
	if (size <= 0)
		SetWindowTextA(mainWindow_, title.c_str());
}
Пример #28
0
LRESULT CALLBACK AddResourceWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
  switch(msg) {
    case WM_DESTROY: {
      wnd->addResourceWindow->isOpen = false;
    } break;
    case WM_CREATE: {
      wnd->addResourceWindow->isOpen = true;
    } break;
    case WM_COMMAND: {
      switch(LOWORD(wParam)) {
        case Window::AddResourceWindow::ADD_BUTTON: {
          char buf[1024] = {0};
          GetWindowText(wnd->addResourceWindow->inputTextbox, buf, 1024);
          
          if(buf[0] == '\0') {
            MessageBoxA(hWnd, "文字列を入力してください", "警告", MB_OK);
          }else {
            std::stringstream str;
            str << buf << "(" << std::hex << wnd->exeCreator.AddString(buf) << ")";
            wnd->resourceStringList.insert(std::make_pair(str.str(), buf));
            SendMessage(wnd->resourceList, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(str.str().c_str()));
          }

          SetWindowTextA(wnd->addResourceWindow->inputTextbox, "");
        } break;
        case Window::AddResourceWindow::CLOSE_BUTTON: {
          SendMessage(hWnd, WM_CLOSE, 0, 0);
        } break;
      }
    } break;
  }
  return DefWindowProc(hWnd,msg,wParam,lParam);
}
Пример #29
0
/*********************************************************
*NAME:          dialogPasswordCallback
*AUTHOR:        John Morrison
*CREATION DATE: 24/1/99
*LAST MODIFIED: 29/4/00
*PURPOSE:
*  The Opening Dialog call back function.
*
*ARGUMENTS:
*  hWnd   - Handle to the window
*  msg    - The message
*  wParam - Message parameters
*  lParam - More Message parameters
*********************************************************/
BOOL CALLBACK dialogPasswordCallback( HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam ) {
  char pass[MAP_STR_SIZE]; /* The password to get */

  switch ( uMsg ) {
  case WM_INITDIALOG:
    /* Set languages */
    SetWindowTextA(hWnd, langGetText(STR_DLGPASSWORD_TITLE));
    SetDlgItemTextA(hWnd, IDC_BLURB, langGetText(STR_DLGPASSWORD_BLURB));
    SetDlgItemTextA(hWnd, IDOK, langGetText(STR_OK));
    SetFocus(GetDlgItem(hWnd, IDC_PASSWORD));
    break;
  case WM_COMMAND:
    switch (LOWORD(wParam)) {
    case IDOK:
      GetDlgItemText(hWnd, IDC_PASSWORD, pass, (sizeof(pass)));
      gameFrontSetGameOptions(pass, gameOpen, FALSE, FALSE, 0, 0, TRUE);
      EndDialog(hWnd, TRUE);
      break;
    }
    break;
  case WM_PAINT:
    break;
  case WM_DESTROY:
    break;
  }
  return FALSE;
}
Пример #30
0
void WindowsHost::SetWindowTitle(const char *message)
{
	std::string title = std::string("PPSSPP ") + PPSSPP_GIT_VERSION + " - " + message;

	int size = MultiByteToWideChar(CP_UTF8, 0, title.c_str(), (int) title.size(), NULL, 0);
	if (size > 0)
	{
		// VC++6.0 any more?
		wchar_t *utf16_title = new(std::nothrow) wchar_t[size + 1];
		if (utf16_title)
			size = MultiByteToWideChar(CP_UTF8, 0, title.c_str(), (int) title.size(), utf16_title, size);
		else
			size = 0;

		if (size > 0)
		{
			utf16_title[size] = 0;
			// Don't use SetWindowTextW because it will internally use DefWindowProcA.
			DefWindowProcW(mainWindow_, WM_SETTEXT, 0, (LPARAM) utf16_title);
			delete[] utf16_title;
		}
	}

	// Something went wrong, fall back to using the local codepage.
	if (size <= 0)
		SetWindowTextA(mainWindow_, title.c_str());
}