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


C++ SetWindowTextW函数代码示例

本文整理汇总了C++中SetWindowTextW函数的典型用法代码示例。如果您正苦于以下问题:C++ SetWindowTextW函数的具体用法?C++ SetWindowTextW怎么用?C++ SetWindowTextW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetWindowTextW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetCharOutline


//.........这里部分代码省略.........

    ZeroMemory(pMem->pvBuffer, BytesPerRow * Height);

    BytesPerRowRaw = ROUND_UP(GlyphMetrics.gmBlackBoxX, bitsof(DWORD)) / 8;

    pbBuffer   = Buffer;
    pbOutline  = (PBYTE)pMem->pvBuffer;
    pbOutline += (GlyphMetrics.gmBlackBoxY - 1) * BytesPerRow;
    pbOutline += ((Height - GlyphMetrics.gmBlackBoxY) / 2 - 1) * BytesPerRow;
    pbOutline += DwordOfLeftSpace * 4;
    Mask = _rotl(1, BitsOfLeftSpace) - 1;

    for (ULONG i = GlyphMetrics.gmBlackBoxY; i; --i)
    {
        PBYTE pbOutline2, pbBuffer2;
        DWORD BitsHigh, BitsLow;

        BitsHigh = 0;
        BitsLow = 0;
        pbBuffer2 = pbBuffer;
        pbOutline2 = pbOutline;
        for (ULONG Count = BytesPerRowRaw / 4; Count; --Count)
        {
            DWORD v = *(PDWORD)pbBuffer2;

            BitsHigh = _rotl(v, BitsOfLeftSpace) & Mask;
            v = (v << BitsOfLeftSpace) | BitsLow;
            BitsLow = BitsHigh;
            *(PDWORD)pbOutline2 = v;
            pbOutline2 += 4;
            pbBuffer2  += 4;
        }
//        *(PDWORD)pbOutline2 = BitsLow;

        pbOutline -= BytesPerRow;
        pbBuffer  += BytesPerRowRaw;
    }

    WCHAR buf[0x500];
    wsprintfW(
        buf - 1 + GetTextFaceW(hDC, countof(buf),
        buf),
        L" Char = %c Index = %02u Bits = %02X",
        uChar,
        FontIndex + 1,
        BitsOfLeftSpace);
    SetWindowTextW(GetActiveWindow(), buf);

#else
    ULONG BytesPerRowRaw;
    static BYTE Bits[FONT_COUNT] = 
    {
        0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x16,
        0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14,
        0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
        0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
        0x29, 0x2A, 0x2B, 0x2C
    };

    BitsOfLeftSpace = Bits[FontIndex];

    if (pBitsPerRow != NULL)
        *pBitsPerRow = GlyphMetrics.gmBlackBoxX + BitsOfLeftSpace;


    if (pThis == NULL)
        return TRUE;

    BytesPerRow = GlyphMetrics.gmBlackBoxX + BitsOfLeftSpace;
    BytesPerRow = ROUND_UP(BytesPerRow, bitsof(DWORD)) / 8;

    ChipSpriteEngAllocMemory(pMem, BytesPerRow * Height);
    if (pMem->pvBufferEnd == pMem->pvBuffer)
        goto DEFAULT_PROC;

    ZeroMemory(pMem->pvBuffer, BytesPerRow * Height);

    BytesPerRowRaw = ROUND_UP(GlyphMetrics.gmBlackBoxX, bitsof(DWORD)) / 8;

    pbBuffer   = Buffer;
    pbOutline  = (PBYTE)pMem->pvBuffer;
    pbOutline += (GlyphMetrics.gmBlackBoxY - 1) * BytesPerRow;
    pbOutline += ((Height - GlyphMetrics.gmBlackBoxY) / 2 - 1) * BytesPerRow;

    for (ULONG i = GlyphMetrics.gmBlackBoxY; i; --i)
    {
        __movsd(pbOutline, pbBuffer, BytesPerRowRaw / 4);
        pbOutline -= BytesPerRow;
        pbBuffer  += BytesPerRowRaw;
    }
#endif

    return TRUE;

DEFAULT_PROC:
    if (pThis == NULL)
        return FALSE;

    return OldGetCharOutline(Unknown, 0, pThis, Height, uChar, pBitsPerRow, pDescent, pMem);
}
开发者ID:AyanamiRei,项目名称:chinesize,代码行数:101,代码来源:Daiteikoku.cpp

示例2: SetEditText

void SetEditText(HWND hWnd,DWORD type)
{
	DWORD  temp,t1,t2,i;
	char *info;
	wchar_t *winfo;
	if(type == CPUDUMP)
	{
//		__try
		{
			temp = Plugingetvalue(VAL_CPUDDUMP);
			t1=*(DWORD*)(temp+0x385);
			t2=*(DWORD*)(temp+0x389);
			temp=t2-t1;
			info = (char *)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, temp + 2);
			winfo = (wchar_t *)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, (temp + 2) * sizeof(wchar_t));
			Readmemory(info,(DWORD)t1,temp,MM_SILENT);
			for(i=0;i<temp;i++)
			{
				if(info[i]==0)
				{
					if(info[i+1]==0)
					{
					info[i]=0x0d;
					info[++i]=0x0a;
					}
					else
						info[i]=' ';
				}
			}
			MultiByteToWideChar(pagecode,0,info,-1,winfo,temp+2);
			SetWindowTextW(hWnd,winfo);
			HeapFree(hHeap, 0, info);
			HeapFree(hHeap, 0, winfo);
		}
