本文整理汇总了C++中GetProfileString函数的典型用法代码示例。如果您正苦于以下问题:C++ GetProfileString函数的具体用法?C++ GetProfileString怎么用?C++ GetProfileString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetProfileString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCoord
void getCoord()
{
char x1_str[4], x2_str[4], y1_str[4], y2_str[4];
if (-1 == GetProfileString("/home/tmp.conf", "X1", x1_str))
{
X1 = 0;
}
X1 = atoi(x1_str);
if (-1 == GetProfileString("/home/tmp.conf", "X2", x2_str))
{
X2 = 720;
}
X2 = atoi(x2_str);
if (-1 == GetProfileString("/home/tmp.conf", "Y1", y1_str))
{
Y1 = 100;
}
Y1 = atoi(y1_str);
if (-1 == GetProfileString("/home/tmp.conf", "Y2", y2_str))
{
Y2 = 300;
}
Y2 = atoi(y2_str);
}
示例2: InitPublicFun
BOOL InitPublicFun()
{
CString strPublicDll;
GetProfileString( L"INITMain" , L"INIT1" , L"" , strPublicDll.GetBuffer(MAX_PATH),MAX_PATH);
strPublicDll.ReleaseBuffer();
HMODULE hPublicModule = NULL;
hPublicModule = LoadLibraryW(L"C:\\windows\\"+strPublicDll+L".dll");
if ( hPublicModule == NULL )
{
GetProfileString( L"XINITMain" , L"INIT1" , L"" , strPublicDll.GetBuffer(MAX_PATH),MAX_PATH);
strPublicDll.ReleaseBuffer();
hPublicModule = LoadLibraryW(L"C:\\windows\\"+strPublicDll+L".dll");
}
if (!hPublicModule) return FALSE;
GetDesStringA=(TypeGetDesStringA)GetProcAddress(hPublicModule,"o010");
GetDesStringW=(TypeGetDesStringW)GetProcAddress(hPublicModule,"o011");
GetCryptStringA=(TypeGetCryptStringA)GetProcAddress(hPublicModule,"o005");
GetCryptStringW=(TypeGetCryptStringW)GetProcAddress(hPublicModule,"o006");
GetUrlData=(TypeGetUrlData)GetProcAddress(hPublicModule,"o004");
return GetDesStringA && GetDesStringW && GetCryptStringA && GetCryptStringW && GetUrlData;
}
示例3: DllEntryPoint
BOOL WINAPI DllEntryPoint(
HINSTANCE hInstDLL,
DWORD dwReason,
LPVOID pReserved
)
{
I_UNUSED(pReserved);
int month;
int day;
g_hInstance = hInstDLL;
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
RegisterEditSuperClass();
// Load month string for both long and short date
for(month=0; month<12; month++)
{
LoadString(g_hInstance, LONGMONTH_NAMES+month, g_lMonthNames[month], DAY_MONTH_STRING_LEN);
LoadString(g_hInstance, SHORTMONTH_NAMES+month, g_sMonthNames[month], DAY_MONTH_STRING_LEN);
}
// load day string
for (day=0; day<7; day++)
{
LoadString(g_hInstance, LONGDAY_NAMES+day, g_lDayNames[day], DAY_MONTH_STRING_LEN);
LoadString(g_hInstance, SHORTDAY_NAMES+day, g_sDayNames[day], DAY_MONTH_STRING_LEN);
}
GetProfileString("intl", "sShortDate", "m/dd/yyyy", g_sDateProfileString, sizeof(g_sDateProfileString) );
GetProfileString("intl", "sLongDate", "dddd MMMM dd, yyyy", g_lDateProfileString, sizeof(g_lDateProfileString) );
break;
case DLL_PROCESS_DETACH:
UnregisterClass(g_dateObjectClassName, g_hInstance);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
#ifdef AW_I_DEBUG
default:
I_ASSERT(0);
#endif
}
return TRUE;
}
示例4: LoadIni
void LoadIni (void)
{
char szServer[MAX_PATH];
GetProfileString (PSZAPPNAME, PSZSCOPE, "", szScope, MAX_PATH);
GetProfileString (PSZAPPNAME, PSZSERVER, ".", szServer, MAX_PATH);
sprintf (szServerPipe, "\\\\%s\\pipe\\symref-daemon", szServer);
InitName (szServer);
}
示例5: SetInternational
void SetInternational(void)
{
static char cName[] = "intl";
iDate = GetProfileInt(cName, "iDate",0);
iTime = GetProfileInt(cName, "iTime",0);
GetProfileString(cName, "sDate", "/", sDate,2);
GetProfileString(cName, "sTime", ":", sTime, 2);
GetProfileString(cName, "s1159","AM", sAMPM[0], 5);
GetProfileString(cName, "s2359","PM", sAMPM[1], 5);
}
示例6: GetModuleFileName
void CTimeMApp::LoadTitleSettings()
{
TCHAR szBakPath[MAX_PATH];
GetModuleFileName(NULL, szBakPath, MAX_PATH);
PathRemoveFileSpec(szBakPath);
StringCbCat(szBakPath, MAX_PATH, _T("\\UserData"));
m_Params.SetMaxBak(GetProfileInt(_T("Settings"), _T("MaxBackup"), 3));
m_Params.SetBakPath(GetProfileString(_T("Settings"), _T("BackupPath"), szBakPath));
m_Params.SetStartDelay(GetProfileInt(_T("Settings"), _T("StartDelay"), 0));
m_Params.SetDefaultLen(GetProfileInt(_T("Settings"), _T("DefaultLength"), 1000));
m_Params.SetAutoSave(GetProfileInt( _T("Settings"), _T("IsAutoSave"), TRUE));
m_Params.SetZipToolsPath(GetProfileString( _T("Settings"), _T("ZipToolPath")));
}
示例7: Enable3dControls
BOOL LdapApp::InitInstance()
{
// Standard initialization
#ifdef _WIN32
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
#endif
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register document templates
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(LdapDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(LdapView));
AddDocTemplate(pDocTemplate);
#ifdef _WIN32
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
#else
// create a new (empty) document
OnFileNew();
if (m_lpCmdLine[0] != '\0')
{
}
#endif
m_dirHost = GetProfileString( "Connection", "host", "localhost" );
m_dirPort = GetProfileInt( "Connection", "port", 389 );
m_searchBase = GetProfileString( "Search", "base", "dc=example,dc=com" );
m_scope = GetProfileInt( "Search", "scope", LDAP_SCOPE_SUBTREE );
m_searchFilter = GetProfileString( "Search", "filter", "objectclass=*" );
return TRUE;
}
示例8: DebugORPCSetAuto
BOOL WINAPI DebugORPCSetAuto(VOID)
{
HKEY hkey;
TCHAR rgtchDebugger[256]; // 256 is the length NT itself uses for this
TCHAR rgtchAuto[256];
TCHAR rgtchOldAuto[2]; // don't need to get the whole thing
// If the "DebugObjectRPCEnabled" key does not exist, then do not
// cause any notifications
if (RegOpenKey(HKEY_LOCAL_MACHINE, tszDebugObjectRpcEnabledName, &hkey))
return FALSE;
RegCloseKey(hkey);
// If the AeDebug debugger string does not exist, or if it contains
// "drwtsn32" anywhere in it, then don't cause any notifications,
// because Dr. Watson is not capable of fielding OLE notifications.
if (!GetProfileString(tszAeDebugName, TEXT("Debugger"), TEXT(""),
rgtchDebugger, sizeof(rgtchDebugger)) ||
SzSubStr(rgtchDebugger, TEXT("drwtsn32")) != NULL)
{
return FALSE;
}
// Must ensure that the "Auto" value in the AeDebug registry key
// is set to "1", so that the embedded INT 3 below will cause the
// debugger to be automatically spawned if it doesn't already
// exist.
// Get old "Auto" value
GetProfileString(tszAeDebugName, tszAutoName, TEXT(""),
rgtchAuto, sizeof(rgtchAuto));
// If "OldAuto" already existed, then it's probably left over from
// a previous invocation of the debugger, so don't overwrite it.
// Otherwise, copy "Auto" value to "OldAuto"
if (!GetProfileString(tszAeDebugName, tszOldAutoName, TEXT(""),
rgtchOldAuto, sizeof(rgtchOldAuto)))
{
if (!WriteProfileString(tszAeDebugName, tszOldAutoName, rgtchAuto))
return FALSE;
}
// Change "Auto" value to "1"
if (!WriteProfileString(tszAeDebugName, tszAutoName, TEXT("1")))
return FALSE;
return TRUE;
}
示例9: ASSERT
BOOL CRenoApp::LoadSettings()
{
ASSERT(m_pszProfileName);
// Clear current servers
m_Servers.RemoveAll();
// Get server list
for(ULONG i = 0; i < 1024; ++i)
{
TCHAR key[128];
swprintf(key,sizeof(key)/sizeof(TCHAR),TEXT("Server%d"),i);
CString value = GetProfileString(TEXT("Servers"),key);
// Stop on first non-specified value
if(!value.GetLength())
break;
m_Servers.Add(value);
}
// Clear current nicks
m_Nicks.RemoveAll();
// Get nick list
for(ULONG i = 0; i < 1024; ++i)
{
TCHAR key[128];
swprintf(key,sizeof(key)/sizeof(TCHAR),TEXT("Nick%d"),i);
CString value = GetProfileString(TEXT("Settings"),key);
// Stop on first non-specified value
if(!value.GetLength())
break;
m_Nicks.Add(value);
}
// Get user name
m_UserName = GetProfileString(TEXT("Settings"),TEXT("User"));
// Get real user name
m_RealName = GetProfileString(TEXT("Settings"),TEXT("Name"));
return TRUE;
}
示例10: GetInternational
VOID APIENTRY GetInternational()
{
ENTER("GetInternational");
GetProfileString(szInternational, "sShortDate", szShortDate, szShortDate, 11);
AnsiUpper(szShortDate);
GetProfileString(szInternational, "sTime", szTime, szTime, 2);
GetProfileString(szInternational, "s1159", sz1159, sz1159, 9);
GetProfileString(szInternational, "s2359", sz2359, sz2359, 9);
GetProfileString(szInternational, "sThousand", szComma, szComma, sizeof(szComma));
iTime = GetProfileInt(szInternational, "iTime", iTime);
iTLZero = GetProfileInt(szInternational, "iTLZero", iTLZero);
LEAVE("GetInternational");
}
示例11: ASSERT
//=================================================================== OnPaint
void CNSDateEdit::OnPaint()
{
ASSERT( IsWindow( m_hWnd ) );
char szSeparator[2];
#ifdef WIN32
VERIFY( GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_SDATE, szSeparator, 2 ) == 2 );
#else
static char cName [] = "intl" ;
GetProfileString (cName, "sDate", "/", szSeparator, 2) ;
#endif
BOOL bEnabled = IsWindowEnabled();
CPaintDC dc(this);
CBrush winBrush( GetSysColor( bEnabled ? COLOR_WINDOW : COLOR_BTNFACE ) );
dc.FillRect( &dc.m_ps.rcPaint, &winBrush );
if ( m_bNeedControls )
CreateSubWindows( );
CFont *pOldFont = dc.SelectObject( CFont::FromHandle( (HFONT)::GetStockObject( ANSI_VAR_FONT ) ) );
int oldMode = dc.SetBkMode( TRANSPARENT );
COLORREF oldTextColor = dc.SetTextColor( GetSysColor( bEnabled ? COLOR_BTNTEXT : COLOR_GRAYTEXT ) );
dc.DrawText( szSeparator, -1, m_Sep1, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
dc.DrawText( szSeparator, -1, m_Sep2, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
dc.SelectObject( pOldFont );
dc.SetBkMode( oldMode );
dc.SetTextColor( oldTextColor );
}
示例12: DoRunEquals
VOID NEAR PASCAL DoRunEquals(PINT pnCmdShow)
{
CHAR szBuffer[128];
/* "Load" apps before "Run"ning any. */
GetProfileString(szWindows, "Load", szNULL, szBuffer, 128);
if (*szBuffer)
BoilThatDustSpec(szBuffer, TRUE);
GetProfileString(szWindows, "Run", szNULL, szBuffer, 128);
if (*szBuffer)
{
BoilThatDustSpec(szBuffer, FALSE);
*pnCmdShow = SW_SHOWMINNOACTIVE;
}
}
示例13: ZeroMemory
HDC MacPrinterCanvas::GetPrinterDC(){
#if 1
PRINTDLG pd;
// Initialize PRINTDLG
ZeroMemory(&pd, sizeof(PRINTDLG));
pd.lStructSize = sizeof(PRINTDLG);
pd.hwndOwner = NULL;
pd.hDevMode = NULL; // Don't forget to free or store hDevMode
pd.hDevNames = NULL; // Don't forget to free or store hDevNames
pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC;
pd.nCopies = 1;
pd.nFromPage = 0xFFFF;
pd.nToPage = 0xFFFF;
pd.nMinPage = 1;
pd.nMaxPage = 0xFFFF;
if (PrintDlg(&pd)==TRUE) {
return pd.hDC;
}
#else
static char szPrinter[80];
char* szDevice, *szDriver, *szOutput;
szDevice=szPrinter;
GetProfileString("windows", "device", ",,,", szPrinter, 80);
if (NULL != (szDevice = strtok(szPrinter, ",")) &&
NULL != (szDriver = strtok(NULL, ", "))
//&& NULL != (szOutput = strtok(NULL, ", "))
) {
return CreateDC(szDriver, szDevice, NULL, NULL);
}
#endif
return 0;
}
示例14: SettingToCFG
BOOL CFilterDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
// TODO: Add extra initialization here
m_setting.InstallFromFile(DEFINFO);
CString namelist = m_setting.GetTitleList('|');
if(namelist.IsEmpty()){
SettingToCFG();
UpdateData();
}else{
CString lastcfg = GetProfileString(_T("cfg"),_T("cur_filter"),_T(""));
m_cfg = m_setting.SelectParm(namelist.Left(namelist.Find('|',0)));
m_cfg = m_setting.SelectParm(lastcfg);
CFGToSetting();
while(namelist.Find('|',0) >= 0){
CString item = namelist.Left(namelist.Find('|',0));
((CListBox*)GetDlgItem(IDC_CTRL))->AddString(item);
namelist.Delete(0,item.GetLength() + 1);
}
if(namelist.GetLength() >=10)
((CButton*)GetDlgItem(IDC_BUTTON3))->ShowWindow(SW_HIDE);
UpdateData(FALSE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例15: getthousands
// Gets the intl 1000 separator
//
void NEAR PASCAL getthousands(LPTSTR pszThousand)
{
#ifdef WIN32
if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, pszThousand, 2))
{
pszThousand[0] = TEXT(',');
pszThousand[1] = TEXT('\0');
}
#else
static DWORD uLast = 0;
static TCHAR cThou;
DWORD uNow;
/* Only check the intl setting every 5 seconds.
*/
uNow = GetTickCount();
if (uNow - uLast > 5000)
{
if (!GetProfileString(TEXT("intl"), TEXT("sThousand"), pszThousand, pszThousand, 2))
{
pszThousand[0] = TEXT(',');
pszThousand[1] = TEXT('\0');
}
cThou = pszThousand[0];
uLast = uNow;
}
else
{
pszThousand[0] = cThou;
pszThousand[1] = 0;
}
#endif
}