Changeset 104 for trunk/MFCtooling/replay/LogParser.cpp
- Timestamp:
- 07/05/11 11:10:35 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MFCtooling/replay/LogParser.cpp
r32 r104 6 6 #include "WindowFinder.h" 7 7 8 LogParser::LogParser( void)8 LogParser::LogParser(_TCHAR* runCommand, unsigned int startupTime, bool useDefaultDelay) : runCommand(runCommand), startupTime(startupTime), useDefaultDelay(useDefaultDelay) 9 9 { 10 10 … … 28 28 std::wstring localName(pwchLocalName); 29 29 if( localName.compare(L"session")==0 ) { 30 // TODO 30 std::wstring sessionId = GetAttributeValue(pAttributes, L"id", L""); 31 std::wcout << L"================================================" << std::endl; 32 std::wcout << L"starting session " << sessionId << std::endl; 33 std::wcout << L"executing " << runCommand << std::endl; 34 PROCESS_INFORMATION pi; 35 STARTUPINFO si; 36 ZeroMemory(&pi, sizeof(pi)); 37 ZeroMemory(&si, sizeof(si)); 38 CreateProcess(NULL, runCommand, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); 39 hProcess = pi.hProcess; 40 CloseHandle(pi.hThread); 41 std::wcout << L"waiting " << startupTime << L" ms for application under test to intialize" << std::endl; 42 Sleep(startupTime); 43 std::wcout << L"replay starting..." << std::endl; 31 44 } 32 45 else if( localName.compare(L"msg")==0 ) { … … 76 89 std::wstring localName(pwchLocalName); 77 90 if( localName.compare(L"session")==0 ) { 78 // TODO 91 std::wcout << L"session completed" << std::endl; 92 BOOL retVal = TerminateProcess(hProcess, 0); 93 if( retVal!=0 ) { 94 std::wcout << L"application terminated" << std::endl; 95 } 96 CloseHandle(hProcess); 79 97 } 80 98 else if( localName.compare(L"msg")==0 ) { … … 129 147 130 148 void LogParser::sendMessage(HWND hwnd) { 131 std::wcout << L" Sending " << msgType << L" to " << hwnd << "L - LPARAM: " << lParam << L" - WPARAM: " << wParam << std::endl;149 std::wcout << L" Sending " << msgType << L" to " << hwnd << "L - LPARAM: " << lParam << L" - WPARAM: " << wParam << std::endl; 132 150 PostMessage(hwnd, msgType, wParam, lParam); 133 Sleep(defaultMsgDelay); 134 //Sleep(delay); 151 if( useDefaultDelay ) { 152 Sleep(defaultMsgDelay); 153 } else { 154 Sleep(delay); 155 } 135 156 }
Note: See TracChangeset
for help on using the changeset viewer.