//		__except(EXCEPTION_EXECUTE_HANDLER)
//		{
//			return;
//		}
	}
	else
	{
		temp = Plugingetvalue(VAL_CPUDSTACK	);
		t1 = *(DWORD*)(temp+0x385);
		char tempchar;
//		__try
		{
			Readmemory(&t2,t1,4,MM_SILENT);
/*			char s[128] = {0};
			sprintf(s,"0x%08x 0x%08x",t2,info);
			MessageBox(hWnd,s,s,0);*/
			t1 = t2;
			temp=0;
			do
			{
				Readmemory(&tempchar,t2++,1,MM_SILENT);
				++temp;
			}while( tempchar != 0 );
			if(temp==1)
				return;
			info = (char *)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, temp);
			Readmemory(info,t1,temp,MM_SILENT);
			winfo = (wchar_t *)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, temp * sizeof(wchar_t));
			MultiByteToWideChar(pagecode,0,info,-1,winfo,temp);
			SetWindowTextW(hWnd,winfo);
			HeapFree(hHeap, 0, info);
			HeapFree(hHeap, 0, winfo);
		}
//		__except(EXCEPTION_EXECUTE_HANDLER)
//		{
//			return;
//		}
	}
}
开发者ID:LegalEagle,项目名称:Arianrhod,代码行数:73,代码来源:OllyGal.cpp

示例3: DoOpenFile


//.........这里部分代码省略.........
	return;
    }

    /* Extra memory for (WCHAR)'\0'-termination. */
    pTemp = HeapAlloc(GetProcessHeap(), 0, size+2);
    if (!pTemp)
    {
	CloseHandle(hFile);
	ShowLastError();
	return;
    }

    if (!ReadFile(hFile, pTemp, size, &dwNumRead, NULL))
    {
	CloseHandle(hFile);
	HeapFree(GetProcessHeap(), 0, pTemp);
	ShowLastError();
	return;
    }

    CloseHandle(hFile);

    size = dwNumRead;

    if (enc == ENCODING_AUTO)
        enc = detect_encoding_of_buffer(pTemp, size);
    else if (size >= 2 && (enc==ENCODING_UTF16LE || enc==ENCODING_UTF16BE))
    {
        /* If UTF-16 (BE or LE) is selected, and there is a UTF-16 BOM,
         * override the selection (like native Notepad).
         */
        if ((BYTE)pTemp[0] == 0xff && (BYTE)pTemp[1] == 0xfe)
            enc = ENCODING_UTF16LE;
        else if ((BYTE)pTemp[0] == 0xfe && (BYTE)pTemp[1] == 0xff)
            enc = ENCODING_UTF16BE;
    }

    switch (enc)
    {
    case ENCODING_UTF16BE:
        byteswap_wide_string((WCHAR*) pTemp, size/sizeof(WCHAR));
        /* Forget whether the file is BE or LE, like native Notepad. */
        enc = ENCODING_UTF16LE;

        /* fall through */

    case ENCODING_UTF16LE:
        textW = (LPWSTR)pTemp;
        lenW  = size/sizeof(WCHAR);
        break;

    default:
        {
            int cp = (enc==ENCODING_UTF8) ? CP_UTF8 : CP_ACP;
            lenW = MultiByteToWideChar(cp, 0, pTemp, size, NULL, 0);
            textW = HeapAlloc(GetProcessHeap(), 0, (lenW+1) * sizeof(WCHAR));
            if (!textW)
            {
                ShowLastError();
                HeapFree(GetProcessHeap(), 0, pTemp);
                return;
            }
            MultiByteToWideChar(cp, 0, pTemp, size, textW, lenW);
            HeapFree(GetProcessHeap(), 0, pTemp);
            break;
        }
    }

    /* Replace '\0's with spaces. Other than creating a custom control that
     * can deal with '\0' characters, it's the best that can be done.
     */
    for (i = 0; i < lenW; i++)
        if (textW[i] == '\0')
            textW[i] = ' ';
    textW[lenW] = '\0';

    if (lenW >= 1 && textW[0] == 0xfeff)
        SetWindowTextW(Globals.hEdit, textW+1);
    else
        SetWindowTextW(Globals.hEdit, textW);

    HeapFree(GetProcessHeap(), 0, textW);

    SendMessageW(Globals.hEdit, EM_SETMODIFY, FALSE, 0);
    SendMessageW(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0);
    SetFocus(Globals.hEdit);
    
    /*  If the file starts with .LOG, add a time/date at the end and set cursor after */
    if (GetWindowTextW(Globals.hEdit, log, ARRAY_SIZE(log)) && !lstrcmpW(log, dotlog))
    {
	static const WCHAR lfW[] = { '\r','\n',0 };
        SendMessageW(Globals.hEdit, EM_SETSEL, GetWindowTextLengthW(Globals.hEdit), -1);
        SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lfW);
	DIALOG_EditTimeDate();
        SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lfW);
    }

    SetFileNameAndEncoding(szFileName, enc);
    UpdateWindowCaption();
}
开发者ID:bilboed,项目名称:wine,代码行数:101,代码来源:dialog.c

