コード例 #1
0
ファイル: b.c プロジェクト: thatking/hi3516c
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
0
ファイル: PublicFun.cpp プロジェクト: gaozan198912/myproject
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
0
ファイル: DT_MAIN.CPP プロジェクト: benbucksch/AppWare
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
0
void SetDefaultPrinter( LPSTR lpDevice )
/***********************************************************************/
{ // The currently selected device will have the form "NAME,DRIVER,PORT"
LPSTR lpDriver, lpPort, lpName, lpNext;
LPSTR lpActiveDriver, lpActivePort, lpActiveName;
STRING szDevice, szString, Buffer;
char KeyBuffer[KEY_LENGTH];

if ( !lpDevice || !*lpDevice )
	return;

lstrcpy( szDevice, lpDevice ); // Copy the device string so we won't destroy it
lpDevice = szDevice;

WriteProfileString( "windows", "device", lpDevice );
SendMessage( (HWND)0xFFFF, WM_WININICHANGE, 0, (long)(LPSTR)"windows" );

lpActiveName = lpDevice;
if ( !(lpActiveDriver = GetNextParm( lpActiveName )) )
	return;
*lpActiveDriver++ = '\0';
if ( !(lpActivePort = GetNextParm( lpActiveDriver )) )
	return;
*lpActivePort++ = '\0';

GetProfileString( PRINTERS, NULL, "\0\0", KeyBuffer, KEY_LENGTH );
lpName = KeyBuffer;
while ( *lpName )
	{
	GetProfileString( PRINTERS, lpName, "\0", Buffer, MAX_STR_LEN );
	// Format of the buffer is DRIVER,PORT,15,45,PORT,15,45,PORT,15,45 etc.
	lpDriver = Buffer;
	if ( lpNext = GetNextParm( lpDriver ) )
		*lpNext++ = '\0';
	lstrcpy( szString, lpDriver );
	while ( lpPort = lpNext )
		{
		if ( lpNext = GetNextParm( lpPort ) )
			*lpNext++ = '\0';
		lstrcat( szString, "," );
		if ( !lstrcmp( lpPort, lpActivePort ) &&
		     ( lstrcmp( lpName, lpActiveName ) ||
		       lstrcmp( lpDriver, lpActiveDriver ) ) )
			lstrcat( szString, NullPort );
		else	lstrcat( szString, lpPort );
		if ( lpNext = GetNextParm( lpNext ) ) // skip the 15
			lpNext++;
		if ( lpNext = GetNextParm( lpNext ) ) // skip the 45
			lpNext++;
		}
	WriteProfileString( "devices", lpName, szString );
	lpName += (lstrlen(lpName) + 1);
	}

SendMessage( (HWND)0xFFFF, WM_WININICHANGE, 0, (long)(LPSTR)"devices" );
}
コード例 #5
0
ファイル: symref.c プロジェクト: mingpen/OpenNT
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);
}
コード例 #6
0
ファイル: DIGCLOCK.CPP プロジェクト: amitahire/development
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);
   }   
