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


C++ StringCbPrintf函数代码示例

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


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

示例1: DllUnregisterServer

/*F+F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F
  Function: DllUnregisterServer

  Summary:  The standard exported function that can be called to command
            this DLL server to unregister itself from the system Registry.

  Args:     void.

  Returns:  HRESULT
              NOERROR
F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F-F*/
STDAPI DllUnregisterServer(void)
{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+1];
  TCHAR    szTemp[GUID_SIZE+1];

  /*-------------------------------------------------------------------------
    Delete registry entries for the Ball Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_Ball, szID, GUID_SIZE);
  hr = StringCbCopy(szCLSID, sizeof(szCLSID), TEXT("CLSID\\"));
  assert(hr == S_OK);
  hr = StringCbCat(szCLSID, sizeof(szCLSID), szID);
  assert(hr == S_OK);

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("DllBall\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("DllBall\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("DllBall"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("DllBall1.0\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("DllBall1.0"));

  hr = StringCbPrintf(szTemp, sizeof(szTemp), TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  assert(hr == S_OK);
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  hr = StringCbPrintf(szTemp, sizeof(szTemp), TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  assert(hr == S_OK);
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  hr = StringCbPrintf(szTemp, sizeof(szTemp), TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  assert(hr == S_OK);
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  hr = StringCbPrintf(szTemp, sizeof(szTemp), TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  assert(hr == S_OK);
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  return hr;
}
开发者ID:Jinjiego,项目名称:VCSamples,代码行数:55,代码来源:freserve.cpp

示例2: StdHFCErrorCallbackMsgBox

HFCERROR StdHFCErrorCallbackMsgBox(HFCERROR nError,DWORD_PTR dwData)
{
	if (nError!=HFC_NOERROR)
	{
		char text[1000];
		StringCbPrintf(text,1000,"Code %X:%s",(DWORD)nError,GetStdErrorStr(nError));
		MessageBox((HWND)dwData,text,"HFC Error",MB_ICONERROR|MB_OK);
	}
	return nError;
}
开发者ID:eladkarako,项目名称:locate32,代码行数:10,代码来源:Error.cpp

示例3: GetLocalTime

TCHAR *GetTimeDateStr()															// Return date and time [01/01/2013]:[22:29:22]
{
	TCHAR *tStr = new TCHAR[50];
	SYSTEMTIME time;

	GetLocalTime(&time);

	StringCbPrintf(tStr,50,TEXT("[%02d/%02d/%04d]:[%02d:%02d:%02d]"),time.wDay,time.wMonth,time.wYear, time.wHour,time.wMinute,time.wSecond);
	return tStr;
}
开发者ID:dmcgold,项目名称:ChatProgram,代码行数:10,代码来源:Output.cpp

示例4: STDMETHODIMP_

STDMETHODIMP_(ULONG) CShellExtClassFactory::AddRef()
{
    ODS("CShellExtClassFactory::AddRef()");

	char szNum[100];
	StringCbPrintf(szNum,100,"m_cRef is after this call %d",m_cRef+1);
	DebugMessage(szNum);

	return ++m_cRef;
}
开发者ID:eladkarako,项目名称:locate32,代码行数:10,代码来源:LocateShellExtension.Cpp

示例5: IsKeyExist

	//***************************************************************************************************
	// check if the key is already exist
	bool IsKeyExist( HKEY hKey, LPCTSTR lpcsPath, LPCTSTR lpcsKeyName )
	{
		HKEY hSubKey = NULL;
		_TCHAR tcsKey[MAX_PATH];
		if ( lpcsKeyName != NULL ) {
			StringCbPrintf( tcsKey, MAX_PATH* sizeof(_TCHAR), _T("%s\\%s"), lpcsPath, lpcsKeyName );
		}
		else	{
			StringCbPrintf( tcsKey, MAX_PATH* sizeof(_TCHAR), _T("%s"), lpcsPath );
		}

		if ( ERROR_SUCCESS == ::RegOpenKeyEx( hKey, tcsKey, 0, KEY_READ, &hSubKey)
			&& hSubKey != NULL )
		{
			::RegCloseKey( hSubKey );
			return true;
		}
		return false;
	}
开发者ID:tulip2014,项目名称:base,代码行数:21,代码来源:RegUtils.cpp

示例6: AclToString

char *
AclToString(struct Acl *acl)
{
    static char mydata[AFS_PIOCTL_MAXSIZE];
    char tstring[AFS_PIOCTL_MAXSIZE];
    char dfsstring[30];
    struct AclEntry *tp;

    if (acl->dfs) {
        if( FAILED(StringCbPrintf(dfsstring, sizeof(dfsstring), " dfs:%d %s", acl->dfs, acl->cell))) {
            fprintf (stderr, "dfsstring - cannot be populated");
            exit(1);
        }
    } else {
        dfsstring[0] = '\0';
    }
    if( FAILED(StringCbPrintf(mydata, sizeof(mydata), "%d%s\n%d\n", acl->nplus, dfsstring, acl->nminus))) {
        fprintf (stderr, "mydata - cannot be populated");
        exit(1);
    }
    for (tp = acl->pluslist;tp;tp=tp->next) {
        if( FAILED(StringCbPrintf(tstring, sizeof(tstring), "%s %d\n", tp->name, tp->rights))) {
            fprintf (stderr, "tstring - cannot be populated");
            exit(1);
        }
        if( FAILED(StringCbCat(mydata, sizeof(mydata), tstring))) {
            fprintf (stderr, "mydata - not enough space");
            exit(1);
        }
    }
    for (tp = acl->minuslist;tp;tp=tp->next) {
        if( FAILED(StringCbPrintf(tstring, sizeof(tstring), "%s %d\n", tp->name, tp->rights))) {
            fprintf (stderr, "tstring - cannot be populated");
            exit(1);
        }
        if( FAILED(StringCbCat(mydata, sizeof(mydata), tstring))) {
            fprintf (stderr, "mydata - not enough space");
            exit(1);
        }
    }
    return mydata;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:42,代码来源:fs_acl.c

示例7: ZeroMemory

const TCHAR *DeviceInfo::LocationString()
{
    static TCHAR   locus[30];

    if (devUsbValid) {
        ZeroMemory(locus, sizeof(locus));
        StringCbPrintf(locus, sizeof(locus), _T("USB hub %i port %i"), devUsbHub, devUsbPort);
        return locus;
    }
    return NULL;
}
开发者ID:androdev4u,项目名称:RFIDler,代码行数:11,代码来源:deviceinfo.cpp

示例8: va_start

VOID CFormatMessage::OutputDebugString(LPCTSTR szFormat,...)
{
	va_list vagrc;
	va_start(vagrc,szFormat);
	TCHAR szParamText[2048]={NULL};
	StringCbVPrintf(szParamText,sizeof(szParamText),szFormat,vagrc);
	va_end(vagrc);
	INT nLen = _tcslen(szParamText);
	StringCbPrintf(&szParamText[nLen],sizeof(szParamText)-nLen,TEXT("\r\n╢МнСт╜рР:(%d)%s"),m_nLastError,szErrorText);
	::OutputDebugString(szParamText);
}
开发者ID:int09,项目名称:SuperPM,代码行数:11,代码来源:Common.cpp

示例9: EndDialog

/**\brief static dialog callback procedure
 *
 * The default behavior you get out of this procedure is:
 * - Stores the dialog pointer passed in on lParam in GWLP_USERDATA for later use
 * - Bails if there is no dialog pointer in GWLP_USERDATA on any message other than INITDIALOG
 * - Forwards to the polymorphic ProcessMessage method on the BMD instance
 * - Calls EndDialog if you percolate an IDOK or IDCANCEL back up the stack
 */