示例4: switch

LRESULT CWebWindow::_windowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
    {
    case WM_CREATE:
        {
            DragAcceptFiles(hwnd, TRUE);
            //SetTimer(hwnd, 100, 20, NULL);
        }
        return 0;

    case WM_CLOSE:
        if (m_windowClosingCallback)
        {
            if (!m_windowClosingCallback(this, m_windowClosingCallbackParam))
                return 0;
        }

        ShowWindow(hwnd, SW_HIDE);
        DestroyWindow(hwnd);
        return 0;

    case WM_DESTROY:
        {
            //KillTimer(hwnd, 100);
            RemovePropW(hwnd, L"wkeWebWindow");
            m_hwnd = NULL;

            if (m_windowDestroyCallback)
                m_windowDestroyCallback(this, m_windowDestroyCallbackParam);

            wkeDestroyWebView(this);
        }
        return 0;

    //case WM_TIMER:
    //    {
    //        wkeRepaintIfNeeded(this);
    //    }
    //    return 0;

    case WM_PAINT:
        {
            PAINTSTRUCT ps = { 0 };
            HDC hdc = BeginPaint(hwnd, &ps);
            _paintDC(hdc, (HDC)wkeGetViewDC(this));
            EndPaint(hwnd, &ps);
        }
        return 0;

    case WM_ERASEBKGND:
        return TRUE;

    case WM_SIZE:
        {
            RECT rc = { 0 };
            GetClientRect(hwnd, &rc);
            int width = rc.right - rc.left;
            int height = rc.bottom - rc.top;

            CWebView::resize(width, height);
            wkeRepaintIfNeeded(this);
        }
        return 0;

    case WM_DROPFILES:
        {
            wchar_t szFile[MAX_PATH + 8] = {0};
            wcscpy(szFile, L"file:///");

            HDROP hDrop = reinterpret_cast<HDROP>(wParam);

            UINT uFilesCount = DragQueryFileW(hDrop, 0xFFFFFFFF, szFile, MAX_PATH);
            if (uFilesCount != 0)
            {
                UINT uRet = DragQueryFileW(hDrop, 0, (wchar_t*)szFile + 8, MAX_PATH);
                if ( uRet != 0)
                {
                    wkeLoadURLW(this, szFile);
                    SetWindowTextW(hwnd, szFile);
                }
            }
            DragFinish(hDrop);
        }
        return 0;


    //case WM_NCHITTEST:
    //    if (IsWindow(m_hwnd) && flagsOff(GetWindowLong(m_hwnd, GWL_STYLE), WS_CAPTION))
    //    {
    //        IWebkitObserverPtr observer = m_observer.lock();
    //        if (!observer)
    //            break;

    //        QPoint cursor(LOWORD(lParam), HIWORD(lParam));
    //        ScreenToClient(m_hwnd, &cursor);

    //        QRect clientRect;
    //        QSize clientSize;
    //        GetClientRect(hwnd, &clientRect);
//.........这里部分代码省略.........
开发者ID:kertL,项目名称:wke,代码行数:101,代码来源:wkeWebWindow.cpp

示例5: Meta_EditDialogProc


//.........这里部分代码省略.........
			changes.hOfflineContact = Meta_GetContactHandle((HANDLE)lParam, offline_contact_number);
			for(i = 0; i < nb_contacts; i++)
				changes.hContact[i] = Meta_GetContactHandle((HANDLE)lParam, i);
			changes.force_default = MetaAPI_GetForceState((WPARAM)lParam, 0);

			SendMessage(hwndDlg, WMU_SETTITLE, 0, lParam);

			CheckDlgButton(hwndDlg, IDC_CHK_FORCEDEFAULT, changes.force_default);

			FillContactList(hwndDlg, &changes);
			return TRUE;
		}
		case WMU_SETTITLE:
			{

				char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)lParam, 0);
				if(os_unicode_enabled) {
					wchar_t *swzCDN = (wchar_t *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)lParam, GCDNF_UNICODE),
						*swzContactDisplayName;

					// detect if the clist provided unicode display name by comparing with non-unicode
					if(szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0 && wcslen(swzCDN) >= strlen(szCDN)) { 
						swzContactDisplayName = swzCDN;
					} else {
						// no? convert to unicode
						if(szCDN) {
							swzContactDisplayName = (wchar_t *) _malloca(sizeof(wchar_t) * (strlen(szCDN) + 1));
							MultiByteToWideChar(CP_ACP, 0, (char *) szCDN, -1, swzContactDisplayName, (int)strlen((char *)szCDN) + 1);
						} else {
							swzContactDisplayName = TranslateW(L"(Unknown Contact)");
						}
					}				

					SetWindowTextW(GetDlgItem(hwndDlg,IDC_ED_NAME), swzContactDisplayName);
				} else {
					SetWindowText(GetDlgItem(hwndDlg,IDC_ED_NAME), szCDN);
				}
			}
			return TRUE;
		case WM_NOTIFY: // the message that is being sent always
			switch(LOWORD(wParam)) // hit control
			{
				case IDC_LST_CONTACTS:      // did we hit our ListView contorl?
					if(((LPNMHDR)lParam)->code == NM_CLICK) {
						hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS);
						sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected
						// enable buttons
						hwnd = GetDlgItem(hwndDlg, IDC_BTN_REM);
						EnableWindow(hwnd, sel!=-1);
						hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT);
						EnableWindow(hwnd, sel!=-1 && changes.hContact[sel] != changes.hDefaultContact);
						hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE);
						EnableWindow(hwnd, sel!=-1 && changes.hContact[sel] != changes.hOfflineContact);
						hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP);
						EnableWindow(hwnd, (sel > 0));
						hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN);
						EnableWindow(hwnd, (sel != -1) && (sel < changes.num_contacts - 1));
