示例#1
0
文件: path.c 项目: cexer/wke
LPCWSTR GetProgramPath(LPWSTR buffer, size_t bufferSize, LPCWSTR relatedPath)
{
    WCHAR dir[MAX_PATH + 1] = { 0 };
    GetProgramDirectory(dir, MAX_PATH);
    _snwprintf(buffer, bufferSize, L"%s%s", dir, relatedPath);
    return buffer;
}
示例#2
0
void IM_HistoryWriter::CreateToday_sFile(LPCTSTR szUserName)
{
	CString fileName;
	CTime today;

	today = CTime::GetCurrentTime();
	char buf[MAX_PATH];
	GetProgramDirectory(buf);
/*	fileName = today.Format("%y-%m-%d");
	fileName += "\\";
	fileName += szUserName;
	fileName += ".imh";*/
	// 建立文件名
	fileName.Format("%shistory\\%s\\%s.imh", buf, today.Format("%y-%m-%d"), szUserName);
//	AfxMessageBox(fileName);
	CFileFind fFind;

	if (fFind.FindFile(fileName))
	{
	//	AfxMessageBox("File existed.");
		m_file.Open(fileName, CFile::modeWrite|CFile::shareDenyNone, NULL);
		m_file.SeekToEnd();
	}
	else
	{
	//	AfxMessageBox("File don't existed.");
		m_file.Open(fileName, CFile::modeCreate|CFile::modeWrite|CFile::shareDenyNone, NULL);
	}
}
示例#3
0
文件: xsvr.cpp 项目: Crawping/XEIM
BOOL CXsvrApp::InitInstance()
{
	OleInitialize(NULL);
	AfxEnableControlContainer();

	InitializeCriticalSection(& g_cs);

	CFileFind fFind;
	CStdioFile file;
	char buf[MAX_PATH];
	GetProgramDirectory(buf);
	CString fileName;
	fileName.Format("%s%s", buf, "sys.log");
	if (! fFind.FindFile(fileName))
	{
	//	AfxMessageBox("File don't existed.");
		file.Open(fileName, CFile::modeCreate|CFile::modeWrite|CFile::shareDenyNone, NULL);
	}

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	CXsvrDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
示例#4
0
//===========================================================================
int APIENTRY WinMain (HINSTANCE passinstance,
					  HINSTANCE previnstance,
					  LPSTR     lpCmdLine,
					  int       nCmdShow)
{
#ifdef CPUDEBUG
	char nomearq[MAX_PATH];
#endif

	char imagefilename[MAX_PATH];

	// DO ONE-TIME INITIALIZATION
	instance = passinstance;

	// Initialize COM
	CoInitialize( NULL );

	GdiSetBatchLimit(512);
	GetProgramDirectory();
	RegisterExtensions();
	FrameRegisterClass();
	Inicializar1();

	strcpy(imagefilename, progdir);
	strcat(imagefilename, NOMEARQTKDOS);

	if (lpCmdLine[0] != '\0')
	{
		CharLowerBuff(&lpCmdLine[strlen(lpCmdLine)-3],3);
		strcpy(imagefilename, lpCmdLine);
	}

#ifdef CPUDEBUG
	strcpy(nomearq, progdir);
	strcat(nomearq, "debugCPU.txt");
	DeleteFile(nomearq);
	arquivocpu = fopen(nomearq, "wb");
#endif


	do
	{
		// DO INITIALIZATION THAT MUST BE REPEATED FOR A RESTART
		restart = 0;
		mode    = MODE_LOGO;
		LoadConfiguration();
		DebugInitialize();
		JoyInitialize();
		MemInitialize();
		VideoInitialize();
		Timer_InitTimer();

		FrameCreateWindow();
		MemAtualizaSlotAux();

		if (imagefilename[0] != '\0')
		{
			DiskInsert(0, imagefilename, FALSE, FALSE);
			imagefilename[0] = '\0';
		}

		// ENTER THE MAIN MESSAGE LOOP
		EnterMessageLoop();
	}
	while (restart);

#ifdef CPUDEBUG
	//CloseHandle(arquivocpu);
	fclose(arquivocpu);
#endif

	// Release COM
	CoUninitialize();

	return 0;
}