コード例 #7
0
ファイル: TimeM.cpp プロジェクト: BennyThink/TimeM
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")));
}
コード例 #8
0
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;
}
コード例 #9
0
ファイル: orpc_dbg.c プロジェクト: mingpen/OpenNT
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;
}
コード例 #10
0
ファイル: Reno.cpp プロジェクト: m1h4/Reno
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;
}
コード例 #11
0
ファイル: wfinit.c プロジェクト: mingpen/OpenNT
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");
}
コード例 #12
0
//=================================================================== 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 );
}
コード例 #13
0
ファイル: wfinit.c プロジェクト: mingpen/OpenNT
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;
    }
}
コード例 #14
0
ファイル: mprinter.cpp プロジェクト: neurodebian/iv-hines
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;
}
コード例 #15
0
ファイル: FilterDialog.cpp プロジェクト: Biotron/kpgweigher
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
}
コード例 #16
0
ファイル: updown.c プロジェクト: mingpen/OpenNT
// 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
}
コード例 #17
0
ファイル: utils.cpp プロジェクト: 252525fb/rpcs3
// Get hostname only (without domain name)
bool wxGetHostName(wxChar *WXUNUSED_IN_WINCE(buf),
                   int WXUNUSED_IN_WINCE(maxSize))
{
#if defined(__WXWINCE__)
    // TODO-CE
    return false;
#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
    DWORD nSize = maxSize;
    if ( !::GetComputerName(buf, &nSize) )
    {
        wxLogLastError(wxT("GetComputerName"));

        return false;
    }

    return true;
#else
    wxChar *sysname;
    const wxChar *default_host = wxT("noname");

    if ((sysname = wxGetenv(wxT("SYSTEM_NAME"))) == NULL) {
        GetProfileString(WX_SECTION, eHOSTNAME, default_host, buf, maxSize - 1);
    } else
        wxStrncpy(buf, sysname, maxSize - 1);
    buf[maxSize] = wxT('\0');
    return *buf ? true : false;
#endif
}
コード例 #18
0
ファイル: win32_print.c プロジェクト: Daksh/sltuxpaint
/* returns 0 if failed */
static int GetDefaultPrinterStrings(char *device, char *driver, char *output)
{
  const char *section = "windows";
  const char *key = "device";
  const char *def = "NODEFAULTPRINTER";
  char buff[MAX_PATH];
  char *dev, *drv, *out;

  if (!GetProfileString(section, key, def, buff, sizeof(buff)))
    return 0;

  if (strcmp(buff, def) == 0)
    return 0;

  if (((dev = strtok(buff, ",")) != NULL) &&
      ((drv = strtok(NULL, ", ")) != NULL) &&
      ((out = strtok(NULL, ", ")) != NULL))
  {
    if (device)
      strcpy(device, dev);
    if (driver)
      strcpy(driver, drv);
    if (output)
      strcpy(output, out);
    return 1;
  }
  return 0;
}
コード例 #19
0
ファイル: wrlang.c プロジェクト: ABratovic/open-watcom-v2
static res_language_enumeration check_code_page( void )
/*****************************************************/
{
    unsigned int        codepage = 0;
#if defined __OS2__
    OS_UINT             cp;
    OS_UINT             bytesOutput;
#elif defined __WINDOWS__
    char                lang[4];
#endif

    /*** Determine the system default code page ***/
    #if defined __NT__
        codepage = GetOEMCP();
    #elif defined __OS2__
        DosGetCp( 2, &cp, &bytesOutput );
        codepage = cp;
    #elif defined __OSI__
        codepage = 437;         // Maybe we could try harder...
    #elif defined __DOS__
        codepage = dos_get_code_page();
    #elif defined __WINDOWS__
        if( GetProfileString( "Intl", "sLanguage", "ENU", lang, 4 ) ) {
            if( !stricmp( lang, "JPN" ) )  codepage = 932;
        }
    #endif

    /*** Try to match the returned code page to known ones ***/
    switch( codepage ) {
        case 932:   return( RLE_JAPANESE );
        default:    return( RLE_ENGLISH );
    }
}
コード例 #20
0
BOOL ExportImage( HWND hWnd, ITEMID idItem, ITEMID idIniSection )
{
	HINSTANCE hInstance;
	STRING szAppName, szIniSection;
	STRING szExportName;
	BOOL bSuccess = FALSE;

	// Get the name of export filter
	if ( !(GetMenuString( GetMenu(hWnd), idItem, szAppName, sizeof(szAppName),
   	MF_BYCOMMAND )) ) {
		return( FALSE );
	}

	// Get the name of the INI section to read
	hInstance = GetWindowInstance( hWnd );
	if ( !AstralStrEx( idIniSection, szIniSection, sizeof(szIniSection) )) {
		return( FALSE );
	}

	// Get the module file name for the application
	// Put it in a staic string so the callback has access to it
	if ( !(GetProfileString( szIniSection, szAppName, "", szExportName,
		sizeof(szExportName) )) ) {
		return( FALSE );
	}

	bSuccess = ExportImageDLL( (LPSTR)szExportName );

	return( bSuccess );
}
コード例 #21
0
ファイル: b.c プロジェクト: thatking/hi3516c
void getLRPoi()
{
	char LPoi_str[10], RPoi_str[10];

	if (-1 == GetProfileString("/home/tmp.conf", "leftpoi", LPoi_str))
	{
		LPoi = 0;
	}
	LPoi = atoi(LPoi_str);

	if (-1 == GetProfileString("/home/tmp.conf", "rightpoi", RPoi_str))
	{
		RPoi = 0;
	}
	RPoi = atoi(RPoi_str);

}
コード例 #22
0
ファイル: Registry.cpp プロジェクト: identity0815/os45
void CRegistry::LoadTransferParam(TransferParam &tp, CString pszKey) {
    CCrypto crypt;
    if (Open(pszKey) == ERROR_SUCCESS) {
        tp.iService      = GetProfileInt(_T("Service"), UPLOAD_FTP);   
        tp.csServer      = GetProfileString(_T("Server"), _T(""));
        tp.nPort         = GetProfileInt(_T("Port"), DEFAULT_FTP_PORT);   
        tp.csUsername    = GetProfileString(_T("Username"), _T(""));
        tp.bSavePassword = GetProfileInt(_T("SavePassword"), TRUE);   
        if (tp.bSavePassword) {
            CString csPassword = GetProfileString(_T("Password"), _T(""));
            tp.csPassword = crypt.Decode(csPassword);
        }
        tp.csDirectory   = GetProfileString(_T("Directory"), _T("/"));

        Close();
    }
}
コード例 #23
0
ファイル: RTFReaderTHD.cpp プロジェクト: killbug2004/WSProf
BOOL CRTFReaderTHDApp::InitInstance()
{
	CRTFReaderTHDDlg dlg;
		
	m_pMainWnd = &dlg;
	
	CReaderCommandLineInfo info;
	ParseCommandLine(info);
	
	if(!info.m_Param1.IsEmpty())
		dlg.m_csFile1 = info.m_Param1;

	else
		dlg.m_csFile1 = GetProfileString(_T("Input"), _T("File1"));


	dlg.m_csFile2 = GetProfileString(_T("Input"), _T("File2"));		

	dlg.DoModal();


	WriteProfileString(_T("Input"), _T("File1"), dlg.m_csFile1);
	WriteProfileString(_T("Input"), _T("File2"), dlg.m_csFile2);	

	clock_t StartTime = clock();

	CString cs1, cs2;

	cs1 = dlg.m_csFile1;
	cs2 = dlg.m_csFile2;

	
	DWORD dwFlags  = 0;

	clock_t EndTime = clock();

	//csFile.ShellOpen(0, SW_SHOW);

	clock_t ExecutionTime = EndTime - StartTime;

	double d = ExecutionTime;

	d /= CLOCKS_PER_SEC;

	return false;
}
コード例 #24
0
ファイル: RegProfile.cpp プロジェクト: eseawind/SuperCxHMI
BOOL CRegProfile::GetProfileBinary(LPCTSTR lpszSection, LPCTSTR lpszEntry,
                                   BYTE** ppData, UINT* pBytes)
{
    ASSERTATLMFC(lpszSection != NULL);
    ASSERTATLMFC(lpszEntry != NULL);
    ASSERTATLMFC(ppData != NULL);
    ASSERTATLMFC(pBytes != NULL);
    *ppData = NULL;
    *pBytes = 0;
    if (m_pszRegistryKey != NULL)
    {
        HKEY hSecKey = GetSectionKey(lpszSection);
        if (hSecKey == NULL)
            return FALSE;

        DWORD dwType, dwCount;
        LONG lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,
                                       NULL, &dwCount);
        *pBytes = dwCount;
        if (lResult == ERROR_SUCCESS)
        {
            ASSERTATLMFC(dwType == REG_BINARY);
            *ppData = new BYTE[*pBytes];
            lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,
                                      *ppData, &dwCount);
        }
        RegCloseKey(hSecKey);
        if (lResult == ERROR_SUCCESS)
        {
            ASSERTATLMFC(dwType == REG_BINARY);
            return TRUE;
        }
        else
        {
            delete [] *ppData;
            *ppData = NULL;
        }
        return FALSE;
    }
    else
    {
        ASSERTATLMFC(m_pszProfileName != NULL);

        CString str = GetProfileString(lpszSection, lpszEntry, NULL);
        if (str.IsEmpty())
            return FALSE;
        ASSERTATLMFC(str.GetLength()%2 == 0);
        int nLen = str.GetLength();
        *pBytes = nLen/2;
        *ppData = new BYTE[*pBytes];
        for (int i=0; i<nLen; i+=2)
        {
            (*ppData)[i/2] = (BYTE)
                             (((str[i+1] - 'A') << 4) + (str[i] - 'A'));
        }
        return TRUE;
    }
}
コード例 #25
0
ファイル: SysInfoUtil.cpp プロジェクト: jongha/sysinfo
CString GetPrinterInfo()
{
	char buffer[1025] = "";
	GetProfileString("windows", "device", NULL, buffer, 1024);

	CString defaultPrinter = buffer, port = buffer;
	int position = defaultPrinter.Find(',');
	defaultPrinter = defaultPrinter.Left(position); 
	position = port.Find(',', position + 1);
	port = port.Right(port.GetLength() - position - 1);

	if(defaultPrinter.GetLength() == 0) {
		defaultPrinter = "Not Dectedted";
	}
	
	return "\nPrinter:\n" + defaultPrinter + "\n";
	
/*	CString printerInfo = defaultPrinter + " on " + port;

	// get default printer handle
	HANDLE hPrinter = NULL;
	BOOL result = OpenPrinter(
		(LPSTR)defaultPrinter.operator const char*(),
		&hPrinter,  // pointer to printer handle
		NULL);

	if(result == 0){
		ClosePrinter(hPrinter);
		return "";
	}

	// get default printer's driver information
	DWORD returnedByte;
	buffer[0] = '\0';
	result = GetPrinterDriver(
		hPrinter,     // printer object
		NULL, // address of environment
		6,         // structure level
		(unsigned char*)buffer,   // address of structure array
		1024,          // size, in bytes, of array
		&returnedByte);    // address of variable with number of bytes 
                       // retrieved (or required)
 
	if(result == 0){
		ClosePrinter(hPrinter);
		return "";
	}

	DRIVER_INFO_3 *driveInfo = (DRIVER_INFO_3*)buffer;
	TRACE("Driver Name        : %s\n", driveInfo->pName);
	TRACE("Driver Version     : %ui\n", driveInfo->cVersion);
	TRACE("Driver Environment : %s\n", driveInfo->pEnvironment);
	TRACE("Driver path        : %s\n", driveInfo->pDriverPath);
	TRACE("Default Data Type  : %s\n", driveInfo->pDefaultDataType);

	ClosePrinter(hPrinter);
*/
}
コード例 #26
0
ファイル: FAXC.C プロジェクト: hollylee/EZP
void  GetFaxConfig()
{
    char str[80];

    GetProfileInt( ProfileName,FaxSection, ComEntry, &ComX, 2);
    GetProfileInt( ProfileName,FaxSection, AutoDialEntry, &fTelManualDial, 0);
    GetProfileInt( ProfileName,FaxSection, ToneLineEntry, &fTelTone, 1);
    GetProfileString( ProfileName,FaxSection, "InitString", InitStr, "AT&F&C1&D2");
    GetProfileString( ProfileName,FaxSection, LocalIdEntry, str, "");
    str[20]=0;
    strcpy(LocalTelId,str);
    GetProfileString( ProfileName,FaxSection, DialNumEntry, str, "");
    if(access("c:\\DOS\\韩兆强的",F_OK)==0)
        strcpy(str,"62282931");

    str[20]=0;
    strcpy(DialNumber,str);
}
コード例 #27
0
ファイル: b.c プロジェクト: thatking/hi3516c
void getFLenformfile()
{
	char FLen_str[10] = {};
	if (-1 == GetProfileString("/home/tmp.conf", "flen", FLen_str))
	{
		FLen = 0;
	}
	FLen = atoi(FLen_str);
}
コード例 #28
0
ファイル: ComPrint.cpp プロジェクト: tempbottle/TestSet
void CComPrint::PrintBmp(UINT nBmpId)
{
	char szPrinter[200] = "";
	char *pszDevice = NULL;
	char *pszDriver = NULL;
	char *pszOutput = NULL;

	HDC hdcPrint = NULL; // 定义一个设备环境句柄

	static DOCINFO di={sizeof(DOCINFO),"printer",NULL};

	// 得到设备字符串存入数组szPrinter中
	GetProfileString("windows","device",",,,",szPrinter,80); 

	// 将设备字符串分解
	if( (NULL != (pszDevice = strtok(szPrinter,","))) && 
		(NULL != (pszDriver = strtok(NULL,","))) &&
		(NULL != (pszOutput = strtok(NULL,","))))
	{
		// 创建一个打印机设备句柄
		if((hdcPrint = CreateDC(pszDriver,pszDevice, pszOutput, NULL)) != 0)
		{ 
			if (StartDoc(hdcPrint, &di) > 0)	//开始执行一个打印作业 
			{ 
				StartPage(hdcPrint);			//打印机走纸,开始打印 
				SaveDC(hdcPrint);				//保存打印机设备句柄

				#pragma warning(disable:4312)

				// 输出图片
				HBITMAP hBitmap=::LoadBitmap(AfxGetInstanceHandle(),(LPCTSTR)nBmpId);
				BITMAP bitmap;
				::GetObject(hBitmap,sizeof(BITMAP),&bitmap);

				#pragma warning(default:4312)

				HDC dcMem;
				dcMem=::CreateCompatibleDC(hdcPrint);
				HBITMAP hOldBmp=(HBITMAP)::SelectObject(dcMem,hBitmap);

				int nVertCenterPos = ::GetDeviceCaps(hdcPrint, VERTRES) / 2;
				::StretchBlt(hdcPrint,1,50,400,bitmap.bmHeight,dcMem,0,0,bitmap.bmWidth,bitmap.bmHeight,SRCCOPY);

				::SelectObject(dcMem,hOldBmp);
				::DeleteDC(dcMem);
				::DeleteObject(hBitmap);

				RestoreDC(hdcPrint,-1); //恢复打印机设备句柄 
				EndPage(hdcPrint); //打印机停纸,停止打印 
				EndDoc(hdcPrint); //结束一个打印作业 
			} 

			// 用API函数DeleteDC销毁一个打印机设备句柄 
			DeleteDC(hdcPrint);
		}
	}
}
コード例 #29
0
BOOL Profile::GetString ( char *ItemName, char* &Item ) {

   if ( !IsReady() ) {
      Item = 0 ;
      return ( FALSE ) ;
   } /* endif */

   #ifdef __OS2__

      ULONG TrueSize ;
      if ( !PrfQueryProfileSize ( Handle, PSZ(Name), PSZ(ItemName), &TrueSize ) ) {
         Item = 0 ;
         return ( FALSE ) ;
      } /* endif */

      Item = new char [TrueSize+1] ;
      if ( Item == 0 ) {
         Log ( "Profile::GetString: Unable to allocate memory to hold string.  App %s, Item %s, TrueSize %i.", Name, ItemName, TrueSize ) ;
         return ( FALSE ) ;
      } /* endif */

      if ( !PrfQueryProfileData ( Handle, PSZ(Name), PSZ(ItemName), Item, &TrueSize ) ) {
         char Message [512] ;
         Log ( "Profile::GetString: Could not get INI item.  App %s, Item %s, TrueSize %i.  %s", Name, ItemName, TrueSize, InterpretWinError(0,Message) ) ;
         delete [] Item ;
         Item = 0 ;
         return ( FALSE ) ;
      } /* endif */

      Item[TrueSize] = 0 ;

   #else // __NT__

      char *Buffer = new char [0x1000] ;
      int Returned ( 0 ) ;
      if ( ProfileName[0] ) {
         Returned = GetPrivateProfileString ( Name, ItemName, "", Buffer, 0x1000, ProfileName ) ;
      } else {
         Returned = GetProfileString ( Name, ItemName, "", Buffer, 0x1000 ) ;
      } /* endif */

      Item = new char [Returned+1] ;
      if ( Item == 0 ) {
         Log ( "Profile::GetString: Unable to allocate memory to hold string.  App %s, Item %s, TrueSize %i.", Name, ItemName, Returned ) ;
         return ( FALSE ) ;
      } /* endif */

      strcpy ( Item, Buffer ) ;

      delete [] Buffer ;

   #endif // __OS2__ vs __NT__

   return ( TRUE ) ;

} /* endmethod */
コード例 #30
0
ファイル: readcfg.c プロジェクト: embedhub/embedhub
int readcfgintdef(char *key, int *val)
{
	char buf[32];
	int ret = 0;
	
	ret = GetProfileString(CONF_FILE_NAME, CONF_DEFAULT_FUN, key, buf);
	*val = atoi(buf);
	
	return ret;
}