INT_PTR CALLBACK BasicModalDialog::_DlgProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  BasicModalDialog *bmd = (BasicModalDialog *)NULL;

  // the bmd pointer will be cached in GWLP_USERDATA once we get an INITDIALOG message
  bmd = reinterpret_cast<BasicModalDialog *>(GetWindowLongPtr(hWndDlg,GWLP_USERDATA));

  // Toss everything to the default dialog proc until we get the INITDIALOG message that has our camera pointer
  if(bmd == NULL && uMsg != WM_INITDIALOG)
  {
    // if we get a CANCEL in the interim, bail out
    if(uMsg == WM_COMMAND && LOWORD(wParam) == IDCANCEL)
    {
      EndDialog(hWndDlg,LOWORD(wParam));
      return TRUE;
    }
    return FALSE;
  } // fall through: bmd != NULL and/or WM_INITDIALOG

  if(uMsg == WM_INITDIALOG)
  {
    // bmd is in lParam
    bmd = reinterpret_cast<BasicModalDialog *>(lParam);
    // idiotproofing for bad bmd pointer at this point
    if(bmd == NULL)
    {
      MessageBox(hWndDlg,"Invalid context pointer passed to DialogBoxParam!","BasicModalDialog Error",MB_OK|MB_ICONERROR);
      EndDialog(hWndDlg,-1);
      return TRUE;
    } else {
      char buf[256];
      StringCbPrintf(buf,sizeof(buf),"BasicModalDialog::_DlgProc: bmd @ %p\n",bmd);
      OutputDebugString(buf);
      // cache in GWLP_USERDATA
      SetWindowLongPtr(hWndDlg,GWLP_USERDATA,(LONG_PTR)(bmd));
    }
    // here bmd guaranteed non-NULL
  } // else msg != WM_INITDIALOG, so bmd != NULL from previous test... fall through

  // all paths here lead to bmd != NULL, so forward the message to the virtual handler

  bool res = bmd->ProcessMessage(hWndDlg,uMsg,wParam,lParam);
  if(!res)
  {
    // do minimum of watching for IDOK/IDCANCEL and closing the dialog
    if(uMsg == WM_COMMAND && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) )
    {
      EndDialog(hWndDlg, LOWORD(wParam));
      res = true;
    }
  }
  return res ? TRUE : FALSE;
}
开发者ID:adasworks,项目名称:libdc1394-cmake,代码行数:61,代码来源:BasicModalDialog.cpp

