请问MFC是在什么时候把应用程序名加到注册表中的?
在MFC的应用程序类中SetRegistryKey(_T("g_gw_Company_MyQQClient"))只是注册了一个"g_gw_Company_MyQQClient"子键啊?
该子键下面的应用程序名子键是什么时候建立的?

解决方案 »

  1.   

    在应用程序文件里面InitInstance()里面:如下:
    // MyApp.cpp : Defines the class behaviors for the application.
    //#include "stdafx.h"
    #include "MyApp.h"#include "MainFrm.h"
    #include "MyAppDoc.h"
    #include "MyAppView.h"
    ......略
    /////////////////////////////////////////////////////////////////////////////
    // CMyAppApp initializationBOOL CMyAppApp::InitInstance()//就在这个里面.....
    {
    // Change the registry key under which our settings are stored.
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization.
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));//就是这儿        return TRUE;
    }
      

  2.   

    TrueIAm(阿 成) 
    我知道你说的,可是在这只是注册了一个子键HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications。在该子键下还有一个以应用程序名为键名的键,不知道是什么时候建的
      

  3.   

    http://www.vctop.com/View.Asp?ID=295&CateID=1
      

  4.   

    是在LoadStdProfileSettings()中调用GetProfileString()时生成的.
    详细的可去看MFC代码.
      

  5.   

    njypch(七世倾情) 能说详细点吗?
    我不知道要到哪去看
      

  6.   

    LoadStdProfileSettings()的执行代码在什么地方?
      

  7.   

    如您所说,在MFC的应用程序类中SetRegistryKey(_T("g_gw_Company_MyQQClient"))只是注册了一个"g_gw_Company_MyQQClient"子键!
    我的做法:
    自己在该子键下建立项目:您的程序名;
    在Initinstance()中读取;DWORD size=MAX_PATH;
    char Buffer[MAX_PATH];
    CString Value = _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\SG2 your program");

    CRegKey key;
    key.Open(HKEY_LOCAL_MACHINE, Value, KEY_QUERY_VALUE);
    key.QueryValue(Buffer, _T("Path"), &size);
    key.Close();
    m_strAppPath = CString(Buffer);

    SetCurrentDirectory((LPCTSTR)m_strAppPath);
      

  8.   

    楼上兄弟
    在"g_gw_Company_MyQQClient"子键下已经有一个以应用程序名命名的子键了如我的程序名是MyQQClient,然后HKEY_CURRENT_USER\Software\g_gw_Company_MyQQClient\MyQQClient在我就是不知道这个\MyQQClient子键是什么时候建立的