/*
					// custom draw stuff - change colour of listview things - doesn't affect selection :(
					} else if(((LPNMHDR)lParam)->code == NM_CUSTOMDRAW) {
						SetWindowLong(hwndDlg, DWL_MSGRESULT, (LONG)ProcessCustomDraw(lParam));
						return TRUE;					
*/
					}					
					break;
			}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:67,代码来源:edit.c

示例6: Render


//.........这里部分代码省略.........
	// CARGA LOS CONSTANT BUFFERS
	if (!constBuffer)
	{
		g_pImmediateContext->PSSetConstantBuffers(1, 1, &g_pConstantBufferPS);
		g_pImmediateContext->VSSetConstantBuffers(0, 1, &g_pConstantBuffer);
		g_pImmediateContext->VSSetConstantBuffers(1, 1, &g_pConstantBufferPS);
		// Set shader texture resource in the pixel shader.
		g_pImmediateContext->PSSetShaderResources(0, 1, &m_texture);
		g_pImmediateContext->PSSetShaderResources(1, 1, &m_normalmap);
		g_pImmediateContext->PSSetShaderResources(2, 1, &m_specularmap);
		// Set the sampler state in the pixel shader.
		g_pImmediateContext->PSSetSamplers(0, 1, &m_sampleState);

		constBuffer = true;
	}

	//
	// Update variables for the first cube
	//
	ConstantBuffer cb1;
	cb1.mWorld = XMMatrixTranspose(g_World1);
	cb1.mView = XMMatrixTranspose(g_View);
	cb1.mProjection = XMMatrixTranspose(g_Projection);
	cb1.mNormal = XMMatrixTranspose(g_Normal1);
	//
	// Update variables for the second cube
	//
	ConstantBuffer cb2;
	cb2.mWorld = XMMatrixTranspose(g_World2);
	cb2.mView = XMMatrixTranspose(g_View);
	cb2.mProjection = XMMatrixTranspose(g_Projection);

	// JPE: variables for PS
	ConstantBufferPS psCb1;
	psCb1.time = t;
	psCb1.vecEye = XMFLOAT3(x, y, z);
	psCb1.bump = bump;
	psCb1.useTexture = useTexture;

	// FIRST PASS
	g_pImmediateContext->RSSetState(m_rasterState);
	g_pImmediateContext->VSSetShader(g_pVertexShader, NULL, 0);
	g_pImmediateContext->PSSetShader(g_pPixelShader, NULL, 0);

	// Render the first cube
	g_pImmediateContext->UpdateSubresource(g_pConstantBuffer, 0, NULL, &cb1, 0, 0);
	g_pImmediateContext->UpdateSubresource(g_pConstantBufferPS, 0, NULL, &psCb1, 0, 0);
	g_pImmediateContext->DrawIndexed( cantIndices, 0, 0 );
	// Render the second cube
	g_pImmediateContext->UpdateSubresource( g_pConstantBuffer, 0, NULL, &cb2, 0, 0 );
	g_pImmediateContext->DrawIndexed(cantIndices, 0, 0);
	
    // SECOND PASS
	if (wireframe)
	{
		g_pImmediateContext->RSSetState(m_rasterStateWF);
		g_pImmediateContext->VSSetShader(g_pVertexShaderWF, NULL, 0);
		g_pImmediateContext->PSSetShader(g_pPixelShaderWF, NULL, 0);

		// Render the first cube
		g_pImmediateContext->UpdateSubresource(g_pConstantBuffer, 0, NULL, &cb1, 0, 0);
		g_pImmediateContext->UpdateSubresource(g_pConstantBufferPS, 0, NULL, &psCb1, 0, 0);
		g_pImmediateContext->DrawIndexed(cantIndices, 0, 0);
		// Render the second cube
		g_pImmediateContext->UpdateSubresource(g_pConstantBuffer, 0, NULL, &cb2, 0, 0);
		g_pImmediateContext->DrawIndexed(cantIndices, 0, 0);
	}

    //
    // Present our back buffer to our front buffer
    //
	// JPE: primer parametro = 1 para Vertical Sync, 0 para Inmediato
	UINT SyncInterval = vsync ? 1: 0;
    g_pSwapChain->Present(SyncInterval, 0 );

	frameCount++;
	
	if (frameCount % frameDelay == 0)
	{
		DWORD tAct = timeGetTime();

		DWORD elapsed = tAct - tAnt;
		long frames = frameCount - frameCountLast;
		float fps = frames / (elapsed / 1000.0f);


		frameDelay = fps / 5;

		if (frameDelay < 10) frameDelay = 10;

		wchar_t text[256];

		swprintf(text, 256, L"FPS = %.1f", fps);

		SetWindowTextW(g_hWnd, text);

		frameCountLast = frameCount;
		tAnt = tAct;
	}
}
开发者ID:jpechevarria,项目名称:lab,代码行数:101,代码来源:Tutorial05.cpp

