Ejemplo n.º 1
0
bool delInfomationKeybyWinAPI()
{
	TCHAR cadKey[MAX_PATH];
	_tcscpy(cadKey, _T("Software\\Autodesk\\AutoCAD\\R18.0\\ACAD-8001:804\\InfoCenter"));

	DWORD dwAccess = KEY_ALL_ACCESS;
	//判断是否64位
	if(IsWow64() == TRUE)
	{
		dwAccess |= KEY_WOW64_64KEY;
	}

	CRegistry reg;
	bool ret = reg.Open( cadKey, HKEY_CURRENT_USER, dwAccess);
	if(ret)
	{
		ret = false;
		if(reg.Count()>0)
		{
			int n = reg.Count();
			for(int i=0;i<n;i++)
			{
				CRegEntry* entry = reg.GetAt(i);
				if(QString::compare(_T("InfoCenterOn"), entry->lpszName, Qt::CaseInsensitive) == 0)
				{
					*entry = 1;
					ret = true; break;
				}
			}
		}
	}
	reg.Close();

	return ret;
}
Ejemplo n.º 2
0
static CString GetCADPathByWinAPI( TCHAR* locationKey , pathType pat )
{
    CString cadPath;

    TCHAR cadKey[MAX_PATH];
    _tcscpy( cadKey, _T( "Software\\Autodesk\\AutoCAD\\R18.0\\ACAD-8001:804" ) );

    HKEY hRoot = ( CURRENT_USER == pat ) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
    CRegistry reg;

    DWORD dwAccess = KEY_ALL_ACCESS;
    //判断是否64位
    if( IsWow64() )
    {
        dwAccess |= KEY_WOW64_64KEY;
    }
    bool ret = reg.Open( cadKey, hRoot, dwAccess );
    if( ret )
    {
        ret = false;
        int n = reg.Count();
        for( int i = 0; i < n; i++ )
        {
            CRegEntry* entry = reg.GetAt( i );
            if( !_tcscmp( locationKey, entry->lpszName ) )
            {
                cadPath = ( CString ) * entry;
                ret = true;
                break;
            }
        }
        //SubKeyExists不好使!
        //std::string name = locationKey.toStdString();
        //ret = reg.SubKeyExists(name.c_str());
        //if(ret)
        //{
        //	cadPath = QString::fromStdString((std::string)reg[name.c_str()]);
        //}
    }
    reg.Close();

    return cadPath;
}
Ejemplo n.º 3
0
//data为0去掉搜索和登录框,为1时显示
static bool MotifiInfomationKey( int data )
{
    TCHAR cadKey[MAX_PATH];
    _tcscpy( cadKey, _T( "Software\\Autodesk\\AutoCAD\\R18.0\\ACAD-8001:804\\InfoCenter" ) );

    DWORD dwAccess = KEY_ALL_ACCESS;
    //判断是否64位
    if( IsWow64() )
    {
        dwAccess |= KEY_WOW64_64KEY;
    }

    CRegistry reg;
    bool ret = reg.Open( cadKey, HKEY_CURRENT_USER, dwAccess );
    if( ret )
    {
        ret = false;
        if( reg.Count() > 0 )
        {
            int n = reg.Count();
            for( int i = 0; i < n; i++ )
            {
                CRegEntry* entry = reg.GetAt( i );
                if( 0 == _tcscmp( _T( "InfoCenterOn" ), entry->lpszName ) )
                {
                    *entry = data;
                    ret = true;
                    break;
                }
            }
        }
    }
    reg.Close();

    return ret;
}