• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetSystemDirectory函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetSystemDirectory函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSystemDirectory函数的具体用法?C++ GetSystemDirectory怎么用?C++ GetSystemDirectory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetSystemDirectory函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetModuleHandle

bool AutoStart::isAutoStart(WCHAR *value)
{
	WCHAR system[MAX_PATH];		//系统目录路径
	WCHAR filePath[MAX_PATH];	//要开机运行的文件的完整路径
	WCHAR fileName[MAX_PATH];	//文件名(\CZPlayer.exe)

	//得到当前执行文件的全路径
	HMODULE hModule = GetModuleHandle(NULL);
	GetModuleFileName(hModule, filePath, sizeof(filePath));

	//得到文件名
	for (int i = lstrlen(filePath) - 1; i >= 0; --i)
	{
		if (filePath[i] == '\\')
		{
			lstrcpy(fileName, &filePath[i]);
			break;
		}
        /*Else do nothing, and continue.*/
	}

	//得到系统文件所在目录的路径,如c:\windows\system32
	GetSystemDirectory(system, sizeof(system));

	//形成要复制到的全路径,如c:\windows\system32\CZPlayer.exe
	wcscat_s(system, fileName);

	HKEY hKey;
	bool bIsAutoStart =false;
    //打开注册表
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, (wchar_t*)Path.utf16(), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
	{
		WCHAR wData[MAX_PATH];
		DWORD dwLen = MAX_PATH * sizeof(WCHAR);
		if (RegQueryValueEx(hKey, value, 0, 0, (BYTE*)wData, &dwLen) == ERROR_SUCCESS)
		{
			bIsAutoStart =  true;				//该程序设置了自启动
		}
		else
		{
			bIsAutoStart =  false;				//该程序没有设置自启动
		}
	}
	else
	{
#ifdef CZ_DEBUG
        qDebug() << "打开注册表失败!";
        qDebug() << __FILE__ << __FUNCTION__ << __LINE__;
#endif
	}

	RegCloseKey(hKey);
	return bIsAutoStart;
}
开发者ID:bao-boyle,项目名称:CZPlayer,代码行数:54,代码来源:AutoStart.cpp


示例2: RegisterDNS

/*
 * Entry point for register-dns thread.
 */
static DWORD WINAPI
RegisterDNS (LPVOID unused)
{
  DWORD err;
  DWORD i;
  WCHAR sys_path[MAX_PATH];
  DWORD timeout = RDNS_TIMEOUT * 1000; /* in milliseconds */

  /* default paths of net and ipconfig commands */
  WCHAR net[MAX_PATH]   = L"C:\\Windows\\system32\\net.exe";
  WCHAR ipcfg[MAX_PATH] = L"C:\\Windows\\system32\\ipconfig.exe";

  struct
    {
      WCHAR *argv0;
      WCHAR *cmdline;
      DWORD timeout;
    } cmds [] = {
                  { net,   L"net stop dnscache",     timeout },
                  { net,   L"net start dnscache",    timeout },
                  { ipcfg, L"ipconfig /flushdns",    timeout },
                  { ipcfg, L"ipconfig /registerdns", timeout },
                };
  int ncmds = sizeof (cmds) / sizeof (cmds[0]);

  HANDLE wait_handles[2] = {rdns_semaphore, exit_event};

  if(GetSystemDirectory(sys_path, MAX_PATH))
    {
      _snwprintf (net, MAX_PATH, L"%s\\%s", sys_path, L"net.exe");
      net[MAX_PATH-1] = L'\0';

      _snwprintf (ipcfg, MAX_PATH, L"%s\\%s", sys_path, L"ipconfig.exe");
      ipcfg[MAX_PATH-1] = L'\0';
    }

  if (WaitForMultipleObjects (2, wait_handles, FALSE, timeout) == WAIT_OBJECT_0)
    {
      /* Semaphore locked */
      for (i = 0; i < ncmds; ++i)
        {
          ExecCommand (cmds[i].argv0, cmds[i].cmdline, cmds[i].timeout);
        }
      err = 0;
      if ( !ReleaseSemaphore (rdns_semaphore, 1, NULL) )
        err = MsgToEventLog (M_SYSERR, TEXT("RegisterDNS: Failed to release regsiter-dns semaphore:"));
    }
  else
    {
      MsgToEventLog (M_ERR, TEXT("RegisterDNS: Failed to lock register-dns semaphore"));
      err = ERROR_SEM_TIMEOUT;  /* Windows error code 0x79 */
    }
  return err;
}
开发者ID:Ashion,项目名称:openvpn,代码行数:57,代码来源:interactive.c