示例7: PerformancePageRefreshThread

DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
{
    ULONGLONG  CommitChargeTotal;
    ULONGLONG  CommitChargeLimit;
    ULONGLONG  CommitChargePeak;

    ULONG  CpuUsage;
    ULONG  CpuKernelUsage;

    ULONGLONG  KernelMemoryTotal;
    ULONGLONG  KernelMemoryPaged;
    ULONGLONG  KernelMemoryNonPaged;

    ULONGLONG  PhysicalMemoryTotal;
    ULONGLONG  PhysicalMemoryAvailable;
    ULONGLONG  PhysicalMemorySystemCache;

    ULONG  TotalHandles;
    ULONG  TotalThreads;
    ULONG  TotalProcesses;

    WCHAR  Text[260];
    WCHAR  szMemUsage[256];

    MSG    msg;

    LoadStringW(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, 256);

    while (1)
    {
        int nBarsUsed1;
        int nBarsUsed2;

        WCHAR szChargeTotalFormat[256];
        WCHAR szChargeLimitFormat[256];

        /*  Wait for an the event or application close */
        if (GetMessage(&msg, NULL, 0, 0) <= 0)
            return 0;

        if (msg.message == WM_TIMER)
        {
            /*
             *  Update the commit charge info
             */
            CommitChargeTotal = PerfDataGetCommitChargeTotalK();
            CommitChargeLimit = PerfDataGetCommitChargeLimitK();
            CommitChargePeak  = PerfDataGetCommitChargePeakK();
            _ultow(CommitChargeTotal, Text, 10);
            SetWindowTextW(hPerformancePageCommitChargeTotalEdit, Text);
            _ultow(CommitChargeLimit, Text, 10);
            SetWindowTextW(hPerformancePageCommitChargeLimitEdit, Text);
            _ultow(CommitChargePeak, Text, 10);
            SetWindowTextW(hPerformancePageCommitChargePeakEdit, Text);

            StrFormatByteSizeW(CommitChargeTotal * 1024,
                               szChargeTotalFormat,
                               sizeof(szChargeTotalFormat));

            StrFormatByteSizeW(CommitChargeLimit * 1024,
                               szChargeLimitFormat,
                               sizeof(szChargeLimitFormat));

            wsprintfW(Text, szMemUsage, szChargeTotalFormat, szChargeLimitFormat,
                      (CommitChargeLimit ? ((CommitChargeTotal * 100) / CommitChargeLimit) : 0));

            SendMessageW(hStatusWnd, SB_SETTEXT, 2, (LPARAM)Text);

            /*
             *  Update the kernel memory info
             */
            KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
            KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
            KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
            _ultow(KernelMemoryTotal, Text, 10);
            SetWindowTextW(hPerformancePageKernelMemoryTotalEdit, Text);
            _ultow(KernelMemoryPaged, Text, 10);
            SetWindowTextW(hPerformancePageKernelMemoryPagedEdit, Text);
            _ultow(KernelMemoryNonPaged, Text, 10);
            SetWindowTextW(hPerformancePageKernelMemoryNonPagedEdit, Text);

            /*
             *  Update the physical memory info
             */
            PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
            PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
            PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
            _ultow(PhysicalMemoryTotal, Text, 10);
            SetWindowTextW(hPerformancePagePhysicalMemoryTotalEdit, Text);
            _ultow(PhysicalMemoryAvailable, Text, 10);
            SetWindowTextW(hPerformancePagePhysicalMemoryAvailableEdit, Text);
            _ultow(PhysicalMemorySystemCache, Text, 10);
            SetWindowTextW(hPerformancePagePhysicalMemorySystemCacheEdit, Text);

            /*
             *  Update the totals info
             */
            TotalHandles = PerfDataGetSystemHandleCount();
            TotalThreads = PerfDataGetTotalThreadCount();
            TotalProcesses = PerfDataGetProcessCount();
//.........这里部分代码省略.........
开发者ID:hoangduit,项目名称:reactos,代码行数:101,代码来源:perfpage.c

示例8: UpdateProgressBarProc

BOOL UpdateProgressBarProc (__int64 byteOffset)
{
	wchar_t text[100];
	wchar_t speed[100];
	HWND hProgressBar = GetDlgItem (hCurPage, nPbar);
	int time = GetTickCount ();
	int elapsed = (time - startTime) / 1000;

	uint64 bytesDone = (bProgressBarReverse ? (TotalSize - byteOffset) : byteOffset);
	uint64 bytesPerSec = (bProgressBarReverse ? (resumedPointBytesDone - byteOffset) : (bytesDone - resumedPointBytesDone)) / (elapsed + 1);

	if (bPercentMode)
	{
		double perc = (double) (100.0 * (bProgressBarReverse ? ((double) (TotalSize - byteOffset)) : ((double) byteOffset)) / (TotalSize == 0 ? 0.0001 : ((double) TotalSize)));

		if (perc > 99.999999999)
			wcscpy (text, GetString ("PROCESSED_PORTION_100_PERCENT"));
		else
			_snwprintf (text, sizeof text/2, GetString ("PROCESSED_PORTION_X_PERCENT"), perc);

		wcscat (speed, L" ");
	}
	else
	{
		GetSizeString (bytesDone, text);
		if (bytesDone < (unsigned __int64) BYTES_PER_MB * 1000000)
			swprintf(text, L"%I64d %s ", bytesDone / BYTES_PER_MB, GetString ("MB"));
		else if (bytesDone < (unsigned __int64) BYTES_PER_GB * 1000000)
			swprintf(text, L"%I64d %s ", bytesDone / BYTES_PER_GB, GetString ("GB"));
		else if (bytesDone < (unsigned __int64) BYTES_PER_TB * 1000000)
			swprintf(text, L"%I64d %s ", bytesDone / BYTES_PER_TB, GetString ("TB"));
		else
			swprintf(text, L"%I64d %s ", bytesDone / BYTES_PER_PB, GetString ("PB"));
	}

	SetWindowTextW (GetDlgItem (hCurPage, IDC_BYTESWRITTEN), text);

	if (!bShowStatus)
	{
		GetSpeedString (bRWThroughput ? bytesPerSec*2 : bytesPerSec, speed);
		wcscat (speed, L" ");
		SetWindowTextW (GetDlgItem (hCurPage, IDC_WRITESPEED), speed);
	}

	if (byteOffset < TotalSize)
	{
		int64 sec = (int64) ((bProgressBarReverse ? byteOffset : (TotalSize - byteOffset)) / (bytesPerSec == 0 ? 0.001 : bytesPerSec));

		if (bytesPerSec == 0 || sec > 60 * 60 * 24 * 999)
			swprintf (text, L"%s ", GetString ("NOT_APPLICABLE_OR_NOT_AVAILABLE"));
		else if (sec >= 60 * 60 * 24 * 2)
			swprintf (text, L"%I64d %s ", sec / (60 * 24 * 60), days);
		else if (sec >= 120 * 60)
			swprintf (text, L"%I64d %s ", sec / (60 * 60), hours);
		else if (sec >= 120)
			swprintf (text, L"%I64d %s ", sec / 60, minutes);
		else
			swprintf (text, L"%I64d %s ", sec, seconds);

		SetWindowTextW (GetDlgItem (hCurPage, IDC_TIMEREMAIN), text);
	}

	prevTime = time;

	SendMessage (hProgressBar, PBM_SETPOS, 
		(int) (10000.0 * (bProgressBarReverse ? (TotalSize - byteOffset) : byteOffset) / (TotalSize == 0 ? 1 : TotalSize)),
		0);

	return bVolTransformThreadCancel;
}
开发者ID:steakknife,项目名称:YourProduct,代码行数:70,代码来源:Progress.c

示例9: onTitleChanged

void onTitleChanged(const wkeClientHandler* clientHandler, const wkeString title)
{
    HWND hWnd = 0;
    Ogre::Root::getSingleton().getAutoCreatedWindow()->getCustomAttribute("WINDOW", &hWnd);
    SetWindowTextW(hWnd, wkeToStringW(title));
}
开发者ID:DaneTheory,项目名称:wke,代码行数:6,代码来源:WebUIApp.cpp

示例10: BrsFolderDlgProc

/*************************************************************************
 *             BrsFolderDlgProc32  (not an exported API function)
 */
static INT_PTR CALLBACK BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
				          LPARAM lParam )
{
    browse_info *info;

    TRACE("hwnd=%p msg=%04x 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam );

    if (msg == WM_INITDIALOG)
        return BrsFolder_OnCreate( hWnd, (browse_info*) lParam );

    info = GetPropW( hWnd, szBrowseFolderInfo );

    switch (msg)
    {
    case WM_NOTIFY:
        return BrsFolder_OnNotify( info, (UINT)wParam, (LPNMHDR)lParam);

    case WM_COMMAND:
        return BrsFolder_OnCommand( info, wParam );

    case WM_WINDOWPOSCHANGING:
        return BrsFolder_OnWindowPosChanging( info, (WINDOWPOS *)lParam);

    case WM_SIZE:
        if (info->layout)  /* new style dialogs */
            LayoutUpdate(hWnd, info->layout, g_layout_info, LAYOUT_INFO_COUNT);
        return 0;

    case BFFM_SETSTATUSTEXTA:
        TRACE("Set status %s\n", debugstr_a((LPSTR)lParam));
        SetWindowTextA(GetDlgItem(hWnd, IDD_STATUS), (LPSTR)lParam);
        break;

    case BFFM_SETSTATUSTEXTW:
        TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam));
        SetWindowTextW(GetDlgItem(hWnd, IDD_STATUS), (LPWSTR)lParam);
        break;

    case BFFM_ENABLEOK:
        TRACE("Enable %ld\n", lParam);
        EnableWindow(GetDlgItem(hWnd, 1), lParam != 0);
        break;

    case BFFM_SETOKTEXT: /* unicode only */
        TRACE("Set OK text %s\n", debugstr_w((LPWSTR)lParam));
        SetWindowTextW(GetDlgItem(hWnd, 1), (LPWSTR)lParam);
        break;

    case BFFM_SETSELECTIONA:
        return BrsFolder_OnSetSelectionA(info, (LPVOID)lParam, (BOOL)wParam);

    case BFFM_SETSELECTIONW:
        return BrsFolder_OnSetSelectionW(info, (LPVOID)lParam, (BOOL)wParam);

    case BFFM_SETEXPANDED: /* unicode only */
        return BrsFolder_OnSetExpanded(info, (LPVOID)lParam, (BOOL)wParam, NULL);

    case WM_DESTROY:
        return BrsFolder_OnDestroy(info);
    }
    return FALSE;
}
开发者ID:DusteDdk,项目名称:wine-multimedia,代码行数:65,代码来源:brsfolder.c

示例11: setWindowText

void setWindowText(HWND hwnd, WCHAR *wtext)
{
	if (SetWindowTextW(hwnd, wtext) == 0)
		logLastError(L"error setting window text");
}
开发者ID:Alcaro,项目名称:RetroArch,代码行数:5,代码来源:text.cpp

示例12: BrsFolder_OnCreate

static BOOL BrsFolder_OnCreate( HWND hWnd, browse_info *info )
{
    LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;

    info->hWnd = hWnd;
    SetPropW( hWnd, szBrowseFolderInfo, info );

    if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
        FIXME("flags BIF_NEWDIALOGSTYLE partially implemented\n");
    if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS)
	FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS);

    if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
    {
        RECT rcWnd;

        info->layout = LayoutInit(hWnd, g_layout_info, LAYOUT_INFO_COUNT);

        /* TODO: Windows allows shrinking the windows a bit */
        GetWindowRect(hWnd, &rcWnd);
        info->szMin.cx = rcWnd.right - rcWnd.left;
        info->szMin.cy = rcWnd.bottom - rcWnd.top;
    }
    else
    {
        info->layout = NULL;
    }

    if (lpBrowseInfo->lpszTitle)
	SetWindowTextW( GetDlgItem(hWnd, IDD_TITLE), lpBrowseInfo->lpszTitle );
    else
	ShowWindow( GetDlgItem(hWnd, IDD_TITLE), SW_HIDE );

    if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT)
        || (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
	ShowWindow( GetDlgItem(hWnd, IDD_STATUS), SW_HIDE );

    /* Hide "Make New Folder" Button? */
    if ((lpBrowseInfo->ulFlags & BIF_NONEWFOLDERBUTTON)
        || !(lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
        ShowWindow( GetDlgItem(hWnd, IDD_MAKENEWFOLDER), SW_HIDE );

    /* Hide the editbox? */
    if (!(lpBrowseInfo->ulFlags & BIF_EDITBOX))
    {
        ShowWindow( GetDlgItem(hWnd, IDD_FOLDER), SW_HIDE );
        ShowWindow( GetDlgItem(hWnd, IDD_FOLDERTEXT), SW_HIDE );
    }

    info->hwndTreeView = GetDlgItem( hWnd, IDD_TREEVIEW );
    if (info->hwndTreeView)
    {
        InitializeTreeView( info );

        /* Resize the treeview if there's not editbox */
        if ((lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
            && !(lpBrowseInfo->ulFlags & BIF_EDITBOX))
        {
            RECT rc;
            GetClientRect(info->hwndTreeView, &rc);
            SetWindowPos(info->hwndTreeView, HWND_TOP, 0, 0,
                         rc.right, rc.bottom + 40, SWP_NOMOVE);
        }
    }
    else
        ERR("treeview control missing!\n");

    browsefolder_callback( info->lpBrowseInfo, hWnd, BFFM_INITIALIZED, 0 );

    return TRUE;
}
开发者ID:DusteDdk,项目名称:wine-multimedia,代码行数:71,代码来源:brsfolder.c

示例13: DisplayMessageBox

bool DisplayMessageBox(const char* pTitle, const char* pText)
{
    #define ID_EDIT 100

    struct Dialog
    {
        static size_t LineCount(const char* pText)
        {
            size_t count = 0;
            while(*pText)
            {
                if(*pText++ == '\n')
                    count++;
            }
            return count;
        }

        static WORD* WordUp(WORD* pIn){ return (WORD*)((((uintptr_t)pIn + 3) >> 2) << 2); }

        static BOOL CALLBACK Proc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
        {
            switch (iMsg)
            {
                case WM_INITDIALOG:
                {
                    HWND hWndEdit = GetDlgItem(hDlg, ID_EDIT);

                    const wchar_t* pText = (const wchar_t*)lParam;
                    SetWindowTextW(hWndEdit, pText);

                    HFONT hFont = CreateFontW(-11, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, L"Courier New");
                    if(hFont)
                        SendMessage(hWndEdit, WM_SETFONT, WPARAM(hFont), TRUE);

                    SendMessage(hWndEdit, EM_SETSEL, (WPARAM)0, (LPARAM)0);

                    return TRUE;
                }

                case WM_COMMAND:
                    switch (LOWORD(wParam))
                    {
                        case ID_EDIT:
                        {
                            // Handle messages from the edit control here.
                            HWND hWndEdit = GetDlgItem(hDlg, ID_EDIT);
                            SendMessage(hWndEdit, EM_SETSEL, (WPARAM)0, (LPARAM)0);
                            return TRUE;
                        }

                        case IDOK:
                            EndDialog(hDlg, 0);
                            return TRUE;
                        case IDABORT:
                            _exit(0); // We don't call abort() because the visual studio runtime
                                      // will capture the signal and throw up another dialog
                    }
                    break;
                case WM_CLOSE:

                    EndDialog(hDlg, 0);
                    return TRUE;
            }

            return FALSE;
        }
    };
开发者ID:IamSVP,项目名称:OculusRenderer,代码行数:67,代码来源:Util_SystemGUI.cpp

示例14: SetWindowTextW

	void UGameWindow::SetWindowName(const eastl::string& inWindowName)
	{
		auto wWindowName = utf8util::UTF16FromUTF8(inWindowName);
		SetWindowTextW(m_hWnd, wWindowName.c_str());
	}
开发者ID:Valakor,项目名称:MADEngine,代码行数:5,代码来源:GameWindow.cpp

示例15: winopen

void winopen()
{
	WNDCLASS wc;
	HMENU menu;
	RECT r;
	ATOM a;

	/* Create and register window frame class */
	memset(&wc, 0, sizeof(wc));
	wc.style = 0;
	wc.lpfnWndProc = frameproc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = GetModuleHandle(NULL);
	wc.hIcon = LoadIconA(wc.hInstance, "IDI_ICONAPP");
	wc.hCursor = NULL; //LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = NULL;
	wc.lpszMenuName = NULL;
	wc.lpszClassName = L"FrameWindow";
	a = RegisterClassW(&wc);
	if (!a)
		winerror(&gapp, "cannot register frame window class");

	/* Create and register window view class */
	memset(&wc, 0, sizeof(wc));
	wc.style = CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc = viewproc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = GetModuleHandle(NULL);
	wc.hIcon = NULL;
	wc.hCursor = NULL;
	wc.hbrBackground = NULL;
	wc.lpszMenuName = NULL;
	wc.lpszClassName = L"ViewWindow";
	a = RegisterClassW(&wc);
	if (!a)
		winerror(&gapp, "cannot register view window class");

	/* Get screen size */
	SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
	gapp.scrw = r.right - r.left;
	gapp.scrh = r.bottom - r.top;

	/* Create cursors */
	arrowcurs = LoadCursor(NULL, IDC_ARROW);
	handcurs = LoadCursor(NULL, IDC_HAND);
	waitcurs = LoadCursor(NULL, IDC_WAIT);
	caretcurs = LoadCursor(NULL, IDC_IBEAM);

	/* And a background color */
	bgbrush = CreateSolidBrush(RGB(0x70,0x70,0x70));
	shbrush = CreateSolidBrush(RGB(0x40,0x40,0x40));

	/* Init DIB info for buffer */
	dibinf = malloc(sizeof(BITMAPINFO) + 12);
	assert(dibinf);
	dibinf->bmiHeader.biSize = sizeof(dibinf->bmiHeader);
	dibinf->bmiHeader.biPlanes = 1;
	dibinf->bmiHeader.biBitCount = 32;
	dibinf->bmiHeader.biCompression = BI_RGB;
	dibinf->bmiHeader.biXPelsPerMeter = 2834;
	dibinf->bmiHeader.biYPelsPerMeter = 2834;
	dibinf->bmiHeader.biClrUsed = 0;
	dibinf->bmiHeader.biClrImportant = 0;
	dibinf->bmiHeader.biClrUsed = 0;

	/* Create window */
	hwndframe = CreateWindowW(L"FrameWindow", // window class name
	NULL, // window caption
	WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
	CW_USEDEFAULT, CW_USEDEFAULT, // initial position
	300, // initial x size
	300, // initial y size
	0, // parent window handle
	0, // window menu handle
	0, // program instance handle
	0); // creation parameters
	if (!hwndframe)
		winerror(&gapp, "cannot create frame");

	hwndview = CreateWindowW(L"ViewWindow", // window class name
	NULL,
	WS_VISIBLE | WS_CHILD,
	CW_USEDEFAULT, CW_USEDEFAULT,
	CW_USEDEFAULT, CW_USEDEFAULT,
	hwndframe, 0, 0, 0);
	if (!hwndview)
		winerror(&gapp, "cannot create view");

	hdc = NULL;

	SetWindowTextW(hwndframe, L"MuPDF");

	menu = GetSystemMenu(hwndframe, 0);
	AppendMenuW(menu, MF_SEPARATOR, 0, NULL);
	AppendMenuW(menu, MF_STRING, ID_ABOUT, L"About MuPDF...");
	AppendMenuW(menu, MF_STRING, ID_DOCINFO, L"Document Properties...");

	SetCursor(arrowcurs);
//.........这里部分代码省略.........
开发者ID:fengxueysf,项目名称:sumatrapdf,代码行数:101,代码来源:win_main.c


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