@@ -989,12 +989,17 @@ LRESULT CRecorderView::OnUserGeneric (UINT /*wParam*/, LONG /*lParam*/)
989
989
990
990
// I believed that savedir would always be GetProgPath().
991
991
// But this test below proved that that is not alway the case
992
+ // TRACE("## CRecorderView::OnUserGeneric() cProgramOpts.m_strSpecifiedDir=[%s]\n",cProgramOpts.m_strSpecifiedDir );
992
993
// TRACE("## CRecorderView::OnUserGeneric , savedir = [%s]\n", savedir );
993
994
// TRACE("## CRecorderView::OnUserGeneric , GetProgPath= [%s]\n", GetProgPath() );
994
995
// TRACE("## CRecorderView::OnUserGeneric , savedir = GetProgPath [%s]\n", (GetProgPath()==savedir) ? "EQUAL" : "DIFFERENT" );
995
996
996
997
if ((cProgramOpts.m_iRecordingMode == ModeAVI) && cProgramOpts.m_bAutoNaming ) {
997
- strTargetDir = GetProgPath ();
998
+
999
+ // Janhgm. Target dir where we want to get our final files is not always the location where we stored our Camstudio application..!
1000
+ // strTargetDir = GetProgPath();
1001
+ strTargetDir = GetTempFolder (cProgramOpts.m_iTempPathAccess , cProgramOpts.m_strSpecifiedDir );
1002
+
998
1003
// Use local copy of the timestamp string created when recording was started for autonaming.
999
1004
strTargetBareFileName.SetString ( cVideoOpts.m_cStartRecordingString .GetString () ); // "ccyymmdd-hhmm-ss" , Timestamp still used for default temp.avi output "temp-ccyymmdd-hhmm-ss.avi"
1000
1005
strTargetVideoExtension = " .avi" ;
@@ -1032,9 +1037,9 @@ LRESULT CRecorderView::OnUserGeneric (UINT /*wParam*/, LONG /*lParam*/)
1032
1037
// Create all the applicable targetfile names
1033
1038
strTargetVideoFile = strTargetDir + " \\ " + strTargetBareFileName + strTargetVideoExtension; // strTargetVideoFile is the same string as strNewFile in previuosly approach
1034
1039
strTargetAudioFile = strTargetDir + " \\ " + strTargetBareFileName + " .wav" ;
1035
- strTargetXnoteLogFile = strTargetDir + " \\ " + strTargetBareFileName + " .xnote. txt" ;
1040
+ strTargetXnoteLogFile = strTargetDir + " \\ " + strTargetBareFileName + " .txt" ;
1036
1041
1037
- // TRACE("## 2a # strTargetDir :[%s]\n", strTargetDir);
1042
+ // TRACE("## CRecorderView::OnUserGeneric 2a # strTargetDir :[%s]\n", strTargetDir);
1038
1043
// TRACE("## 2b # strTargetBareFileName :[%s]\n", strTargetBareFileName );
1039
1044
// TRACE("## 2c # strTargetVideoExtension :[%s]\n", strTargetVideoExtension );
1040
1045
// TRACE("## 3a # strTargetVideoFile :[%s]\n", strTargetVideoFile );
@@ -1302,10 +1307,17 @@ void CRecorderView::OnRecord()
1302
1307
// TODO, Possible memory leak, where is the delete operation of the new below done?
1303
1308
m_basicMsg = new CBasicMessage ();
1304
1309
m_basicMsg->Create (CBasicMessage::IDD);
1305
- m_basicMsg->SetText (_T (" Click on window to be captured." ));
1310
+ if ( cRegionOpts.m_iMouseCaptureMode == CAPTURE_WINDOW ) {
1311
+ m_basicMsg->SetText (_T (" Click on window to be captured." ));
1312
+ } else {
1313
+ m_basicMsg->SetText (_T (" Click on screen to be captured." ));
1314
+ }
1306
1315
m_basicMsg->ShowWindow (SW_SHOW);
1307
1316
// m_basicMsg.DoModal();
1308
1317
SetCapture ();
1318
+ // TRACE(_T("## CRecorderView::OnRecord CAPTURE_WINDOW / after / rc / T=%d, L=%d, B=%d, R=%d \n"), rc.top, rc.left, rc.bottom, rc.right );
1319
+ // TRACE(_T("## CRecorderView::OnRecord CAPTURE_WINDOW / after / MinX=%d, MinY=%d, MaxX=%d, MaxY=%d \n"), minxScreen, minyScreen, maxxScreen, maxyScreen );
1320
+
1309
1321
break ;
1310
1322
}
1311
1323
// TRACE(_T("## CRecorderView::OnRecord / after / rc / T=%d, L=%d, B=%d, R=%d \n"), rc.top, rc.left, rc.bottom, rc.right );
@@ -3717,7 +3729,7 @@ UINT CRecorderView::RecordVideo()
3717
3729
cVideoOpts.m_cStartRecordingString .SetString (csStartTime);
3718
3730
3719
3731
strTempVideoAviFilePath.Format (" %s\\ %s-%s.%s" , (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)csStartTime, " avi" );
3720
- // strTempXnoteLogFilePath.Format("%s\\%s-%s.%s", (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)csStartTime, "xnote. txt" );
3732
+ // strTempXnoteLogFilePath.Format("%s\\%s-%s.%s", (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)csStartTime, "txt" );
3721
3733
3722
3734
// TRACE("## CRecorderView::RecordAVIThread First Temp.Avi file=[%s]\n", strTempVideoAviFilePath.GetString() );
3723
3735
@@ -3762,8 +3774,29 @@ bool CRecorderView::RecordVideo(CRect rectFrame, int fps, const char *szVideoFil
3762
3774
3763
3775
sVideoOpts SaveVideoOpts = cVideoOpts;
3764
3776
3765
- GetDocument ()->FrameWidth (rectFrame.Width () + 1 );
3766
- GetDocument ()->FrameHeight (rectFrame.Height () + 1 );
3777
+ // And again CS is doing a recalculation to determine width and height.
3778
+ // If sizing is determined with SetCapture() the dimensions are different as we getwith CRect(Top,Left,Bottom,Right)
3779
+ // HIER_BEN_IK
3780
+ // TRACE(_T("## CRecorderView::RecordVideo / cRegionOpts.m_iMouseCaptureMode =%d\n"), cRegionOpts.m_iMouseCaptureMode );
3781
+ switch (cRegionOpts.m_iMouseCaptureMode )
3782
+ {
3783
+ case CAPTURE_WINDOW:
3784
+ case CAPTURE_FULLSCREEN:
3785
+ // For rects captured with SetCapture
3786
+ // TRACE(_T("## CRecorderView::RecordVideo / cRegionOpts.m_iMouseCaptureMode =%d (Do nothing) \n"), cRegionOpts.m_iMouseCaptureMode );
3787
+ GetDocument ()->FrameWidth (rectFrame.Width () );
3788
+ GetDocument ()->FrameHeight (rectFrame.Height () );
3789
+ break ;
3790
+ default :
3791
+ // For rects defined with Rect(top,left,bottom,right)
3792
+ // TRACE(_T("## CRecorderView::RecordVideo / cRegionOpts.m_iMouseCaptureMode =%d (increase width anf height with one) \n"), cRegionOpts.m_iMouseCaptureMode );
3793
+ GetDocument ()->FrameWidth (rectFrame.Width () + 1 );
3794
+ GetDocument ()->FrameHeight (rectFrame.Height () + 1 );
3795
+ break ;
3796
+ }
3797
+ // TRACE(_T("## CRecorderView::RecordVideo / rectFrame / T=%d, L=%d, B=%d, R=%d / W=%d, H=%d\n"), rectFrame.top, rectFrame.left, rectFrame.bottom, rectFrame.right , rectFrame.Width(), rectFrame.Height() );
3798
+ // TRACE(_T("## CRecorderView::RecordVideo / GetDocument / W=%d, H=%d\n"), GetDocument()->FrameWidth(), GetDocument()->FrameHeight() );
3799
+
3767
3800
nTotalBytesWrittenSoFar = 0 ;
3768
3801
3769
3802
// //////////////////////////////////////////////
@@ -3981,9 +4014,15 @@ bool CRecorderView::RecordVideo(CRect rectFrame, int fps, const char *szVideoFil
3981
4014
3982
4015
// ////////////////////////////////////////////
3983
4016
// Xnote or MotionDetection log file
4017
+ // Store some Camstudio info as well.
3984
4018
// ////////////////////////////////////////////
3985
4019
OpenStreamXnoteLogFile ();
3986
4020
4021
+ // Document which version and release of Camstudio is used.
4022
+ char cTmp[128 ] = " " ;
4023
+ sprintf ( cTmp, " <recorder><version>%s<\\ version><release>%s<\\ release><\\ recorder>\n " , CURRENT_VERSION_NUMBER, CURRENT_SVN_RELEASE_NUMBER );
4024
+ WriteLineToXnoteLogFile ( cTmp );
4025
+
3987
4026
if (cVideoOpts.m_iShiftType == AUDIOFIRST) {
3988
4027
Sleep (cVideoOpts.m_iTimeShift );
3989
4028
}
@@ -4320,7 +4359,7 @@ bool CRecorderView::RecordVideo(CRect rectFrame, int fps, const char *szVideoFil
4320
4359
}
4321
4360
4322
4361
// ////////////////////////////////////////////
4323
- // Close XNote or MotionDetection log file
4362
+ // Close Camstudio, XNote or MotionDetection log file
4324
4363
// ////////////////////////////////////////////
4325
4364
CloseStreamXnoteLogFile ();
4326
4365
@@ -4443,7 +4482,7 @@ bool CRecorderView::RunViewer(const CString& strNewFile)
4443
4482
} else if (cProgramOpts.m_iLaunchPlayer == CAM2_PLAYER) {
4444
4483
CString AppDir = GetProgPath ();
4445
4484
CString launchPath;
4446
- CString exefileName (" \\ Playplus .exe " );
4485
+ CString exefileName (" \\ Playerplus .exe " ); // Changed from Playplus.exe to Playerplus.exe
4447
4486
launchPath = AppDir + exefileName + strNewFile;
4448
4487
if (WinExec (launchPath,SW_SHOW) < HINSTANCE_ERROR) {
4449
4488
// MessageBox("Error launching avi player!","Note",MB_OK | MB_ICONEXCLAMATION);
@@ -5108,7 +5147,11 @@ void WriteLineToXnoteLogFile( char* pStr )
5108
5147
void GetTempXnoteLogPath ()
5109
5148
{
5110
5149
CString csTempFolder (GetTempFolder (cProgramOpts.m_iTempPathAccess , cProgramOpts.m_strSpecifiedDir ));
5111
- strTempXnoteLogFilePath.Format (" %s\\ %s-%s.%s" , (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)cVideoOpts.m_cStartRecordingString , " xnote.txt" );
5150
+ // TODO csTempFolder does not contain the temp folder but returns the target folder. Hence the function name is not correct..!
5151
+ // TRACE( _T("## RecorderView.cpp GetTempXnoteLogPath() / m_iTempPathAccess=[%d] m_strSpecifiedDir=[%s] csTempFolder=[%s]\n"),cProgramOpts.m_iTempPathAccess, cProgramOpts.m_strSpecifiedDir, csTempFolder );
5152
+
5153
+ strTempXnoteLogFilePath.Format (" %s\\ %s-%s.%s" , (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)cVideoOpts.m_cStartRecordingString , " txt" );
5154
+ // TRACE( _T("## GetTempXnoteLogPath() / strTempXnoteLogFilePath=[%s] \n"), strTempXnoteLogFilePath.GetString() );
5112
5155
5113
5156
// Test the validity of writing to this file (Using the old way with FILE instead of ofstream)
5114
5157
int fileverified = 0 ;
@@ -5128,7 +5171,7 @@ void GetTempXnoteLogPath()
5128
5171
sprintf (numstr," %d" ,randnum);
5129
5172
5130
5173
CString cnumstr (numstr);
5131
- strTempXnoteLogFilePath.Format (" %s\\ %s-%s-%s.%s" , (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)cVideoOpts.m_cStartRecordingString , cnumstr , " xnote. txt" );
5174
+ strTempXnoteLogFilePath.Format (" %s\\ %s-%s-%s.%s" , (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)cVideoOpts.m_cStartRecordingString , cnumstr , " txt" );
5132
5175
}
5133
5176
}
5134
5177
}
0 commit comments