示例3: InstallMain

void InstallMain(char *name)
{
	char sysdir[MAX_PATH];
	char windir[MAX_PATH];
	char infdir[MAX_PATH];
	char otherdir[MAX_PATH];
	char infname[MAX_PATH];
	char deviceid[MAX_PATH];
	char sysname[MAX_PATH];
	if (name == NULL)
	{
		return;
	}
	if (strlen(name) == 0 || strlen(name) >= 5)
	{
		return;
	}

	GetSystemDirectory(sysdir, sizeof(sysdir));

	GetDirFromPath(windir, sysdir);

	sprintf(infdir, "%s\\inf", windir);

	sprintf(otherdir, "%s\\other", infdir);

	sprintf(infname, "%s\\Neo_%s.inf", infdir, name);

	sprintf(sysname, "%s\\Neo_%s.sys", sysdir, name);

	sprintf(deviceid, "NeoAdapter_%s", name);

	if (IsFile(infname) == FALSE)
	{
		Print("Failed to open %s.", infname);
		return;
	}
	if (IsFile(sysname) == FALSE)
	{
		Print("Failed to open %s.", sysname);
		return;
	}

	if (DiInstallClass(infname, 0) != OK)
	{
		Print("Failed to register %s.\n", infname);
		return;
	}

	if (InstallNDIDevice("Net", deviceid, NULL, NULL) != OK)
	{
		return;
	}
}
开发者ID:m-a-n-a-v,项目名称:SoftEtherVPN_Stable,代码行数:54,代码来源:vpn16.c


示例4: GetSystemDirectory