示例10: PrintDebugStatus

void DeviceInfo::UpdateDeviceState(enum DevState aDevState, FILETIME aNow, unsigned aScanId)
{
    // check for change of state, eg removed etc...
    if (devState != aDevState) {
        BOOL chgState = FALSE;

        if (aDevState == DevAbsent) {
            if ((devState == DevPresent) || (devState == DevArrived)) {
#ifdef _DEBUG
                PrintDebugStatus(_T("Change state to removed\n"));
#endif
                // update DeviceTracker counts, decide on notifications
                gdevTracker->DetermineRemovalNotifications(devType, devState, DevRemoved);

                devState = DevRemoved;
                devElapsed = 0;
                devTimestamp = aNow;
                chgState = TRUE;
                // update counts
                DecDeviceTypeCount();
            }
        } else if (aDevState == DevPresent) {
            if ((devState == DevAbsent) || (devState == DevRemoved)) {
#ifdef _DEBUG
                PrintDebugStatus(_T("Change state to arrived\n"));
#endif
                devDeleteOnUnlock = FALSE; // device has returned, no longer need to delete

                // update DeviceTracker counts, decide on notifications 
                gdevTracker->DetermineArrivalNotifications(devType, aDevState);

                devState = gdevTracker->CheckInitialScanFlag(devType) ? DevPresent : DevArrived;
                devTimestamp = aNow;
                devElapsed = 0;
                chgState = TRUE;
                // update counts
                IncDeviceTypeCount();
            }
        }

        if (chgState) {
            TCHAR   buffer[20];

            StringCbPrintf(buffer, sizeof(buffer), _T("%s 0min"), StateName());
            SetDeviceIcon();

            // update port status & icon on display
            gdevTracker->UpdateViewItemIconAndState(devImage, buffer, (LPARAM)this);
        }
    }

    devScanId = aScanId;
}
开发者ID:androdev4u,项目名称:RFIDler,代码行数:53,代码来源:deviceinfo.cpp

示例11: ShowErrorMessage

