请问MFC是在什么时候把应用程序名加到注册表中的?
在MFC的应用程序类中SetRegistryKey(_T("g_gw_Company_MyQQClient"))只是注册了一个"g_gw_Company_MyQQClient"子键啊?
该子键下面的应用程序名子键是什么时候建立的?
在MFC的应用程序类中SetRegistryKey(_T("g_gw_Company_MyQQClient"))只是注册了一个"g_gw_Company_MyQQClient"子键啊?
该子键下面的应用程序名子键是什么时候建立的?
// 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;
}
我知道你说的,可是在这只是注册了一个子键HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications。在该子键下还有一个以应用程序名为键名的键,不知道是什么时候建的
详细的可去看MFC代码.
我不知道要到哪去看
我的做法:
自己在该子键下建立项目:您的程序名;
在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);
在"g_gw_Company_MyQQClient"子键下已经有一个以应用程序名命名的子键了如我的程序名是MyQQClient,然后HKEY_CURRENT_USER\Software\g_gw_Company_MyQQClient\MyQQClient在我就是不知道这个\MyQQClient子键是什么时候建立的