打开计算机后应用程序自动打开时无法使用CStdioFile [英] CStdioFile can't be use while the app is automatic open after turning on of computer

查看:101
本文介绍了打开计算机后应用程序自动打开时无法使用CStdioFile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我发现有关CStdioFile&的问题运行。

我将我的应用程序注册到运行,这允许在打开计算机后自动实现应用程序。

它一直有效直到我添加文件读/写通过CStdioFile类......

当我打开电脑时,我的应用程序无法自动实现,但是run表中的寄存器仍然存在:(



我的代码段:



Hi, all!
I find a question about the CStdioFile & "Run".
I registered my application to "Run" which allowed the application implemented automatically after turning on the computer.
It works till I added the file read/write through the CStdioFile class...
My application cannot implement automatically when I turn on computer, but the register is still exist inside the "run" table:(

my snippet code:

BOOL CShutdownTurnOnEventDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	SetIcon(m_hIcon, TRUE);			
	SetIcon(m_hIcon, FALSE);		

	// TODO:  My code
    //register the computer to "Run"(If anyone interested, I can provide it:))
	AutoRunApp(true); 

	//Write file
	CStdioFile file;
	file.Open(_T("ActionLog.txt"), CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite);
	file.WriteString(_T("Computer Turn On\n"));
	file.Close();

	return TRUE;
}





有人会提供一些建议吗?



赞赏!!



Would anyone provides some suggestion?

Appreciated!!

推荐答案

MacCutchan,感谢您的回复,它给了我灵感!最后,我将ActionLog.txt的路径设置为C:\ProgramData,它可以工作!!再次感谢!!
MacCutchan, Thanks for your reply and it give me a inspiration! Finally, I set the path of the ActionLog.txt to C:\ProgramData and it works!! Thank you again!!


这篇关于打开计算机后应用程序自动打开时无法使用CStdioFile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