void ShowErrorMessage(HWND hwnd, PCWSTR format, HRESULT hrErr)
{
    HRESULT hr = S_OK;
    WCHAR msg[MAX_PATH];

    hr = StringCbPrintf(msg, sizeof(msg), L"%s (hr=0x%X)", format, hrErr);

    if (SUCCEEDED(hr))
    {
        MessageBox(hwnd, msg, L"Error", MB_ICONERROR);
    }
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:12,代码来源:winmain.cpp

示例12: CreateLnkOnDesktop

void CreateLnkOnDesktop(const LPWSTR connTitle)
{
	IShellLink   *SLink;
	IPersistFile *PF;
	HRESULT HRes;
	TCHAR desktop_path[MAX_PATH] = TEXT("");
	TCHAR pszFullLnkPath[MAX_PATH]; 

	CoInitialize(NULL);

	ITEMIDLIST* pidl1 = NULL;
    SHGetFolderLocation(NULL, CSIDL_CONNECTIONS, NULL, 0, &pidl1);
    IShellFolder *desktop, *ncfolder;
    SHGetDesktopFolder(&desktop);
    desktop->BindToObject(pidl1, NULL, IID_IShellFolder, (void**)&ncfolder);

    IEnumIDList *items;
    ncfolder->EnumObjects(NULL, SHCONTF_NONFOLDERS, &items);
    ITEMIDLIST* pidl2 = NULL;
    while (S_OK == items->Next(1, &pidl2, NULL))
    {
        STRRET sr = {STRRET_WSTR};
        ncfolder->GetDisplayNameOf(pidl2, SHGDN_NORMAL, &sr);

        TCHAR buf[MAX_PATH] = TEXT("");
        StrRetToBuf(&sr, pidl2, buf, MAX_PATH);

        if (0 == StrCmpI(buf, connTitle))
        {
            ITEMIDLIST* pidl3 = ILCombine(pidl1, pidl2);
			HRESULT HRes = CoCreateInstance(CLSID_ShellLink, 0, CLSCTX_INPROC_SERVER, IID_IShellLink, ( LPVOID*)&SLink);
            SLink->SetIDList(pidl3);
			SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktop_path);
			StringCbPrintf(pszFullLnkPath, MAX_PATH * sizeof(TCHAR), TEXT("%s\\%s.lnk"), desktop_path, connTitle);
			HRes = SLink->QueryInterface(IID_IPersistFile, (LPVOID*)&PF);
			HRes = PF->Save((LPCOLESTR)pszFullLnkPath, TRUE);
			PF->Release();
			SLink->Release();
            ILFree(pidl3);
            ILFree(pidl2);
            break;
        }

        ILFree(pidl2);
        pidl2 = NULL;
    }
	ncfolder->Release();
	desktop->Release();

    ILFree(pidl1);

	CoUninitialize();
}
开发者ID:nezhelskoy,项目名称:VPNConnectionSetup,代码行数:53,代码来源:main.cpp

示例13: KeyHook

// 키보드 후킹 프로시저
LRESULT CALLBACK
KeyHook(int code, WPARAM w, LPARAM l)
{
	if(code >= 0)
	{
		TCHAR buf[80];

        StringCbPrintf(buf, sizeof(buf), TEXT("%c"), w);
		OutputDebugString(buf);
	}

    return CallNextHookEx(NULL, code, w, l);
}
开发者ID:seungbe0m,项目名称:KeyboardHook,代码行数:14,代码来源:keyhk.cpp

示例14: InitDebugLog

BOOL
InitDebugLog(LPWSTR lpLogName, LPWSTR lpVersion)
{
    WCHAR szPath[MAX_PATH], szMsg[MAX_STR_LEN],
          szCurrentPath[MAX_PATH];
    DWORD dwBytesWritten;

    if (!GetCurrentPath(szCurrentPath, MAX_PATH))
        return FALSE;

    StringCbPrintf(szPath, sizeof(szPath),
                   L"%s%s",
                   szCurrentPath,
                   lpLogName);

    hDebugLog = CreateFile(szPath,
                           GENERIC_WRITE,
                           FILE_SHARE_READ | FILE_SHARE_WRITE,
                           NULL,
                           CREATE_ALWAYS,
                           FILE_ATTRIBUTE_NORMAL,
                           NULL);
    if (hDebugLog == INVALID_HANDLE_VALUE)
        return FALSE;
    
    WriteFile(hDebugLog, "\xFF\xFE", 2, &dwBytesWritten, NULL);

    StringCbPrintf(szMsg, sizeof(szMsg),
#ifdef _M_IX86
                   L"Log file created, Aspia %s",
#else
                   L"Log file created, Aspia %s (x64)",
#endif
                   lpVersion);
    DebugTrace(szMsg);

    return TRUE;
}
开发者ID:WilkGardariki,项目名称:aspia,代码行数:38,代码来源:debug.c

示例15: StartCounter

void StartCounter()
{
  int i;
  TCHAR buffer[255];

  for(i = 0; i < 100; i++)
  {
    StringCbPrintf(buffer, sizeof(buffer), TEXT("%d"), i);
    if(g_dlg)
    {
      g_dlg->Append(buffer);
    }
  }
}
开发者ID:mossywell,项目名称:VS2003-Custom-Dialog-0.0.1,代码行数:14,代码来源:Test1.cpp


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