本文整理汇总了C++中StringFromCLSID函数的典型用法代码示例。如果您正苦于以下问题:C++ StringFromCLSID函数的具体用法?C++ StringFromCLSID怎么用?C++ StringFromCLSID使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了StringFromCLSID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HeapAlloc
/**********************************************************************
* register_namespace_extensions
*/
static WCHAR *get_namespace_key(struct regsvr_namespace const *list) {
static const WCHAR wszExplorerKey[] = {
'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'E','x','p','l','o','r','e','r','\\',0 };
static const WCHAR wszNamespace[] = { '\\','N','a','m','e','s','p','a','c','e','\\',0 };
WCHAR *pwszKey, *pwszCLSID;
pwszKey = HeapAlloc(GetProcessHeap(), 0, sizeof(wszExplorerKey)+sizeof(wszNamespace)+
sizeof(WCHAR)*(lstrlenW(list->parent)+CHARS_IN_GUID));
if (!pwszKey)
return NULL;
lstrcpyW(pwszKey, wszExplorerKey);
lstrcatW(pwszKey, list->parent);
lstrcatW(pwszKey, wszNamespace);
if (FAILED(StringFromCLSID(list->clsid, &pwszCLSID))) {
HeapFree(GetProcessHeap(), 0, pwszKey);
return NULL;
}
lstrcatW(pwszKey, pwszCLSID);
CoTaskMemFree(pwszCLSID);
return pwszKey;
}
示例2: GUID2String
void GUID2String(GUID *guid, LPOLESTR *str)
{
if (guid && str)
{
CLSID clsid = *guid;
StringFromCLSID(clsid, str);
}
}
示例3: GUIDToStr
tstring GUIDToStr(GUID clsid)
{
LPOLESTR str = NULL;
StringFromCLSID(clsid, &str);
tstring ret(str);
CoTaskMemFree(str);
return ret;
}
示例4: InitializePropertyDialog
VOID
InitializePropertyDialog(
LANSTATUSUI_CONTEXT * pContext,
NETCON_PROPERTIES * pProperties)
{
DWORD dwSize, dwAdapterIndex, dwResult;
LPOLESTR pStr;
IP_ADAPTER_INFO *pAdapterInfo, *pCurAdapter;
if (FAILED(StringFromCLSID((CLSID)pProperties->guidId, &pStr)))
{
return;
}
/* get the IfTable */
dwSize = 0;
dwResult = GetAdaptersInfo(NULL, &dwSize);
if (dwResult!= ERROR_BUFFER_OVERFLOW)
{
CoTaskMemFree(pStr);
return;
}
pAdapterInfo = static_cast<PIP_ADAPTER_INFO>(CoTaskMemAlloc(dwSize));
if (!pAdapterInfo)
{
CoTaskMemFree(pAdapterInfo);
CoTaskMemFree(pStr);
return;
}
if (GetAdaptersInfo(pAdapterInfo, &dwSize) != NO_ERROR)
{
CoTaskMemFree(pAdapterInfo);
CoTaskMemFree(pStr);
return;
}
if (!GetAdapterIndexFromNetCfgInstanceId(pAdapterInfo, pStr, &dwAdapterIndex))
{
CoTaskMemFree(pAdapterInfo);
CoTaskMemFree(pStr);
return;
}
pCurAdapter = pAdapterInfo;
while (pCurAdapter->Index != dwAdapterIndex)
pCurAdapter = pCurAdapter->Next;
pContext->IpAddress = inet_addr(pCurAdapter->IpAddressList.IpAddress.String);
pContext->SubnetMask = inet_addr(pCurAdapter->IpAddressList.IpMask.String);
pContext->Gateway = inet_addr(pCurAdapter->GatewayList.IpAddress.String);
pContext->DHCPEnabled = pCurAdapter->DhcpEnabled;
CoTaskMemFree(pStr);
CoTaskMemFree(pAdapterInfo);
pContext->dwAdapterIndex = dwAdapterIndex;
}
示例5: bstr
HRESULT CCoordTransService::FindCTF (void)
{
USES_CONVERSION;
char cbCTFName[_MAX_PATH];
CComBSTR bstr (GetProperty (m_Props, g_cbCoordTransform, A2OLE(g_cbDefault)));
strcpy (cbCTFName, OLE2A(bstr));
if (!stricmp (cbCTFName, g_cbDefault))
m_fIsDefault = true;
// CTFService's über CATID enumerieren, CTFService wiederfinden
try {
WEnumGUID EnumGuids; // Enumerator der CTFService-Objekte
WCatInformation CatInfo (CLSID_StdComponentCategoriesMgr); // throws hr
GUID guidImpl[1];
guidImpl[0] = CATID_TRiASCoordsystem;
THROW_FAILED_HRESULT(CatInfo -> EnumClassesOfCategories (1, guidImpl, 0, NULL, EnumGuids.ppi()));
GUID guid;
LPOLESTR lpGuid = NULL;
bool fFoundGuid = false;
for (EnumGuids -> Reset(); S_OK == EnumGuids -> Next (1, &guid, NULL); /**/)
{
THROW_FAILED_HRESULT(StringFromCLSID (guid, &lpGuid));
CClassesRoot regClsID (OLE2A(lpGuid));
char cbBuffer[_MAX_PATH];
LONG lSize = sizeof(cbBuffer);
if (NULL != lpGuid) {
CoTaskMemFree (lpGuid);
lpGuid = NULL;
}
if (regClsID.isValid() && regClsID.GetSZ (g_cbOldName, cbBuffer, lSize))
{
if (!stricmp (cbBuffer, cbCTFName)) {
fFoundGuid = true;
m_strCTF = cbBuffer;
break;
}
}
}
if (!fFoundGuid) {
TX_ASSERT(fFoundGuid);
return E_FAIL; // snh!
}
} catch (_com_error &e) {
TX_ASSERT(S_OK == _COM_ERROR(e));
return _COM_ERROR(e);
}
return S_OK;
}
示例6: PrintTInfo
HRESULT PrintTInfo(ITypeInfo* pTinfo, int indentation){
TYPEATTR* pTypeAttr;
HRESULT hr = pTinfo->GetTypeAttr(&pTypeAttr); COMRet(hr);
for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT(" ");
LPOLESTR guid_str;
hr = StringFromCLSID(pTypeAttr->guid, &guid_str);
std::wcout<<guid_str<<std::endl;
// Inherited Interfaces, therefore we recursively call PrintInfo
for(int i = 0; i != pTypeAttr->cImplTypes; ++i){
HREFTYPE RefType;
hr = pTinfo->GetRefTypeOfImplType(i, &RefType); COMRet(hr);
ITypeInfo* pImplTinfo;
hr = pTinfo->GetRefTypeInfo(RefType, &pImplTinfo); COMRet(hr);
hr = PrintTInfo(pImplTinfo, indentation + 1); if(hr != S_OK && hr != TYPE_E_BADMODULEKIND) return hr; // Because this ITypeInfo is retrieved
pImplTinfo->Release(); // directly from a .tlb file instead
// of a .dll, AddressofMember fails
}
//member functions
for(int i = 0; i != pTypeAttr->cFuncs; ++i){
FUNCDESC* pFuncDesc;
hr = pTinfo->GetFuncDesc(i, &pFuncDesc); COMRet(hr);
const UINT cMaxNames = 10; UINT cNames;
BSTR rgBstrNames[cMaxNames];
hr = pTinfo->GetNames(pFuncDesc->memid, rgBstrNames, cMaxNames, &cNames); COMRet(hr);
void* pv;
hr = pTinfo->AddressOfMember(pFuncDesc->memid, pFuncDesc->invkind, &pv); if(hr != S_OK && hr != TYPE_E_BADMODULEKIND) return hr;
for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT(" ");
std::wcout<<TEXT("Func memid = ")<<pFuncDesc->memid<<TEXT(" Name = ")<<*rgBstrNames<<TEXT(" DllAddress = ")<<pv<<std::endl;
for(int j = 0; j != pFuncDesc->cParams; ++j){
TCHAR szBuffer[30];
wParamFlagsTranslate(pFuncDesc->lprgelemdescParam->paramdesc.wParamFlags, szBuffer, 30);
for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT(" ");
std::wcout<<TEXT(" ")<<szBuffer<<TEXT(" ")<<*(rgBstrNames+j+1)<<TEXT(": ")<<std::endl;
TExpandPointer(pFuncDesc->lprgelemdescParam->tdesc, 2);
}
pTinfo->ReleaseFuncDesc(pFuncDesc);
}
//member variables
for(int i = 0; i != pTypeAttr->cVars; ++i){
VARDESC* pVarDesc;
hr = pTinfo->GetVarDesc(i, &pVarDesc); COMRet(hr);
for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT(" ");
std::wcout<<TEXT("Var memid = ")<<pVarDesc->memid<<TEXT("Varkind = ")<<pVarDesc->varkind<<std::endl;
TCHAR szBuffer[30];
wParamFlagsTranslate(pVarDesc->elemdescVar.paramdesc.wParamFlags, szBuffer, 30);
for(int inden = 0; inden != indentation; ++inden) std::wcout<<TEXT(" ");
std::wcout<<" Variable wParamFlags: "<<szBuffer<<std::endl;
TExpandPointer(pVarDesc->elemdescVar.tdesc, 1);
pTinfo->ReleaseVarDesc(pVarDesc);
}
pTinfo->ReleaseTypeAttr(pTypeAttr);
return hr;
}
示例7: CHECK_HR
HRESULT WpdObjectResources::CreateResourceContext(
_In_ ContextMap* pContextMap,
_In_ LPCWSTR pszObjectID,
_In_ REFPROPERTYKEY ResourceKey,
_In_ BOOL bCreateRequest,
_Outptr_ LPWSTR* ppszResourceContext)
{
HRESULT hr = S_OK;
GUID guidContext = GUID_NULL;
ResourceContext* pContext = NULL;
if((pContextMap == NULL) ||
(pszObjectID == NULL) ||
(ppszResourceContext == NULL))
{
hr = E_POINTER;
CHECK_HR(hr, "Cannot have NULL parameter");
return hr;
}
*ppszResourceContext = NULL;
hr = CoCreateGuid(&guidContext);
CHECK_HR(hr, "Failed to CoCreateGuid used for identifying the resource context");
if (SUCCEEDED(hr))
{
pContext = new ResourceContext();
if(pContext == NULL)
{
hr = E_OUTOFMEMORY;
CHECK_HR(hr, "Failed to allocate new resource context");
}
}
if (SUCCEEDED(hr))
{
pContext->ObjectID = pszObjectID;
pContext->Key = ResourceKey;
pContext->CreateRequest = bCreateRequest;
CAtlStringW strKey = CComBSTR(guidContext);
hr = pContextMap->Add(strKey, pContext);
CHECK_HR(hr, "Failed to insert bulk property operation context into our context Map");
}
if (SUCCEEDED(hr))
{
hr = StringFromCLSID(guidContext, ppszResourceContext);
CHECK_HR(hr, "Failed to allocate string from GUID for resource context");
}
SAFE_RELEASE(pContext);
return hr;
}
示例8: GUIDGen
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
bstr_t GUIDGen()
{
GUID NewGuid;
CoCreateGuid(&NewGuid);
LPOLESTR strW;
StringFromCLSID(NewGuid,&strW);
CString str = strW;
CoTaskMemFree((void*)strW);
return str.Mid(1,36);
}
示例9: CHECKPARAM
void tCOMUtil::DumpTypeInfo(ITypeInfo *typeinfo)
{
HRESULT hr = S_OK;
TYPEATTR* pta = NULL;
CHECKPARAM(typeinfo);
hr = typeinfo->GetTypeAttr(&pta);
CHK_COM_CODE(hr);
// prints IID
LPOLESTR lpsz = NULL;
#ifdef __WINE__
hr = 0;
MessageBox(NULL, "FIX - not implemented - StringFromIID", "LuaCOM", MB_ICONEXCLAMATION);
#warning FIX - not implemented - StringFromIID
#else
hr = StringFromIID(pta->guid, &lpsz);
#endif
if(FAILED(hr))
{
hr = StringFromCLSID(pta->guid, &lpsz);
}
if(SUCCEEDED(hr))
{
wprintf(L"\nInterface: %s\n\n", lpsz);
CoTaskMemFree(lpsz);
}
int i = 0;
FUNCDESC *pfd = NULL;
for(i = 0; i < pta->cFuncs; i++)
{
typeinfo->GetFuncDesc(i, &pfd);
BSTR names[1];
unsigned int dumb;
typeinfo->GetNames(pfd->memid, names, 1, &dumb);
printf("%.3d: %-30s\tid=0x%d\t%d param(s)\n", i,
tUtil::bstr2string(names[0]), pfd->memid, pfd->cParams);
typeinfo->ReleaseFuncDesc(pfd);
SysFreeString(names[0]);
}
typeinfo->ReleaseTypeAttr(pta);
}
示例10: StringFromCLSID
static char *_php3_string_from_clsid(CLSID *clsid)
{
LPOLESTR s_clsid;
char *clsid_str;
StringFromCLSID(clsid, &s_clsid);
clsid_str = _php3_unicode_to_C_str(s_clsid, NULL);
LocalFree(s_clsid);
return clsid_str;
}
示例11: GetFsBoxCLSID
static std::wstring GetFsBoxCLSID()
{
LPOLESTR olestr_CLSID_FsBox = 0;
if (FAILED(StringFromCLSID(CLSID_FsBox, &olestr_CLSID_FsBox)))
{
return L"";
}
std::wstring result(olestr_CLSID_FsBox, olestr_CLSID_FsBox + wcslen(olestr_CLSID_FsBox));
CoTaskMemFree(olestr_CLSID_FsBox);
return result;
}
示例12: StringFromCLSID
static char *php_com_string_from_clsid(const CLSID *clsid, int codepage)
{
LPOLESTR ole_clsid;
char *clsid_str;
StringFromCLSID(clsid, &ole_clsid);
clsid_str = php_com_olestring_to_string(ole_clsid, NULL, codepage);
LocalFree(ole_clsid);
return clsid_str;
}
示例13: check_wave_format
static int
check_wave_format(Xcap_wasapi_param *wparam) {
WAVEFORMATEX *pwfx = wparam->pwfx;
WAVEFORMATEXTENSIBLE *ext = (WAVEFORMATEXTENSIBLE*) wparam->pwfx;
//
if(pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
if(ext->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT) {
wparam->isFloat = 1;
} else if(ext->SubFormat != KSDATAFORMAT_SUBTYPE_PCM) {
OLECHAR *guidstr;
char *in, *out, guid2[256];
StringFromCLSID(ext->SubFormat, &guidstr);
// because GUID is UTF-16LE?
for(in = (char*) guidstr, out = guid2; *in; in += 2) {
*out++ = *in;
}
*out = '\0';
//
ga_error("WAVEFORMATEXTENSIBLE: non-PCM is not supported (Format GUID=%s)\n", guid2);
CoTaskMemFree(guidstr);
return -1;
}
} else if(pwfx->wFormatTag != WAVE_FORMAT_PCM) {
ga_error("WAVEFORMATEX: non-PCM is not supported\n");
return -1;
}
if(pwfx->nChannels != 2) {
ga_error("WAVEFORMATEX: channels = %d (!=2)\n",
pwfx->nChannels);
return -1;
}
ga_error("WAVEFORMATEX: samplerate=%d, bitspersample=%d\n",
pwfx->nSamplesPerSec, pwfx->wBitsPerSample);
//
if(wparam->samplerate != pwfx->nSamplesPerSec) {
ga_error("WAVEFORMATEX: audio sample rate mismatch (%d != %d)\n",
wparam->samplerate,
pwfx->nSamplesPerSec);
return -1;
}
//
if(wparam->isFloat) {
if(wparam->bits_per_sample != 16) {
ga_error("WAVEFORMATEX: [float] audio bits per sample mismatch (%d != 16)\n",
wparam->bits_per_sample);
}
} else if(wparam->bits_per_sample != pwfx->wBitsPerSample) {
ga_error("WAVEFORMATEX: audio bits per sample mismatch (%d != %d)\n",
wparam->bits_per_sample,
pwfx->wBitsPerSample);
return -1;
}
return 0;
}
示例14: CLSIDToString
static void CLSIDToString( const CLSID& clsid, char* pszCLSID, int cb )
{
LPOLESTR pwszCLSID;
if (SUCCEEDED( StringFromCLSID( clsid, &pwszCLSID ) ))
{
// Covert from wide characters to non-wide.
wcstombs( pszCLSID, pwszCLSID, cb );
// Free memory.
CoTaskMemFree( pwszCLSID );
}
}
示例15: StringFromCLSID
void CAboutDlg::FillObjectVersion(CLSID clsid)
{
LPOLESTR szCLSID=NULL;
StringFromCLSID (clsid, &szCLSID);
CString strKey = _T("CLSID\\");
strKey += CString (szCLSID);
CoTaskMemFree (szCLSID);
CRegKey key;
long lResult = key.Open(HKEY_CLASSES_ROOT, strKey , KEY_READ );
if (lResult == ERROR_SUCCESS)
{
CEgRegKey keyModule;
long lResult = keyModule.Open( key, _T("LocalServer32"), KEY_READ );
if (lResult != ERROR_SUCCESS)
lResult = keyModule.Open( key, _T("InprocServer32"), KEY_READ );
if (lResult == ERROR_SUCCESS)
{
CString strVal;
//LPTSTR szVal = strVal.GetBuffer(MAX_PATH);
//DWORD dwSize = MAX_PATH;
keyModule.QueryValue (strVal, _T(""));
strVal.ReleaseBuffer();
if (!strVal.IsEmpty() )
{
CModuleVersion ver;
CString strVer = _T("N/A");
if (ver.GetFileVersionInfo (strVal))
ver.GetValue(_T("FileVersion"), strVer);
WIN32_FIND_DATA data;
HANDLE hFind = FindFirstFile (strVal, &data);
if( hFind != INVALID_HANDLE_VALUE )
{
FindClose(hFind);
CString strFmt;
strFmt.Format (_T("%s\t%s"), data.cFileName, (LPCTSTR) strVer);
AddInfoStr (strFmt);
}
}
}
key.Close();
}
}