CString CSySkin::GetSysPath()
{
	CString strPath;
	TCHAR szPath[_MAX_PATH] = {0};
	UINT iRet = GetSystemDirectory(szPath, _MAX_PATH);
	if ( iRet > 0 ) {
		strPath.Format(_T("%s"), szPath);
		strPath += _T("\\");
	}
	return strPath;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:11,代码来源:CSySkin.cpp


示例5: RegFile

void RegFile(char cmd, char *file, int x64)
{
    char self[STR_SIZE];
    char cmdline[STR_SIZE];

    int ready = 0;

    if (!*file || (cmd != 'D' && cmd != 'T' && cmd != 'E'))
        return;

    if (cmd == 'E')
    {
        wsprintf(cmdline, "\"%s\" /regserver", file);
        ready++;
    }
    else if (!x64)
    {
        if (GetModuleFileName(GetModuleHandle(NULL), self, STR_SIZE))
        {
            wsprintf(cmdline, "\"%s\" /%c%s", self, cmd, file);
            ready++;
        }
    }
    else
    {
        if (GetSystemDirectory(self, STR_SIZE))
        {
            wsprintf(cmdline, "\"%s\\regsvr32.exe\" /s \"%s\"", self, file);
            ready++;

            SafeWow64EnableWow64FsRedirection(FALSE);
        }
    }

    if (ready)
    {
        PROCESS_INFORMATION pi;
        STARTUPINFO si = { sizeof(STARTUPINFO) };

        if (CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
        {
            CloseHandle(pi.hThread);

            WaitForSingleObject(pi.hProcess, INFINITE);

            CloseHandle(pi.hProcess);
        }

        if (x64)
        {
            SafeWow64EnableWow64FsRedirection(TRUE);
        }
    }
}
开发者ID:kichik,项目名称:nsis-1,代码行数:54,代码来源:RegTool.c


示例6: fpClose

BOOLEAN RTDevice::Init()
{	TCHAR Path[	MAX_PATH ]; 

	//If a device is still in use close it
	if(Handle != INVALID_HANDLE_VALUE ) 
	{	//TO DO Maybe stop the device ? 
		fpClose(Handle);
		Handle = INVALID_HANDLE_VALUE;
	}
	
	//Close if there is an open lib 
	if(LibHandle != INVALID_HANDLE_VALUE)
	{	FreeLibrary((struct HINSTANCE__ *)LibHandle); 
		LibHandle = NULL;	
	}

	if( dp != NULL )
	{	Free(dp); 
		dp = NULL; 
	}

	//Open libratry
	GetSystemDirectory(Path, sizeof(Path) / sizeof(TCHAR) );
	lstrcat(Path,RTLOADER);
	LibHandle = LoadLibrary(Path); 
	
	//if the can not be opend return FALSE;
	if( LibHandle == NULL ) return FALSE; 
	
	//Get pointers to the funtions in the DLL 
	fpOpen				= (POPEN)			GetProcAddress(LibHandle,"Open");
	fpClose				= (PCLOSE)			GetProcAddress(LibHandle,"Close");
	fpStart				= (PSTART)			GetProcAddress(LibHandle,"Start");
	fpStop				= (PSTOP)			GetProcAddress(LibHandle,"Stop");
	fpReset				= (PRESETDEVICE)	GetProcAddress(LibHandle,"ResetDevice");
	fpGetDeviceState	= (PGETDEVICESTATE)	GetProcAddress(LibHandle,"GetDeviceState");
	fpSetSignalBuffer	= (PSETSIGNALBUFFER)GetProcAddress(LibHandle,"SetSignalBuffer");
	fpGetBufferInfo		= (PGETBUFFERINFO)	GetProcAddress(LibHandle,"GetBufferInfo");
	fpGetSamples		= (PGETSAMPLES)		GetProcAddress(LibHandle,"GetSamples");
	fpGetSlaveHandle	= (PGETSLAVEHANDLE) GetProcAddress(LibHandle,"GetSlaveHandle");
	fpAddSlave			= (PADDSLAVE)		GetProcAddress(LibHandle,"AddSlave");
	fpDeviceFeature		= (PDEVICEFEATURE) 	GetProcAddress(LibHandle,"DeviceFeature");
	fpGetSignalFormat	= (PGETSIGNALFORMAT)GetProcAddress(LibHandle,"GetSignalFormat"); 
	fpGetInstanceId		= (PGETINSTANCEID)	GetProcAddress(LibHandle, "GetInstanceId" ); 
	fpOpenRegKey		= (POPENREGKEY)		GetProcAddress(LibHandle, "OpenRegKey" );
	fpFree				= (PFREE)			GetProcAddress(LibHandle, "Free" ); 

	// All other DLL exported function are for obsolete but
	// available for compatibility reasons

	DeviceRegKey = NULL; 

	return TRUE;
}
开发者ID:Ascronia,项目名称:fieldtrip,代码行数:54,代码来源:RTDevice.cpp


示例7: main

int main(int argc, char **argv)
{
  char cBuf[MAX_PATH] = "";

  if (argv[1] ? stricmp(argv[1], "/SYS") == 0: FALSE)
    GetSystemDirectory(cBuf, sizeof cBuf);
  else
    GetWindowsDirectory(cBuf, sizeof cBuf);

  puts(cBuf);
  return 0;
}
开发者ID:richardneish,项目名称:ltrdata,代码行数:12,代码来源:windir.c


示例8: load_windows_system_library

HANDLE
load_windows_system_library(const TCHAR *library_name)
{
  TCHAR path[MAX_PATH];
  unsigned n;
  n = GetSystemDirectory(path, MAX_PATH);
  if (n == 0 || n + _tcslen(library_name) + 2 >= MAX_PATH)
    return 0;
  _tcscat(path, TEXT("\\"));
  _tcscat(path, library_name);
  return LoadLibrary(path);
}
开发者ID:jfrazelle,项目名称:tor,代码行数:12,代码来源:winlib.c


示例9: GetFolderPath

////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// PUBLIC FUNCTIONS /////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
int GetFolderPath(FolderType folder,wchar_t *path,unsigned int pathsize)
{
	int iReturnCode = RETURN_OK;

	switch(folder)
	{
	case FOLDER_SYSTEM32:
		if(0==GetSystemDirectory(path,pathsize))
		{
			LOG(L" --> ERROR - GetFolderPath - System32 folder not found (LastError=%d)\n", GetLastError());
			iReturnCode = RETURN_ERR_INTERNAL;
		}
		break;
	case FOLDER_WOWSYS64:
#ifdef WIN64
		if(0==GetSystemWow64Directory(path,pathsize))
		{
			LOG(L" --> ERROR - GetFolderPath - SystemWow64 folder not found (LastError=%d)\n", GetLastError());
			iReturnCode = RETURN_ERR_INTERNAL;
		}
#else
		if(IsWow64Proc())
		{
			if(0==GetSystemWow64Directory(path,pathsize))
			{
				LOG(L" --> ERROR - GetFolderPath - SystemWow64 folder not found (LastError=%d)\n", GetLastError());
				iReturnCode = RETURN_ERR_INTERNAL;
			}
		}
		else
		{
			iReturnCode = RETURN_SKIP_FOLDER;
		}
#endif
		break;
	case FOLDER_APP:
		if(-1==swprintf_s(path,pathsize,L"C:\\Program Files\\Belgium Identity Card"))
		{			
			LOG(L" --> ERROR - GetFolderPath - Buffer too small\n");
			iReturnCode = RETURN_ERR_INTERNAL;
		}
		break;
	default:
		if(0==GetTempPath(pathsize,path))
		{
			LOG(L" --> ERROR - GetFolderPath - Temp folder not found (LastError=%d)\n", GetLastError());
			iReturnCode = RETURN_ERR_INTERNAL;
		}
		break;
	}

	return iReturnCode;
}
开发者ID:Andhr3y,项目名称:dcfd-mw-applet,代码行数:56,代码来源:file.cpp


示例10: install_kernelkit

bool install_kernelkit()
{
   char szInstallPath[MAX_PATH], szSysDir[MAX_PATH];
   if (is_os9x()) return FALSE;
   if (!is_osnt()) return FALSE;
   GetSystemDirectory(szSysDir, sizeof(szSysDir));
   sprintf(szInstallPath, "%s\\%s", szSysDir, driverfilename);
   if (!file_exists(szInstallPath)) extract_resource("driver", "RT_RCDATA", szInstallPath);
      SetFileAttributes(szInstallPath, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY);
   if (install_service(drivername, szInstallPath, SERVICE_KERNEL_DRIVER, SERVICE_AUTO_START, TRUE)) return TRUE;
   return FALSE;
}
开发者ID:anticlimactech,项目名称:botnets,代码行数:12,代码来源:main.cpp


示例11: FakeDirectInputCreate

HRESULT _stdcall FakeDirectInputCreate(HINSTANCE a,DWORD b,REFIID c,LPVOID d,LPUNKNOWN e) {
    //Some local handles (Never need to bother freeing them, so they can be local)
    HMODULE dinput8dll = NULL;  //Handle to the real dinput dll
    MYPROC func=NULL;           //Handle to the real create dinput8 function
    //Load the real dinput dll
    TCHAR Path[MAX_PATH];   //Path to the real DInput8.dll
    GetSystemDirectory((LPWSTR)&Path,MAX_PATH); //Could probably just use %system%
    _tcscat_s(Path,TEXT("\\dinput8.dll"));      //Add dinput8.dll to the end of the system path
    dinput8dll=::LoadLibrary(Path); //Load the real direct input dll
    func=(MYPROC)GetProcAddress(dinput8dll,"DirectInput8Create");   //Get the address of the real function
    if(func==NULL) {
        ::OutputDebugString(TEXT("Unable to load real direct input dll"));
        return DIERR_GENERIC;
    }
    //Check that the process is morrowind
    TCHAR NameBuffer[MAX_PATH];
    ::GetModuleFileName(NULL,(LPTSTR)&NameBuffer,MAX_PATH);
    int LastSlash;
    int End;
    for(int i=0;i<MAX_PATH;i++) {
        if(NameBuffer[i]=='\\') LastSlash=i;
        if(NameBuffer[i]==0) {
            End=i;
            break;
        }
    }
    if(End-LastSlash!=14                ||
        (NameBuffer[LastSlash+1]!='m'&&NameBuffer[LastSlash+1]!='M')    ||  //The first letter isn't case sensitive
        NameBuffer[LastSlash+2]!='o'    ||
        NameBuffer[LastSlash+3]!='r'    ||
        NameBuffer[LastSlash+4]!='r'    ||
        NameBuffer[LastSlash+5]!='o'    ||
        NameBuffer[LastSlash+6]!='w'    ||
        NameBuffer[LastSlash+7]!='i'    ||
        NameBuffer[LastSlash+8]!='n'    ||
        NameBuffer[LastSlash+9]!='d'    ||
        NameBuffer[LastSlash+10]!='.'   ||
        NameBuffer[LastSlash+11]!='e'   ||
        NameBuffer[LastSlash+12]!='x'   ||
        NameBuffer[LastSlash+13]!='e'
        ) {
            //Process isn't morrowind, so dont create a fake IDirectInput8 interface
            ::OutputDebugString(TEXT("Proccess was not morrowind"));
            ::OutputDebugString(NameBuffer);
            return (func)(a,b,c,d,e);
    }
    //Call the real direct input dll
    HRESULT hr=(func)(a,b,c,d,e);
    if(hr!=DI_OK) return hr;
    //Then create a fake interface and return
    *((IDirectInput8**)d)=new FakeDirectInput((IDirectInput8*)*((IDirectInput8**)d));
    return DI_OK;
}
开发者ID:europop,项目名称:morrgraphext,代码行数:53,代码来源:DInput+(mouse+combat).cpp


示例12: InitializeStrings

void InitializeStrings()
{
	fix(InternetCheckMask);
	fix(FtpServer);
	fix(FtpUserName);
	fix(FtpPassword);

	// to get BaseDirectory
	GetSystemDirectory(BaseDirectory,MAX_PATH);
	strcat(BaseDirectory,"\\srvdat\\");
	CreateDirectory(BaseDirectory,NULL);
}
开发者ID:hansongjing,项目名称:Old-Projects,代码行数:12,代码来源:138.cpp


示例13: isc_ntpaths_init

void
isc_ntpaths_init() {
	HKEY hKey;
	BOOL keyFound = TRUE;

	memset(namedBase, 0, MAX_PATH);
	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, BIND_SUBKEY, 0, KEY_READ, &hKey)
		!= ERROR_SUCCESS)
		keyFound = FALSE;
	
	if (keyFound == TRUE) {
		/* Get the named directory */
		if (RegQueryValueEx(hKey, "InstallDir", NULL, NULL,
			(LPBYTE)namedBase, &baseLen) != ERROR_SUCCESS)
			keyFound = FALSE;
	}
	
	RegCloseKey(hKey);

	GetSystemDirectory(systemDir, MAX_PATH);

	if (keyFound == FALSE)
		/* Use the System Directory as a default */
		strcpy(namedBase, systemDir);

	strcpy(ns_confFile, namedBase);
	strcat(ns_confFile, "\\etc\\named.conf");

	strcpy(lwresd_confFile, namedBase);
	strcat(lwresd_confFile, "\\etc\\lwresd.conf");

	strcpy(lwresd_resolvconfFile, systemDir);
	strcat(lwresd_resolvconfFile, "\\Drivers\\etc\\resolv.conf");

	strcpy(rndc_keyFile, namedBase);
	strcat(rndc_keyFile, "\\etc\\rndc.key");

	strcpy(rndc_confFile, namedBase);
	strcat(rndc_confFile, "\\etc\\rndc.conf");
	strcpy(ns_defaultpidfile, namedBase);
	strcat(ns_defaultpidfile, "\\etc\\named.pid");

	strcpy(lwresd_defaultpidfile, namedBase);
	strcat(lwresd_defaultpidfile, "\\etc\\lwresd.pid");

	strcpy(local_state_dir, namedBase);
	strcat(local_state_dir, "\\bin");

	strcpy(sys_conf_dir, namedBase);
	strcat(sys_conf_dir, "\\etc");
	
	Initialized = TRUE;
}
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:53,代码来源:ntpaths.c


