本文整理汇总了C++中GetCurrentDirectory函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCurrentDirectory函数的具体用法?C++ GetCurrentDirectory怎么用?C++ GetCurrentDirectory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCurrentDirectory函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: WDL_ChooseFileForSave
bool WDL_ChooseFileForSave(HWND parent,
const char *text,
const char *initialdir,
const char *initialfile,
const char *extlist,
const char *defext,
bool preservecwd,
char *fn,
int fnsize,
const char *dlgid,
void *dlgProc,
#ifdef _WIN32
HINSTANCE hInstance
#else
struct SWELL_DialogResourceIndex *reshead
#endif
)
{
char cwd[2048];
GetCurrentDirectory(sizeof(cwd),cwd);
#ifdef _WIN32
char temp[4096];
memset(temp,0,sizeof(temp));
if (initialfile) lstrcpyn_safe(temp,initialfile,sizeof(temp));
WDL_fixfnforopenfn(temp);
#ifdef WDL_FILEBROWSE_WIN7VISTAMODE
{
Win7FileDialog fd(text, 1);
if(fd.inited())
{
fd.addOptions(FOS_DONTADDTORECENT);
//vista+ file open dialog
char olddir[2048];
GetCurrentDirectory(sizeof(olddir),olddir);
fd.setFilterList(extlist);
if (defext)
{
fd.setDefaultExtension(defext);
int i = 0;
const char *p = extlist;
while(*p)
{
if(*p) p+=strlen(p)+1;
if(!*p) break;
if(stristr(p, defext))
{
fd.setFileTypeIndex(i+1);
break;
}
i++;
p+=strlen(p)+1;
}
}
fd.setFolder(initialdir?initialdir:olddir, 0);
if(initialfile)
{
//check for folder name
if (WDL_remove_filepart(temp))
{
//folder found
fd.setFolder(temp, 0);
fd.setFilename(temp + strlen(temp) + 1);
}
else
fd.setFilename(*temp ? temp : initialfile);
}
fd.setTemplate(hInstance, dlgid, (LPOFNHOOKPROC)dlgProc);
if(fd.show(parent))
{
//ifilesavedialog saves the last folder automatically
fd.getResult(fn, fnsize);
if (preservecwd) SetCurrentDirectory(olddir);
return true;
}
if (preservecwd) SetCurrentDirectory(olddir);
return NULL;
}
}
#endif
OPENFILENAME l={sizeof(l),parent, hInstance, extlist, NULL,0, 0, temp, sizeof(temp)-1, NULL, 0, initialdir&&initialdir[0] ? initialdir : cwd, text,
OFN_HIDEREADONLY|OFN_EXPLORER|OFN_OVERWRITEPROMPT,0,0,defext, 0, (LPOFNHOOKPROC)dlgProc, dlgid};
if (hInstance&&dlgProc&&dlgid) l.Flags |= OFN_ENABLEHOOK|OFN_ENABLETEMPLATE|OFN_ENABLESIZING;
if (preservecwd) l.Flags |= OFN_NOCHANGEDIR;
if (!GetSaveFileName(&l)||!temp[0])
{
if (preservecwd) SetCurrentDirectory(cwd);
return false;
}
if (preservecwd) SetCurrentDirectory(cwd);
//.........这里部分代码省略.........
开发者ID:Nowhk,项目名称:wdl-ol,代码行数:101,代码来源:filebrowse.cpp
示例2: SetWindowText
//初始化函数
BOOL CDlgRegister::OnInitDialog()
{
__super::OnInitDialog();
//设置标题
SetWindowText(TEXT("帐号注册"));
//限制输入
((CComboBox *)(GetDlgItem(IDC_ACCOUNTS)))->LimitText(NAME_LEN-1);
((CEdit *)(GetDlgItem(IDC_PASSWORD)))->LimitText(PASS_LEN-1);
((CEdit *)(GetDlgItem(IDC_PASSWORD2)))->LimitText(PASS_LEN-1);
m_LineRegWeb.SetHyperLinkUrl(TEXT("http://www.dc173.com"));
m_LineMainPage.SetHyperLinkUrl(TEXT("http://www.dc173.com"));
m_LinePassWord.SetHyperLinkUrl(TEXT("http://www.dc173.com"));
//加载头像
g_GlobalUnits.m_UserFaceRes->FillImageList(m_ImageList);
m_FaceSelect.SetImageList(&m_ImageList);
//插入头像
COMBOBOXEXITEM Item;
ZeroMemory(&Item,sizeof(Item));
Item.mask=CBEIF_IMAGE|CBEIF_SELECTEDIMAGE;
for (int i=g_GlobalUnits.m_UserFaceRes->GetFaceCount()-1;i>=0;i--)
{
Item.lParam=i;
Item.iImage=i;
Item.iSelectedImage=i;
m_FaceSelect.InsertItem(&Item);
}
//用户性别
BYTE cbGender[]={/*GENDER_NULL,*/GENDER_BOY,GENDER_GIRL};
LPCTSTR pszGender[]={/*TEXT("保密"),*/TEXT("男性"),TEXT("女性")};
CComboBox * pComboBox=(CComboBox *)GetDlgItem(IDC_GENDER);
//用户性别
for (int i=0;i<CountArray(cbGender);i++)
{
int nItem=pComboBox->InsertString(i,pszGender[i]);
pComboBox->SetItemData(nItem,cbGender[i]);
}
pComboBox->SetCurSel(0);
//设置头像
m_wFaceID=rand()%g_GlobalUnits.m_UserFaceRes->GetFaceCount();
m_FaceSelect.SetCurSel(m_wFaceID);
//获取目录
TCHAR szPath[MAX_PATH]=TEXT("");
GetCurrentDirectory(sizeof(szPath),szPath);
//读取配置
TCHAR szFileName[MAX_PATH]=TEXT("");
_snprintf(szFileName,sizeof(szFileName),TEXT("%s\\Spreader.ini"),szPath);
//读取推荐人
TCHAR szSpreader[NAME_LEN]=TEXT("");
GetPrivateProfileString(TEXT("SpreaderInfo"),TEXT("SpreaderName"),TEXT(""),szSpreader,CountArray(szSpreader),szFileName);
//设置名字
if (szSpreader[0]!=0)
{
SetDlgItemText(IDC_SPREADER,szSpreader);
((CEdit *)GetDlgItem(IDC_SPREADER))->SetReadOnly();
}
return TRUE;
}
开发者ID:firehot,项目名称:WH2008,代码行数:70,代码来源:DlgLogon.cpp
示例3: ReadVOIPConfig
void ReadVOIPConfig(void)
{
int i;
DJ_S8 sep[] = {","};
char buf[MAX_PREFIX][256] = {(0,0)};
char *p = NULL;
char *pBuf = NULL;
char chTmp[MAX_SEC]= {0};
char strTmp[256]= {0};
/*read sysconfig from PBXGetWay.ini*/
GetCurrentDirectory(MAX_FILE_NAME_LEN-32, cfg_IniName);
strcat(cfg_IniName, cfg_IniShortName);
GetPrivateProfileString("XMSCONFIG", "XMSIP", "192.168.10.132", cfg_ServerID.m_s8ServerIp, sizeof(cfg_ServerID.m_s8ServerIp), cfg_IniName);
cfg_ServerID.m_u32ServerPort = GetPrivateProfileInt("XMSCONFIG", "XMSPORT", 9000, cfg_IniName);
GetPrivateProfileString("XMSCONFIG","XMSUSER","",cfg_ServerID.m_s8UserName,sizeof(cfg_ServerID.m_s8UserName),cfg_IniName);
GetPrivateProfileString("XMSCONFIG","XMSPASSWORD","",cfg_ServerID.m_s8UserPwd,sizeof(cfg_ServerID.m_s8UserPwd),cfg_IniName);
g_u8UnitID = GetPrivateProfileInt("XMSCONFIG", "UNITID", 40, cfg_IniName);
/*read work moduleID form PBXGetWay.ini*/
GetPrivateProfileString("XMSCONFIG", "VOIPWORK","",cfg_chPartWorkModuleID, sizeof(cfg_chPartWorkModuleID), cfg_IniName);
strncpy(strTmp, cfg_chPartWorkModuleID, sizeof(strTmp));
SplitStr2Int(strTmp, ",", cfg_iVoipWorkMod);
GetPrivateProfileString("XMSCONFIG", "DIGTRKWORK","",cfg_chPartWorkModuleID, sizeof(cfg_chPartWorkModuleID), cfg_IniName);
strncpy(strTmp, cfg_chPartWorkModuleID, sizeof(strTmp));
SplitStr2Int(strTmp, ",", cfg_iDTrkWorkMod);
/*read ip pool from PBXGetWay.ini*/
cfg_IpPool = GetPrivateProfileInt("IPPOOL", "ITEMCNT", 1, cfg_IniName);
My_IpPoolItem(cfg_IpPool);
My_IpPool(cfg_IpPool);
for (i = 0; i < cfg_IpPool; i++)
{
if (pIpPool[i] != NULL)
GetPrivateProfileString("IPPOOL",pIpPoolItem[i] , "", (LPTSTR )pIpPool[i], 20, cfg_IniName);
}
pubSendRTPDTMFType = GetPrivateProfileInt("RTPDTMF","SENDTYPE",1,cfg_IniName);
pubDebug = GetPrivateProfileInt("XMSCONFIG","DEBUGON",0,cfg_IniName);
GetPrivateProfileString("OUTBONDVOIP","VOIP_ADDRESS","",pubOutVoipAddress,sizeof(pubOutVoipAddress),cfg_IniName);
pubOutVoipPort=GetPrivateProfileInt("OUTBONDVOIP","VOIP_PORT",5060,cfg_IniName);
//VOIP输出规则
pubVoipRule=GetPrivateProfileInt("VOIPRULE","OUTRULE",0,cfg_IniName);
//日志开关
bLog = GetPrivateProfileInt("LOG", "LOG", 0, cfg_IniName);
// GetPrivateProfileString("DIALRULE", "DIALRULE", "", CodeRule, sizeof(CodeRule), cfg_IniName);
cfg_routCnt = GetPrivateProfileInt("OUTBOUNDROUT", "ROUTCNT", 1, cfg_IniName);
if (cfg_routCnt > 0)
{
outRout = new OutBoundRout[cfg_routCnt+1];
memset(outRout, 0, sizeof(OutBoundRout) * (cfg_routCnt+1));
if (outRout != NULL)
{
char routStr[10] = {0};
char outRoutStr[512] = {0};
for (i = 1; i <= cfg_routCnt; i++)
{
sprintf(routStr, "ROUT[%d]", i);
GetPrivateProfileString("OUTBOUNDROUT", routStr ,"",outRoutStr,sizeof(OutBoundRout),cfg_IniName);
assignmentOutBoundRout(outRoutStr, &outRout[i]);
}
}
}
cfg_FaxMode = GetPrivateProfileInt("FAXMODE", "FaxMode", 0, cfg_IniName);
CreateDailRule(&pDailRuleHead);
return ;
}
开发者ID:liguyu,项目名称:cppexample,代码行数:83,代码来源:SysConfig.cpp
示例4: init
int init(int argc, char *argv[]) {
#if WIN32
char currentDirectory[MAX_PATH];
#endif
srand(time(0));
conInit();
loadDefaults();
timerInit();
if (!commandLineRead(argc, argv))
return 0;
if (view.quit)
return 0;
if (!state.dontExecuteDefaultScript)
configRead(findFile(CONFIG_FILE), 0);
#ifndef NO_GUI
if (!gfxInit())
return 1;
#endif
if (state.historyFrames % 2)
state.historyFrames--;
fpsInit();
#ifdef WIN32
// if we've gone this far, lets set the registry key even if it exists...
GetCurrentDirectory(MAX_PATH, currentDirectory);
setRegistryString(REGISTRY_NAME_PATH, currentDirectory);
#endif
#ifdef _OPENMP
conAdd(LHELP, "multi-threaded rendering: max threads = %d. Found %d processors.",
state.processFrameThreads, omp_get_num_procs());
#endif
#ifndef NO_STDIO_REDIRECT
// say hi (and keep stdout.txt alive on windows...)
if(!view.useStdout && !view.screenSaver)
printf("Welcome to %s.\n", GRAVIT_VERSION);
#endif
#ifdef WITHOUT_AGAR
conAdd(LHELP, "Welcome to Gravit!");
#ifndef NO_GUI
conAdd(LHELP, "Quick Start: Hit SPACE to start a new simulation!");
conAdd(LHELP, "Hold down a mouse button and move it around. Use A and Z keys, or the scroll wheel to zoom in and out.");
#endif
#endif
return 0;
}
开发者ID:bagobor,项目名称:gravit,代码行数:64,代码来源:main.c
示例5: VSRM_GetPath
int VSRM_GetPath(char *filepath, unsigned int size)
{
#ifdef _WIN32
int nSize = 0, i=0;
char szPath[MAX_PATH] = {0,};
GetModuleFileName(NULL, szPath, sizeof(szPath));
nSize = (int)strlen(szPath);
i=nSize;
for (i=nSize; i>0; i--)
{
if (szPath[i]=='\\')
{
szPath[i] = '\0';
break;
}
szPath[i] = '\0';
}
if (i < 1)
{
GetCurrentDirectory(MAX_PATH, szPath);
nSize = (int)strlen(szPath);
if ((unsigned int)nSize > size)
{
printf("VSRM_GetPath:: 传入路径长度太小. 无法复制当前路径.");
}
else
{
strncpy(filepath, szPath, nSize);
}
}
else
{
strncpy(filepath, szPath, nSize);
}
return 0;
#else
char path[260] = {0,};
int cnt = readlink("/proc/self/exe", path, sizeof(path));
if (cnt < 0 || cnt>=sizeof(path))
{
printf("readlink error..\n");
return -1;
}
int i=0;
for (i=cnt; i>=0; --i)
{
if (path[i] == '/')
{
path[i+1] = '\0';
break;
}
}
int nSize = (int)strlen(path);
if ((unsigned int)nSize > size)
{
_TRACE_ERR("VSRM_GetPath:: 传入路径长度太小. 无法复制当前路径.");
}
else
{
strncpy(filepath, path, nSize);
return 0;
}
return -1;
#endif
}
开发者ID:yunkaipx,项目名称:EasyDarwin,代码行数:70,代码来源:EasyRelayModule.cpp
示例6: while
//.........这里部分代码省略.........
nParentPID = mn_InsideParentPID;
}
else
{
PROCESSENTRY32 pi = {sizeof(pi)};
if (!GetProcessInfo(GetCurrentProcessId(), &pi) || !pi.th32ParentProcessID)
{
DisplayLastError(L"GetProcessInfo(GetCurrentProcessId()) failed");
m_InsideIntegration = ii_None;
mh_InsideParentWND = NULL;
goto wrap;
}
nParentPID = pi.th32ParentProcessID;
}
EnumWindows(EnumInsideFindParent, nParentPID);
if (!mh_InsideParentRoot)
{
int nBtn = MsgBox(L"Can't find appropriate parent window!\n\nContinue in normal mode?", MB_ICONSTOP|MB_YESNO|MB_DEFBUTTON2);
if (nBtn != IDYES)
{
mh_InsideParentWND = INSIDE_PARENT_NOT_FOUND;
return mh_InsideParentWND; // Закрыться!
}
// Продолжить в обычном режиме
m_InsideIntegration = ii_None;
mh_InsideParentWND = NULL;
goto wrap;
}
HWND hExistConEmu;
if ((hExistConEmu = InsideFindConEmu(mh_InsideParentRoot)) != NULL)
{
_ASSERTE(FALSE && "Continue to create tab in existing instance");
// Если в проводнике уже есть ConEmu - открыть в нем новую вкладку
gpSetCls->SingleInstanceShowHide = sih_None;
LPCWSTR pszCmdLine = GetCommandLine();
LPCWSTR pszCmd = StrStrI(pszCmdLine, L" /cmd ");
gpConEmu->RunSingleInstance(hExistConEmu, pszCmd ? (pszCmd + 6) : NULL);
mh_InsideParentWND = INSIDE_PARENT_NOT_FOUND;
return mh_InsideParentWND; // Закрыться!
}
// Теперь нужно найти дочерние окна
// 1. в которое будем внедряться
// 2. по которому будем позиционироваться
// 3. для синхронизации текущего пути
InsideFindShellView(mh_InsideParentRoot);
RepeatCheck:
if (!mh_InsideParentWND || (!mh_InsideParentRel && (m_InsideIntegration == ii_Explorer)))
{
wchar_t szAddMsg[128] = L"", szMsg[1024];
if (bFirstStep)
{
bFirstStep = false;
if (TurnExplorerTipPane(szAddMsg))
{
goto RepeatCheck;
}
}
//MessageBox(L"Can't find appropriate shell window!", MB_ICONSTOP);
_wsprintf(szMsg, SKIPLEN(countof(szMsg)) L"%sCan't find appropriate shell window!\nUnrecognized layout of the Explorer.\n\nContinue in normal mode?", szAddMsg);
int nBtn = MsgBox(szMsg, MB_ICONSTOP|MB_YESNO|MB_DEFBUTTON2);
if (nBtn != IDYES)
{
mh_InsideParentWND = INSIDE_PARENT_NOT_FOUND;
return mh_InsideParentWND; // Закрыться!
}
m_InsideIntegration = ii_None;
mh_InsideParentRoot = NULL;
mh_InsideParentWND = NULL;
goto wrap;
}
wrap:
if (!mh_InsideParentWND)
{
m_InsideIntegration = ii_None;
mh_InsideParentRoot = NULL;
}
else
{
GetWindowThreadProcessId(mh_InsideParentWND, &mn_InsideParentPID);
// Для мониторинга папки
GetCurrentDirectory(countof(ms_InsideParentPath), ms_InsideParentPath);
int nLen = lstrlen(ms_InsideParentPath);
if ((nLen > 3) && (ms_InsideParentPath[nLen-1] == L'\\'))
{
ms_InsideParentPath[nLen-1] = 0;
}
}
return mh_InsideParentWND;
}
开发者ID:G-VAR,项目名称:ConEmu,代码行数:101,代码来源:Inside.cpp
示例7: SetupDriverName
BOOLEAN
SetupDriverName(
_Inout_updates_bytes_all_(BufferLength) PCHAR DriverLocation,
_In_ ULONG BufferLength
)
{
HANDLE fileHandle;
DWORD driverLocLen = 0;
//
// Get the current directory.
//
driverLocLen = GetCurrentDirectory(BufferLength,
DriverLocation
);
if (driverLocLen == 0 || driverLocLen < BufferLength) {
printf("GetCurrentDirectory failed! Error = %d \n", (int)GetLastError());
return FALSE;
}
DriverLocation[ driverLocLen - 1 ] = '\0';
//
// Setup path name to driver file.
//
if (FAILED( StringCbCat(DriverLocation, BufferLength, "\\"DRIVER_NAME".sys") )) {
开发者ID:340211173,项目名称:Windows-driver-samples,代码行数:30,代码来源:install.c
示例8: getCurrentDirectory
void getCurrentDirectory(char* buffer, int buffer_size)
{
GetCurrentDirectory(buffer_size, buffer);
}
开发者ID:gunsafighter,项目名称:LumixEngine,代码行数:4,代码来源:platform_interface.cpp
示例9: assert
HRESULT AnimaApplication::CreateInstance( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
assert( AnimaApplication::mInstance == 0 );
HWND hWnd;
WNDCLASSEX winClass;
memset( &winClass, 0x0, sizeof(WNDCLASSEX) );
winClass.lpszClassName = "MY_WINDOWS_CLASS";
winClass.cbSize = sizeof(WNDCLASSEX);
winClass.style = CS_HREDRAW | CS_VREDRAW;
winClass.lpfnWndProc = WindowProc;
winClass.hInstance = hInstance;
winClass.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_DIRECTX_ICON);
winClass.hIconSm = LoadIcon(hInstance, (LPCTSTR)IDI_DIRECTX_ICON);
winClass.hCursor = LoadCursor(NULL, IDC_ARROW);
winClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
winClass.lpszMenuName = NULL;
winClass.cbClsExtra = 0;
winClass.cbWndExtra = 0;
if( !RegisterClassEx(&winClass) )
return E_FAIL;
hWnd = CreateWindowEx( NULL, "MY_WINDOWS_CLASS",
"DX9 Skinning Sample",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, NULL, NULL, hInstance, NULL );
if( hWnd == NULL )
return E_FAIL;
// register raw input device
RAWINPUTDEVICE Rid[2];
Rid[0].usUsagePage = HID_USAGE_PAGE_GENERIC;
Rid[0].usUsage = HID_USAGE_GENERIC_MOUSE;
Rid[0].dwFlags = RIDEV_INPUTSINK;
Rid[0].hwndTarget = hWnd;
// Keyboard
Rid[1].usUsagePage = HID_USAGE_PAGE_GENERIC;
Rid[1].usUsage = 6;
Rid[1].dwFlags = 0;
Rid[1].hwndTarget=hWnd;
RegisterRawInputDevices( Rid, 2, sizeof(Rid[0]) );
ShowWindow( hWnd, nCmdShow );
UpdateWindow( hWnd );
LPWSTR *szArglist;
int nArgs;
szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
TestEnvironment* testEnvironment = new TestEnvironment( nArgs, szArglist );
Math::Random::Init( testEnvironment->GetRandomSeed() );
AnimaApplication::mInstance = new AnimaApplication( winClass, hWnd );
char szCurrentDir[2048];
GetCurrentDirectory( sizeof(szCurrentDir), szCurrentDir );
strcat_s(szCurrentDir, "/../Shaders");
Instance()->mShadersWatcher = FindFirstChangeNotification( szCurrentDir, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
if (Instance()->mShadersWatcher == INVALID_HANDLE_VALUE)
DXTRACE_ERR("Unable to monitor shaders directory. Live shaders editing will not work", E_FAIL );
Instance()->mTestEnvironment = testEnvironment;
Instance()->mRenderContext = new RenderContext( hWnd, DISPLAY_WIDTH, DISPLAY_HEIGHT );
Instance()->mFramerateCounter = new FramerateCounter;
Instance()->mUserInterface = new UserInterface( mInstance->mRenderContext, mInstance->mFramerateCounter );
Instance()->mUserInterface->AcquireResources( Instance()->mRenderContext );
Instance()->mInput = new Input();
Instance()->mCamera = new Camera( *Instance()->mInput, *Instance()->mRenderContext );
// set up renderer
Instance()->mModel = new SkeletalModel( "..\\Models\\frank.dae" );
Instance()->mModel->Load( Instance()->mRenderContext );
Instance()->mModel->SetNext( Instance()->mUserInterface );
Instance()->mModel->PlayAnimation( 0, 0.25f );
Instance()->mModelRotationAngle = 0.f;
Instance()->mRotateModel = true;
Instance()->mFrameCounter = 0;
return S_OK;
}
开发者ID:devdetails,项目名称:anima-animation-sample,代码行数:89,代码来源:Cubes.cpp
示例10: GetCurrentDirectory
BOOL CTortoiseGitBlameApp::InitInstance()
{
{
DWORD len = GetCurrentDirectory(0, NULL);
if (len)
{
std::unique_ptr<TCHAR[]> originalCurrentDirectory(new TCHAR[len]);
if (GetCurrentDirectory(len, originalCurrentDirectory.get()))
{
sOrigCWD = originalCurrentDirectory.get();
sOrigCWD = CPathUtils::GetLongPathname(sOrigCWD);
}
}
}
//set the resource dll for the required language
CRegDWORD loc = CRegDWORD(_T("Software\\TortoiseGit\\LanguageID"), 1033);
long langId = loc;
CString langDll;
HINSTANCE hInst = NULL;
do
{
langDll.Format(_T("%sLanguages\\TortoiseGitBlame%ld.dll"), (LPCTSTR)CPathUtils::GetAppParentDirectory(), langId);
hInst = LoadLibrary(langDll);
CString sVer = _T(STRPRODUCTVER);
CString sFileVer = CPathUtils::GetVersionFromFile(langDll);
if (sFileVer.Compare(sVer)!=0)
{
FreeLibrary(hInst);
hInst = NULL;
}
if (hInst != NULL)
AfxSetResourceHandle(hInst);
else
{
DWORD lid = SUBLANGID(langId);
lid--;
if (lid > 0)
{
langId = MAKELANGID(PRIMARYLANGID(langId), lid);
}
else
langId = 0;
}
} while ((hInst == NULL) && (langId != 0));
TCHAR buf[6] = { 0 };
_tcscpy_s(buf, _T("en"));
langId = loc;
CString sHelppath;
sHelppath = this->m_pszHelpFilePath;
sHelppath = sHelppath.MakeLower();
sHelppath.Replace(_T(".chm"), _T("_en.chm"));
free((void*)m_pszHelpFilePath);
m_pszHelpFilePath=_tcsdup(sHelppath);
sHelppath = CPathUtils::GetAppParentDirectory() + _T("Languages\\TortoiseGitBlame_en.chm");
do
{
GetLocaleInfo(MAKELCID(langId, SORT_DEFAULT), LOCALE_SISO639LANGNAME, buf, _countof(buf));
CString sLang = _T("_");
sLang += buf;
sHelppath.Replace(_T("_en"), sLang);
if (PathFileExists(sHelppath))
{
free((void*)m_pszHelpFilePath);
m_pszHelpFilePath=_tcsdup(sHelppath);
break;
}
sHelppath.Replace(sLang, _T("_en"));
GetLocaleInfo(MAKELCID(langId, SORT_DEFAULT), LOCALE_SISO3166CTRYNAME, buf, _countof(buf));
sLang += _T("_");
sLang += buf;
sHelppath.Replace(_T("_en"), sLang);
if (PathFileExists(sHelppath))
{
free((void*)m_pszHelpFilePath);
m_pszHelpFilePath=_tcsdup(sHelppath);
break;
}
sHelppath.Replace(sLang, _T("_en"));
DWORD lid = SUBLANGID(langId);
lid--;
if (lid > 0)
{
langId = MAKELANGID(PRIMARYLANGID(langId), lid);
}
else
langId = 0;
} while (langId);
setlocale(LC_ALL, "");
// We need to explicitly set the thread locale to the system default one to avoid possible problems with saving files in its original codepage
// The problems occures when the language of OS differs from the regional settings
// See the details here: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100887
SetThreadLocale(LOCALE_SYSTEM_DEFAULT);
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
//.........这里部分代码省略.........
开发者ID:15375514460,项目名称:TortoiseGit,代码行数:101,代码来源:TortoiseGitBlame.cpp
示例11: Choose_Prediction
// Open function modified by Donald Graft as part of fix for dropped frames and random frame access.
int CMPEG2Decoder::Open(const char *path)
{
char buf[2048], *buf_p;
Choose_Prediction(this->fastMC);
char ID[80], PASS[80] = "DGIndexProjectFile16";
DWORD i, j, size, code, type, tff, rff, film, ntsc, gop, top, bottom, mapping;
int repeat_on, repeat_off, repeat_init;
int vob_id, cell_id;
__int64 position;
int HadI;
CMPEG2Decoder* out = this;
out->VF_File = fopen(path, "r");
if (fgets(ID, 79, out->VF_File)==NULL)
return 1;
if (strstr(ID, "DGIndexProjectFile") == NULL)
return 5;
if (strncmp(ID, PASS, 20))
return 2;
fscanf(out->VF_File, "%d\n", &File_Limit);
i = File_Limit;
while (i)
{
Infilename[File_Limit-i] = (char*)aligned_malloc(_MAX_PATH, 16);
fgets(Infilename[File_Limit-i], _MAX_PATH - 1, out->VF_File);
// Strip newline.
Infilename[File_Limit-i][strlen(Infilename[File_Limit-i])-1] = 0;
if (PathIsRelative(Infilename[File_Limit-i]))
{
char *p, d2v_stem[_MAX_PATH], open_path[_MAX_PATH];
if (PathIsRelative(path))
{
GetCurrentDirectory(_MAX_PATH, d2v_stem);
if (*(d2v_stem + strlen(d2v_stem) - 1) != '\\')
strcat(d2v_stem, "\\");
strcat(d2v_stem, path);
}
else
{
strcpy(d2v_stem, path);
}
p = d2v_stem + strlen(d2v_stem);
while (*p != '\\' && p != d2v_stem) p--;
if (p != d2v_stem)
{
p[1] = 0;
strcat(d2v_stem, Infilename[File_Limit-i]);
PathCanonicalize(open_path, d2v_stem);
if ((Infile[File_Limit-i] = _open(open_path, _O_RDONLY | _O_BINARY))==-1)
return 3;
}
else
{
// This should never happen because the code should guarantee that d2v_stem has a '\' character.
return 3;
}
}
else
{
if ((Infile[File_Limit-i] = _open(Infilename[File_Limit-i], _O_RDONLY | _O_BINARY))==-1)
return 3;
}
i--;
}
fscanf(out->VF_File, "\nStream_Type=%d\n", &SystemStream_Flag);
if (SystemStream_Flag == 2)
{
fscanf(out->VF_File, "MPEG2_Transport_PID=%x,%x,%x\n",
&MPEG2_Transport_VideoPID, &MPEG2_Transport_AudioPID, &MPEG2_Transport_PCRPID);
fscanf(out->VF_File, "Transport_Packet_Size=%d\n", &TransportPacketSize);
}
fscanf(out->VF_File, "MPEG_Type=%d\n", &mpeg_type);
fscanf(out->VF_File, "iDCT_Algorithm=%d\n", &IDCT_Flag);
switch (IDCT_Flag)
{
case IDCT_MMX:
idctFunc = MMX_IDCT;
break;
case IDCT_SSEMMX:
idctFunc = SSEMMX_IDCT;
if (!cpu.ssemmx)
{
IDCT_Flag = IDCT_MMX;
idctFunc = MMX_IDCT;
}
break;
case IDCT_FPU:
if (!fpuinit)
{
Initialize_FPU_IDCT();
//.........这里部分代码省略.........
开发者ID:ScandalCorp,项目名称:DGMPGDec,代码行数:101,代码来源:vfapidec.cpp
示例12: GetCurrentDirectory
/*
ANT_DIRECTORY_ITERATOR_RECURSIVE::FIRST()
-----------------------------------------
*/
ANT_directory_iterator_object *ANT_directory_iterator_recursive::first(ANT_directory_iterator_object *object)
{
file_list = handle_stack;
#ifdef _MSC_VER
file_list->first_time = TRUE;
GetCurrentDirectory(sizeof(file_list->path), file_list->path);
strcat(file_list->path, "/*.*");
return next(object);
#else
/* the modification below would not affected the original way of reading files */
long last_slash_idx = strlen(wildcard) - 1;
char *last_char = wildcard + last_slash_idx; // searching backward
char *slash = last_char;
char *got;
if (ANT_disk::is_directory(wildcard))
{
strcpy(path_buffer, wildcard);
strcpy(this->wildcard, "*");
}
else
{
while (slash != wildcard)
{
if(*slash == '/')
break;
slash--;
last_slash_idx--;
}
if (last_slash_idx <= 0) // the wildcard will be wildcard itself
{
if (getcwd(path_buffer, sizeof(path_buffer)) == NULL)
return NULL;
sprintf(path_buffer, "%s/", path_buffer); /* As we will later use this to mark dirs */
}
else // the wildcard will be after slash
{
strncpy(path_buffer, wildcard, last_slash_idx + 1);
path_buffer[last_slash_idx+1] = '\0';
if (last_char == slash)
strcpy(this->wildcard, "*");
else
{
char *wildcard_start = slash;
wildcard_start++;
long wildcard_len = last_char - wildcard_start + 1;
// trim the wildcard path string to contain only the wildcard characters
strncpy(this->wildcard, wildcard_start, wildcard_len);
this->wildcard[wildcard_len] = '\0';
}
}
}
if ((got = first_match_wildcard(path_buffer)) == NULL)
return NULL;
object->filename = strnew(got);
if (get_file)
object->file = ANT_disk::read_entire_file(object->filename, &object->length);
else
{
object->file = NULL;
object->length = 0;
}
return object;
#endif
}
开发者ID:crosslink,项目名称:Link-the-Wiki,代码行数:77,代码来源:directory_iterator_recursive.c
示例13: GetWorkingFolder
std::string GetWorkingFolder()
{
char sCurrentPath[MAX_PATH]={0};
GetCurrentDirectory(MAX_PATH,sCurrentPath);
return sCurrentPath;
}
开发者ID:theclai,项目名称:friking-shark,代码行数:6,代码来源:PlatformDependent.cpp
示例14: GetCurrentDirectory
char *WDL_ChooseFileForOpen2(HWND parent,
const char *text,
const char *initialdir,
const char *initialfile,
const char *extlist,
const char *defext,
bool preservecwd,
int allowmul,
const char *dlgid,
void *dlgProc,
#ifdef _WIN32
HINSTANCE hInstance
#else
struct SWELL_DialogResourceIndex *reshead
#endif
)
{
char olddir[2048];
GetCurrentDirectory(sizeof(olddir),olddir);
#ifdef _WIN32
#ifdef WDL_FILEBROWSE_WIN7VISTAMODE
if (allowmul!=1)
{
Win7FileDialog fd(text);
if(fd.inited())
{
//vista+ file open dialog
fd.addOptions(FOS_FILEMUSTEXIST|(allowmul?FOS_ALLOWMULTISELECT:0));
fd.setFilterList(extlist);
if (defext)
{
fd.setDefaultExtension(defext);
int i = 0;
const char *p = extlist;
while(*p)
{
if(*p) p+=strlen(p)+1;
if(!*p) break;
if(stristr(p, defext))
{
fd.setFileTypeIndex(i+1);
break;
}
i++;
p+=strlen(p)+1;
}
}
fd.setFolder(initialdir?initialdir:olddir, 0);
fd.setTemplate(hInstance, dlgid, (LPOFNHOOKPROC)dlgProc);
if(initialfile)
{
char temp[4096];
lstrcpyn_safe(temp,initialfile,sizeof(temp));
//check for folder name
if (WDL_remove_filepart(temp))
{
//folder found
fd.setFolder(temp, 0);
fd.setFilename(temp + strlen(temp) + 1);
}
else
fd.setFilename(temp);
}
if(fd.show(parent))
{
char *ret=NULL;
char temp[4096];
temp[0]=0;
//ifileopendialog saves the last folder automatically
if (!allowmul)
{
fd.getResult(temp, sizeof(temp)-1);
ret= temp[0] ? strdup(temp) : NULL;
}
else
{
char* p=NULL;
int totallen=0, cnt=fd.getResultCount();
if (cnt>1)
{
// sets an empty path as 1st returned string for multipath support
// (when selecting files among search results for ex.)
ret = strdup("");
totallen=1;
}
int i;
for (i=0; i<cnt; i++)
{
int len = fd.getResult(i, temp, sizeof(temp)-1);
p = len ? (char*)realloc(ret, totallen + len + ((i==cnt-1)?1:0)) : NULL;
if (p)
{
//.........这里部分代码省略.........
开发者ID:Nowhk,项目名称:wdl-ol,代码行数:101,代码来源:filebrowse.cpp
示例15: InitInstance
virtual BOOL InitInstance()
{
try{
SetRegistryKey(G_softwarename());
//boost process priority
SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS);
AfxInitRichEdit();
// AfxEnableControlContainer();
// AfxOleInit();
{//create documents folder
QString dir;
GetDocumentsDir(dir);dir+=_qstr("\\");dir+=G_softwarename();
CreateDirectory(dir,NULL);
}
CWinApp::InitInstance();
//for 3D Connexion
if (!AfxOleInit())
{
AfxMessageBox(L"OLE Init failed");
return FALSE;
}
AfxEnableControlContainer();
StrChar locstartupdir[600];
GetCurrentDirectory(599,locstartupdir);
startupdir=locstartupdir;
datadir=startupdir+_qstr("/Data");
{
QString storeddatadir;
QParamRead(PARAMLOCATION_REGISTRY,_qstr("DataDirectory"),storeddatadir);
if (qstrlen(storeddatadir)>0)
datadir=storeddatadir;
}
initlog();
addlog(TFormatString(_text("Data directory: ^1"),datadir));
scriptsdir=datadir;scriptsdir+=_qstr("\\Scripts");
texturesdir=datadir;texturesdir+=_qstr("\\textures");
addlog(_text("Fetching MAC address"));
GetMACaddress(MACaddr);
addlog(MACaddr);
G_3DCosmos().LoadSettings();
G_3DCosmos().init();
loadstockcyclorbits();
G_QXSys().startup();
addlog(_text("Loading languages"),+1);
QTranslate::Get().loadlanguages();
addlog(_text("Loaded languages"),-1);
addlog(_text("Creating source code window"),+1);
mainwin= new Tmainwin();
mainwin->createwindow(NULL,QString("Source code window"));
addlog(_text("Source code window created"),-1);
addlog(_text(""));
addlog(_text(""));
mainwin->ShowWindow(m_nCmdShow);
m_pMainWnd=mainwin;
}
catch(QError &err)
{
reporterror(err.G_content());
}
return TRUE;
}
开发者ID:pvaut,项目名称:Z-Flux,代码行数:80,代码来源:main.cpp
示例16: StartBurn
int _stdcall StartBurn (DWORD whichone,DWORD priority,DWORD mem_size)
{
command_line_string="\0";
dir_name_len=GetCurrentDirectory(100,(char*)current_dir);
_asm{
lea edi,current_dir
mov edx,dir_name_len
add edi,edx
mov ebx,whichone
mov eax,dword ptr[ebx]
push eax
dec eax
shl eax,3
mov esi,const_names
add esi,eax
mov ecx,7
rep movsb
add ecx,5
mov esi,exe
rep movsb
mov ecx,edx
add ecx,11
lea esi,current_dir
lea edi,burn_exe_name
rep movsb
mov byte ptr [edi],32
inc edi
pop ebx
cmp ebx,4
jl skip_cls
cmp ebx,5
jg skip_cls
//mov edi,command_line_string
mov edx,mem_size
mov eax,[edx]
add eax,65
mov byte ptr[edi],al
mov byte ptr[edi+1],0
skip_cls:
}
startup_info.cb=sizeof(STARTUPINFO);
startup_info.lpReserved=NULL;
startup_info.lpDesktop="";
startup_info.lpTitle="Burning!";
startup_info.lpReserved2=NULL;
startup_info.cbReserved2=0;
startup_info.dwFlags=STARTF_USESHOWWINDOW;
startup_info.wShowWindow=SW_MINIMIZE;
_asm{
mov ebx,priority
mov cl,byte ptr[ebx]
mov edx,0x20
dec ecx
shl edx,cl
mov eax,edx
and eax,0x100
shr eax,1
or edx,eax
mov flags,dl
}
/*
HIGH_PRIORITY_CLASS = 0x80
IDLE_PRIORITY_CLASS = 0x40
NORMAL_PRIORITY_CLASS = 0x20
REALTIME_PRIORITY_CLASS = 0x00
*/
CreateProcess(NULL,burn_exe_name,NULL,NULL,TRUE,flags,
NULL,NULL,&startup_info,&proc_info);
return(0);
}
int _stdcall IsStillBurning ()
{
return(0);
}
int _stdcall Kill_me ()
{
TerminateProcess(proc_info.hProcess,0);
return(0);
}
开发者ID:DecJude,项目名称:cpustress-sources,代码行数:98,代码来源:CPUburn.cpp
示例17: OpenProcess
LRESULT CMainFrame::EnterStation(WPARAM wPanel,LPARAM Mylparamp)
{
MI_SETTING* wMI = (MI_SETTING*)wPanel;
PROCESS_INFORMATION *pi = &(wMI->m_pi);
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION , FALSE, pi->dwProcessId);
if(hProcess == NULL)
{
//创建新的进程
//AfxMessageBox(_T("This Chanel is Close."));
int ret = MessageBox(_T("This Chanel is Close.ReCreate it."),_T("Chanel Error"),MB_YESNO);
if (ret ==IDYES)
{
wchar_t m_sCurrentPath[MAX_PATH];
GetCurrentDirectory(MAX_PATH,m_sCurrentPath);
CString ApplicationName;
ApplicationName=m_sCurrentPath;
ApplicationName+=_T("\\AOIEDIT.EXE");
STARTUPINFO si;
ZeroMemory(&si,sizeof(si));
si.cb = sizeof STARTUPINFO;
si.lpReserved=NULL;
si.lpDesktop=NULL;
si.lpTitle=NULL;
si.dwX=0;
si.dwY=0;
si.dwXSize=0;
si.dwYSize=0;
si.dwXCountChars=500;
si.dwYCountChars=500;
si.dwFlags=STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES;
si.wShowWindow=SW_HIDE;
//说明进程将以隐藏的方式在后台执行
si.cbReserved2=0;
si.lpReserved2=NULL;
si.hStdInput=stdin;
si.hStdOutput=stdout;
si.hStdError=stderr;
//C:\\WINDOWS\\SYSTEM32\\NOTEPAD.EXE")
CString cmd;
cmd.Format(_T("%s$%s$%d$"),wMI->szStationID,wMI->szProgramName,wMI->ch);
BOOL fRet=CreateProcess(ApplicationName,cmd.GetBuffer(),NULL,NULL,TRUE,NULL ,NULL,NULL,&si,&(wMI->m_pi));
if(fRet==false)
{
AfxMessageBox(_T("CreateProcess failed"));
//exit(1);
}
else
{
WaitForInputIdle(wMI->m_pi.hProcess,0);
CloseHandle(wMI->m_pi.hThread);
CloseHandle(wMI->m_pi.hProcess);
}
EnumThreadWindows(pi->dwThreadId,EnumThreadWndProc,MI_SHOW);
}
return 0;
}
EnumThreadWindows(pi->dwThreadId,EnumThreadWndProc,MI_SHOW);
::CloseHandle(hProcess);
return 0;
}
开发者ID:bblr001,项目名称:MVS,代码行数:64,代码来源:MainFrm.cpp
示例18: WinMain
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// Init any globals not in "struct g" that need it:
g_hInstance = hInstance;
InitializeCriticalSection(&g_CriticalRegExCache); // v1.0.45.04: Must be done early so that it's unconditional, so that DeleteCriticalSection() in the script destructor can also be unconditional (deleting when never initialized can crash, at least on Win 9x).
if (!GetCurrentDirectory(sizeof(g_WorkingDir), g_WorkingDir)) // Needed for the FileSelectFile() workaround.
*g_WorkingDir = '\0';
// Unlike the below, the above must not be Malloc'd because the contents can later change to something
// as large as MAX_PATH by means of the SetWorkingDir command.
g_WorkingDirOrig = SimpleHeap::Malloc(g_WorkingDir); // Needed by the Reload command.
// Set defaults, to be overridden by command line args we receive:
bool restart_mode = false;
#ifndef AUTOHOTKEYSC
#ifdef _DEBUG
//char *script_filespec = "C:\\Util\\AutoHotkey.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\GUI Demo.ahk";
char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\TEST SUITES\\MAIN.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\TEST SUITES\\Expressions.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\TEST SUITES\\Line Continuation.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\TEST SUITES\\DllCall.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\TEST SUITES\\RegExMatch & RegExReplace.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\TEST SUITES\\Win commands, all cases.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\TEST SUITES\\GUI Date.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\TEST SUITES\\GUI ListView.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\TEST SUITES\\OnMessage.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\TEST SUITES\\Send command.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Ref\\ImageSearch\\TEST SUITE\\MAIN.ahk";
//char *script_filespec = "C:\\A-Source\\AutoHotkey\\Test\\New Text Document.ahk";
#else
char *script_filespec = NULL; // Set default as "unspecified/omitted".
#endif
#endif
// The problem of some command line parameters such as /r being "reserved" is a design flaw (one that
// can't be fixed without breaking existing scripts). Fortunately, I think it affects only compiled
// scripts because running a script via AutoHotkey.exe should avoid treating anything after the
// filename as switches. This flaw probably occurred because when this part of the program was designed,
// there was no plan to have compiled scripts.
//
// Examine command line args. Rules:
// Any special flags (e.g. /force and /restart) must appear prior to the script filespec.
// The script filespec (if present) must be the first non-backslash arg.
// All args that appear after the filespec are considered to be parameters for the script
// and will be added as variables %1% %2% etc.
// The above rules effectively make it impossible to autostart AutoHotkey.ini with parameters
// unless the filename is explicitly given (shouldn't be an issue for 99.9% of people).
char var_name[32], *param; // Small size since only numbers will be used (e.g. %1%, %2%).
Var *var;
bool switch_processing_is_complete = false;
int script_param_num = 1;
for (int i = 1; i < __argc; ++i) //
|
请发表评论