急----在不使用mfc的dll中,如何读写注册表? 我想写入几个键值为整数的键,怎么写呢?谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SetRegistryKey(_T("AAA"));LoadStdProfileSettings(4); /Load in the values from the registry CWinApp* pApp = AfxGetApp(); CString sSection(_T("Settings")); m_nPort = pApp->GetProfileInt(sSection, _T("Port"), 25); m_sAddress = pApp->GetProfileString(sSection, _T("Address")); m_sHost = pApp->GetProfileString(sSection, _T("Host")); m_sName = pApp->GetProfileString(sSection, _T("Name")); m_Authenticate = (CSMTPConnection::LoginMethod) pApp->GetProfileInt(sSection, _T("Authenticate"), CSMTPConnection::NoLoginMethod); m_sUsername = pApp->GetProfileString(sSection, _T("Username")); m_sPassword = pApp->GetProfileString(sSection, _T("Password")); m_sEncodingFriendly = pApp->GetProfileString(sSection, _T("EncodingFriendly"), _T("Western European (ISO)")); m_sEncodingCharset = pApp->GetProfileString(sSection, _T("EncodingCharset"), _T("iso-8859-1")); m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); CWinApp* pApp = AfxGetApp(); CString sSection(_T("Settings")); pApp->WriteProfileInt(sSection, _T("Port"), m_nPort); pApp->WriteProfileString(sSection, _T("Address"), m_sAddress); pApp->WriteProfileString(sSection, _T("Host"), m_sHost); pApp->WriteProfileString(sSection, _T("Name"), m_sName); pApp->WriteProfileInt(sSection, _T("Authenticate"), m_Authenticate); pApp->WriteProfileString(sSection, _T("Username"), m_sUsername); pApp->WriteProfileString(sSection, _T("Password"), m_sPassword); pApp->WriteProfileString(sSection, _T("EncodingFriendly"), m_sEncodingFriendly); pApp->WriteProfileString(sSection, _T("EncodingCharset"), m_sEncodingCharset); 我的dll中没App类呀。哪位给个用RegOpenKeyRegCreateKeyRegSetValueRegCloseKey操作的例子,只在初始化时读出一个键值,在结束时保存这个键值即可,谢谢! RegOpenKeyRegCreateKeyExRegSetValueExRegCloseKey DWORD dwBufLen; LONG lRet=RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\RightFax\\Install", 0, KEY_QUERY_VALUE, &hKey ); if( lRet != ERROR_SUCCESS ){ AfxMessageBox("Both the current directory and registry cannot find the faxrpt2.exe"); exit(0); } RegQueryValueEx( hKey, "InstallDir", NULL, NULL, (LPBYTE) szProductType, &dwBufLen); RegCloseKey( hKey ); 怎样在CFormView中添加按钮等控件? 请问一下,像网易泡泡的好友列表。 请教关于ReadProcessMemory()函数的问题!!! 怎样实现让编辑框(CEdit)具有记忆呢? 求《Windows核心编程》的源代码!Email:[email protected] 请帮我想一个好的公司的名字,500分重奖等你拿!!!!!! 显卡的问题 C++问题,请帮帮我吧! windows多线程编程问题 求教关于VARIANT_BOOL的问题 VC++6编译器的一个bug? 请问怎样可能判断CEdit的某一行是否为空行即只有空格或连空格也没有的行
LoadStdProfileSettings(4);
CWinApp* pApp = AfxGetApp();
CString sSection(_T("Settings"));
m_nPort = pApp->GetProfileInt(sSection, _T("Port"), 25);
m_sAddress = pApp->GetProfileString(sSection, _T("Address"));
m_sHost = pApp->GetProfileString(sSection, _T("Host"));
m_sName = pApp->GetProfileString(sSection, _T("Name"));
m_Authenticate = (CSMTPConnection::LoginMethod) pApp->GetProfileInt(sSection, _T("Authenticate"), CSMTPConnection::NoLoginMethod);
m_sUsername = pApp->GetProfileString(sSection, _T("Username"));
m_sPassword = pApp->GetProfileString(sSection, _T("Password"));
m_sEncodingFriendly = pApp->GetProfileString(sSection, _T("EncodingFriendly"), _T("Western European (ISO)"));
m_sEncodingCharset = pApp->GetProfileString(sSection, _T("EncodingCharset"), _T("iso-8859-1"));
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
CString sSection(_T("Settings"));
pApp->WriteProfileInt(sSection, _T("Port"), m_nPort);
pApp->WriteProfileString(sSection, _T("Address"), m_sAddress);
pApp->WriteProfileString(sSection, _T("Host"), m_sHost);
pApp->WriteProfileString(sSection, _T("Name"), m_sName);
pApp->WriteProfileInt(sSection, _T("Authenticate"), m_Authenticate);
pApp->WriteProfileString(sSection, _T("Username"), m_sUsername);
pApp->WriteProfileString(sSection, _T("Password"), m_sPassword);
pApp->WriteProfileString(sSection, _T("EncodingFriendly"), m_sEncodingFriendly);
pApp->WriteProfileString(sSection, _T("EncodingCharset"), m_sEncodingCharset);
RegOpenKey
RegCreateKey
RegSetValue
RegCloseKey
操作的例子,只在初始化时读出一个键值,在结束时保存这个键值即可,谢谢!
RegCreateKeyEx
RegSetValueEx
RegCloseKey
LONG lRet=RegOpenKeyEx( HKEY_LOCAL_MACHINE,
"Software\\RightFax\\Install",
0, KEY_QUERY_VALUE, &hKey );
if( lRet != ERROR_SUCCESS ){
AfxMessageBox("Both the current directory and registry cannot find the faxrpt2.exe");
exit(0);
}
RegQueryValueEx( hKey, "InstallDir", NULL, NULL,
(LPBYTE) szProductType, &dwBufLen);
RegCloseKey( hKey );