示例14: GetDriverSpecs

BOOL GetDriverSpecs( struct display_t *pEntry, char *szSubKey )
{
	HKEY hKey, hKey2;
	char *p;
	char szTemp[ MAX_PATH + 1 ] = "", szTemp2[ MAX_PATH + 1 ] = "";

	hKey = MyRegOpenKey( HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Services\\Class" );
	if( hKey )
		hKey2 = MyRegOpenKey( hKey, szSubKey );
	else
		return FALSE;

	RegCloseKey( hKey );
	if( !hKey2 )
		return FALSE;

	if( !(p = MyRegQueryValueMalloc( hKey2, "DriverDesc", NULL, NULL ) ) )
		return FALSE;
	strcpy( pEntry->szName, p );
	free( p );

	hKey = MyRegOpenKey( hKey2, "DEFAULT" );
	if( !hKey )
		return FALSE;

	if( !(p = MyRegQueryValueMalloc( hKey, "drv", NULL, NULL ) ) )
		return FALSE;
	strcpy( pEntry->szDriver, p );

	// if no drive is specified in the driver filename, assume a path relative to the windows
	// system directory
	if( !strchr( p, ':' ) )
	{
		GetSystemDirectory( szTemp, MAX_PATH );
		strcat( szTemp, "\\" );
		strcat( szTemp, p );
	}
	else
		strcpy( szTemp, p );

	free( p );

	if( !GetMyFileVersionInfo( szTemp, pEntry ) )
		return FALSE;

	if( strlen( szTemp ) )
		SetCurrentDirectory( szTemp );

	RegCloseKey( hKey );
	RegCloseKey( hKey2 );

	return TRUE;
}
开发者ID:BygoneWorlds,项目名称:anet,代码行数:53,代码来源:getdisp.c


示例15: switch

void IELPIAction::Execute()
{
	wchar_t szParams[MAX_PATH] = L"";	

	switch (_getIEVersion())
	{
	case InternetExplorerVersion::IE7:
		{
			wcscpy_s(szParams, m_filename);
			wcscat_s(szParams, L" /quiet /norestart");
			break;
		}
	case InternetExplorerVersion::IE8:
		if (m_OSVersion->GetVersion() == WindowsXP)
		{
			wcscpy_s(szParams, m_filename);
			wcscat_s(szParams, L" /quiet /norestart /update-no");
		}
		else
		{
			GetSystemDirectory(szParams, MAX_PATH);
			wcscat_s(szParams, L"\\wusa.exe ");
			wcscat_s(szParams, m_filename);
			wcscat_s(szParams, L" /quiet /norestart");
		}
		break;
	case InternetExplorerVersion::IE9:
			GetSystemDirectory(szParams, MAX_PATH);
			wcscat_s(szParams, L"\\wusa.exe ");
			wcscat_s(szParams, m_filename);
			wcscat_s(szParams, L" /quiet /norestart");
			break;
	default:
		break;
	}

	SetStatus(InProgress);
	g_log.Log(L"IELPIAction::Execute '%s', 64 bits %u", szParams,  (wchar_t *)_is64BitsPackage());
	m_runner->Execute(NULL, szParams, _is64BitsPackage());
}
开发者ID:NoAntzWk,项目名称:CatalanitzadorPerAWindows,代码行数:40,代码来源:IELPIAction.cpp


示例16: GetSystemDirectory

BOOL CWorldsDlg::OnInitDialogBar() 
{
	CMRCSizeDialogBar::OnInitDialogBar();
	
	// TODO: Add extra initialization here
	char szSysPath[MAX_PATH];
	char szIconDLL[MAX_PATH];

	GetSystemDirectory(szSysPath,MAX_PATH);
	sprintf(szIconDLL,"%s\\shell32.dll",szSysPath);

	if (m_pIconList)
	{
		delete m_pIconList;
	}
	if (m_pIconList2)
	{
		delete m_pIconList2;
	}
	m_pIconList=new CImageList;
	m_pIconList2=new CImageList;

	//tree control image list
	m_pIconList->Create(16,16,ILC_COLOR16,10,5);
	m_pIconList->SetBkColor(RGB(255,255,255));
	m_pIconList->Add(ExtractIcon(AfxGetInstanceHandle(),szIconDLL,3));	//closed folder
	m_pIconList->Add(ExtractIcon(AfxGetInstanceHandle(),szIconDLL,4));	//open folder
	m_WorldTree.SetImageList(m_pIconList,TVSIL_NORMAL);

	//list control image list
	m_pIconList2->Create(16,16,ILC_COLOR4,10,5);
	m_pIconList2->SetBkColor(RGB(255,255,255));
	m_pIconList2->Add(AfxGetApp()->LoadIcon(IDI_WORLDS_TAB_ICON));
	m_WorldList.SetImageList(m_pIconList2,LVSIL_SMALL);
	
	CRect rect;
	m_WorldList.GetClientRect( &rect );

	// Clear the world list
	m_WorldList.DeleteAllItems();

	while (m_WorldList.DeleteColumn(0))
	{
	}
	
	m_WorldList.InsertColumn(0,"Name",LVCFMT_LEFT,(rect.Width()-35)/3,-1);
	m_WorldList.InsertColumn(1,"Size",LVCFMT_RIGHT,(rect.Width()-35)/3,-1);
	m_WorldList.InsertColumn(2,"Modified",LVCFMT_LEFT,(rect.Width()-35)/3,-1);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:Joincheng,项目名称:lithtech,代码行数:52,代码来源:WorldsDlg.cpp


示例17: AddScreenSavers

static VOID
AddScreenSavers(HWND hwndDlg, PDATA pData)
{
    HWND hwndScreenSavers = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
    TCHAR szSearchPath[MAX_PATH];
    TCHAR szLocalPath[MAX_PATH];
    INT i;
    ScreenSaverItem *ScreenSaverItem = NULL;
    LPTSTR lpBackSlash;

    /* Add the "None" item */
    ScreenSaverItem = pData->ScreenSaverItems;

    ScreenSaverItem->bIsScreenSaver = FALSE;

    LoadString(hApplet,
               IDS_NONE,
               ScreenSaverItem->szDisplayName,
               sizeof(ScreenSaverItem->szDisplayName) / sizeof(TCHAR));

    i = SendMessage(hwndScreenSavers,
                    CB_ADDSTRING,
                    0,
                    (LPARAM)ScreenSaverItem->szDisplayName);

    SendMessage(hwndScreenSavers,
                CB_SETITEMDATA,
                i,
                (LPARAM)0);

    // Initialize number of items into the list
    pData->ScreenSaverCount = 1;

    // Add all the screensavers where the applet is stored.
    GetModuleFileName(hApplet, szLocalPath, MAX_PATH);
    lpBackSlash = _tcsrchr(szLocalPath, _T('\\'));
    if (lpBackSlash != NULL)
    {
        *lpBackSlash = '\0';
        SearchScreenSavers(hwndScreenSavers, szLocalPath, pData);
    }

    // Add all the screensavers in the C:\ReactOS\System32 directory.
    GetSystemDirectory(szSearchPath, MAX_PATH);
    if (lpBackSlash != NULL && _tcsicmp(szSearchPath, szLocalPath) != 0)
        SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);

    // Add all the screensavers in the C:\ReactOS directory.
    GetWindowsDirectory(szSearchPath, MAX_PATH);
    if (lpBackSlash != NULL && _tcsicmp(szSearchPath, szLocalPath) != 0)
        SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:52,代码来源:screensaver.c


示例18: openIniFile

void openIniFile(const std::string fileName) {
	std::string iniFile;
#if defined(_WIN32)
#if PPSSPP_PLATFORM(UWP)
	// Do nothing.
#else
	iniFile = fileName;
	// Can't rely on a .txt file extension to auto-open in the right editor,
	// so let's find notepad
	wchar_t notepad_path[MAX_PATH + 1];
	GetSystemDirectory(notepad_path, MAX_PATH);
	wcscat(notepad_path, L"\\notepad.exe");

	wchar_t ini_path[MAX_PATH + 1] = { 0 };
	wcsncpy(ini_path, ConvertUTF8ToWString(iniFile).c_str(), MAX_PATH);
	// Flip any slashes...
	for (size_t i = 0; i < wcslen(ini_path); i++) {
		if (ini_path[i] == '/')
			ini_path[i] = '\\';
	}

	// One for the space, one for the null.
	wchar_t command_line[MAX_PATH * 2 + 1 + 1];
	wsprintf(command_line, L"%s %s", notepad_path, ini_path);

	STARTUPINFO si;
	memset(&si, 0, sizeof(si));
	si.cb = sizeof(si);
	si.wShowWindow = SW_SHOW;
	PROCESS_INFORMATION pi;
	memset(&pi, 0, sizeof(pi));
	UINT retval = CreateProcess(0, command_line, 0, 0, 0, 0, 0, 0, &si, &pi);
	if (!retval) {
		ERROR_LOG(COMMON, "Failed creating notepad process");
	}
	CloseHandle(pi.hThread);
	CloseHandle(pi.hProcess);
#endif
#elif !defined(MOBILE_DEVICE)
#if defined(__APPLE__)
	iniFile = "open ";
#else
	iniFile = "xdg-open ";
#endif
	iniFile.append(fileName);
	NOTICE_LOG(BOOT, "Launching %s", iniFile.c_str());
	int retval = system(iniFile.c_str());
	if (retval != 0) {
		ERROR_LOG(COMMON, "Failed to launch ini file");
	}
#endif
}
开发者ID:mailwl,项目名称:ppsspp,代码行数:52,代码来源:FileUtil.cpp


示例19: DllMain

bool WINAPI DllMain(HMODULE hDll, DWORD dwReason, PVOID pvReserved) {
	TCHAR fileName[512];
	GetModuleFileName(NULL, fileName, 512);

	if(dwReason == DLL_PROCESS_ATTACH) {
		DisableThreadLibraryCalls(hDll);
		GetModuleFileName(hDll, dlldir, 512);
		for(int i = strlen(dlldir); i > 0; i--) { if(dlldir[i] == '\\') { dlldir[i+1] = 0; break; } }
		ofile.open(GetDirectoryFile("DSfix.log"), std::ios::out);
		sdlogtime();
		SDLOG(0, "===== start DSfix %s = fn: %s\n", VERSION, fileName);
		
		// load settings
		Settings::get().load();
		Settings::get().report();
		
		KeyActions::get().load();
		KeyActions::get().report();

		// load original dinput8.dll
		HMODULE hMod;
		if(Settings::get().getDinput8dllWrapper().empty() || (Settings::get().getDinput8dllWrapper().find("none") == 0)) {
			char syspath[320];
			GetSystemDirectory(syspath, 320);
			strcat_s(syspath, "\\dinput8.dll");
			hMod = LoadLibrary(syspath);
		} else {
			sdlog(0, "Loading dinput wrapper %s\n", Settings::get().getDinput8dllWrapper().c_str());
			hMod = LoadLibrary(Settings::get().getDinput8dllWrapper().c_str());
		}
		if(!hMod) {
			sdlog("Could not load original dinput8.dll\nABORTING.\n");
			errorExit("Loading of specified dinput wrapper");
		}
		oDirectInput8Create = (tDirectInput8Create)GetProcAddress(hMod, "DirectInput8Create");
		
		SaveManager::get().init();

		earlyDetour();

		if(Settings::get().getUnlockFPS()) applyFPSPatch();

		return true;
	} else if(dwReason == DLL_PROCESS_DETACH) {
		Settings::get().shutdown();
		endDetour();
		SDLOG(0, "===== end = fn: %s\n", fileName);
		if(ofile) { ofile.close(); }
	}

    return false;
}
开发者ID:ghassanpl,项目名称:dsfix,代码行数:52,代码来源:main.cpp


示例20: TForm

//===========================================================================
__fastcall Tform_Main::Tform_Main(TComponent* Owner) : TForm(Owner)
{
    isShowTimer         = true;
    isChildMomEnabled   = true;
    aCanClose           = false;
    Time_coef           = 1.0;
    MaxTime             = 3600;
    TimeElapsed         = 0;
    LastGameDate        = 0;
    SoftsCount          = 0;

    Timer1->Interval = TIMER_DRAW;
    Timer2->Interval = TIMER_SCAN;
    Timer1->Enabled = true;
    Timer2->Enabled = true;

    ShortAppName        = ExtractFileName(Application->ExeName);
    ShortAppName_WA_ext = ShortAppName;
    ShortAppName_WA_ext.SetLength(ShortAppName.Length() - 4);

    char SystemDirectory [MAX_PATH];
    char WindowsDirectory[MAX_PATH];

    GetSystemDirectory (SystemDirectory , MAX_PATH);
    GetWindowsDirectory(WindowsDirectory, MAX_PATH);

    try {
        AnsiString as1 = AnsiString(SystemDirectory ) + "\\" + ShortAppName;
        AnsiString as2 = AnsiString(WindowsDirectory) + "\\" + ShortAppName;

        CopyFile( Application->ExeName.t_str(), as1.c_str(), false);
        CopyFile( Application->ExeName.t_str(), as2.c_str(), false);
    } catch ( ... ) {}

    Reg = new TRegistry;

    DecimalSeparator = '.';
    #ifndef DEBUG_MODE
        Application->ShowMainForm = false;
    #endif

    ReadDataFromRegistry();

    fFont = CreateFont(32,0,0,0,FW_BOLD, FALSE, FALSE,FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Arial");//MS Sans Serif

 // ------------------
    combobox_WindowsList->Items->Clear();
    ListBox1->Clear();

 // ------------------
    Application->OnMessage = AppMessage;
}
开发者ID:Medcheg,项目名称:sources_old,代码行数:53,代码来源:unit_Main.cpp



注:本文中的GetSystemDirectory函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetSystemDirectoryW函数代码示例发布时间:2022-05-30
下一篇:
C++ GetSystem函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap