|
Hi! I'm Rathakrishnan. I've developed an application using VC++ 2008 Express Edition. I compiles fine. When I ran this application, it showed an error, "This application has failed to start because MSVCR90D.dll not found". Similarly ,MSVCP90D.dll not found. When I search the system for this dll, I found the dll in the following paths.
(i) "C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456"
(ii)C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\Debug_NonRedist\x86\Microsoft.VC90.DebugCRT
Also I found a dll version with a nosxs_ prefix(i.e nosxs_msvcr90d.dll). Which version of the dll should I use? nosxs or ordinary? I've installed Service Pack3 for Windows. But it alos didn't work. How to resolve this problem?
|
|
|
|
|
Please ensure the above mentioned paths are mentioned in 'Path' environment variable.
akt
|
|
|
|
|
Value of PATH in the System variables is, "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem".
modified on Tuesday, June 10, 2008 12:32 AM
|
|
|
|
|
please add the above mentioned paths also.
akt
|
|
|
|
|
The MSVCP90D.dll is implemented as a side-by-side assemblies. That is the loader wll load the dll in the "C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456" folder if the manifest file of your application metions a dependecy with the above dll.
To confirm your manifest file is correct or not, got to the debug folder and in that folder you can find a file with extension ".manifest". Open it in a notepad and check the below line exists or not.
<assemblyIdentity type='win32' name='Microsoft.VC90.DebugCRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
Hope you have havent changed the project setting to prevent the automatic creation of manifest file.
|
|
|
|
|
My Project's Debug folder didn't contain a .manifest file. What to do to create this file?
|
|
|
|
|
take "project settings->Link->Manifest File" . Now in this option, specify the below items and rebuild.
GenerateManifest - Yes
Manifest File - $(IntDir)\$(TargetFileName).intermediate.manifest
Allow Isolation - Yes
|
|
|
|
|
Every thing u said was there in the Project settings. But .manifest file is not generated. Only files in the Debug folder are, "Incremental Linker File, Program Debug Database and exe". That's all. What to do?
|
|
|
|
|
There will be one more debug folder in the project folder. check that one...
|
|
|
|
|
No. There's only one Debug folder in the project. What to do?
|
|
|
|
|
I dont know whether this is a problem of express edition. How ever I am using professional edition and in that the folder structure is as follows
<projectname>
|
->DEBUG
->RELEASE
-><project name="">
|
->DEDUG ( this is the intermeidate directory and $(IntDir) macro will hold this path )
->RELEASE
->.cpp, .h etc</project></projectname>
Any way can u tell me what is the value of $(IntDir) MACRO in the project settings? You can find it from project settings..
|
|
|
|
|
It's $(TargetFileName).intermediate.manifest
|
|
|
|
|
then check the file in that location.
|
|
|
|
|
Hi all,
I have a BMP image which has to written into an AVI file.
The scenario is i will get a frame/BMP from the camera and i should save into an AVI file then i will get next frame after 1 minute and should add that also into the avi.
Please suggest how to do and plz give an eg. of how to write a bmp into AVI
Thanx in Advance....
Vidya
|
|
|
|
|
|
|
Hi,
I see two solutions:
1 - The best way ( C++ \ COM ):
- Use directshow
- Made a source filter that receive your bmp and inject it on graph.
=> You can add compression filter to reduce size.
2 - The old school way:
Avi file in uncompressed mode store frame as bitmap.
a - Write avi header with fake info (see avi spec for more detail).
b - Add each bitmap add the end of the file (see avi spec for more detail).
c - Rewrite the header.
-> You can found avi spec here:
- http://yaai.sourceforge.net/yaai/fileformat.html (fast).
- http://www.wotsit.org (full doc)
-> The file generated is very big because of no compression.
-> Take care to file size because of file system limitation.
-> To reduce size you can store jpeg instead of bmp (MJPEG)
-> Use jpeg6b lib (freeware & open source) to converter bmp -> jpeg.
Bye...
...
|
|
|
|
|
I am making a program that will take in a txt with 3 peices of info per line, group, program, parameters. The program needs to make a CreateProcess for each program in the first group, then wait until all programs have completed, then start on the next group. In the end, it prints out the results. The WaitForMultipleObjecst is not working and when I "GetLastError()" it comes back error:6 which I believe means an invalid handle. I have other problems with the code I know (timers always come back zero), but that's okay for now.
The Code:
#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
using namespace std;
class ProgramDetails
{
public:
int m_group;
string m_programToLaunch;
string m_programParams;
DWORD m_exitCode;
SYSTEMTIME m_kTime;
SYSTEMTIME m_uTime;
ProgramDetails(string group, string programToLaunch, string programParams);
ProgramDetails(int gp, string pL, string pP, DWORD eC, SYSTEMTIME kT, SYSTEMTIME uT);
ProgramDetails();
void Display () const;
};
//constructors
ProgramDetails::ProgramDetails(){};
ProgramDetails::ProgramDetails(string gp, string pL, string pP)
{
istringstream iss(gp);
iss >> m_group; // this should be tested
m_programToLaunch = pL;
m_programParams = pP;
}
ProgramDetails::ProgramDetails(int gp, string pL, string pP, DWORD eC, SYSTEMTIME kT, SYSTEMTIME uT)
{
m_group = gp;
m_programToLaunch = pL;
m_programParams = pP;
m_exitCode = eC;
m_kTime = kT;
m_uTime = uT;
}
// setting up one line of output
void ProgramDetails::Display() const
{
cout << m_group << "\t" << m_kTime.wHour << ":" << m_kTime.wMinute << ":" << m_kTime.wSecond << ":"<< m_kTime.wMilliseconds;
cout << setw(3) << "\t" << m_uTime.wHour << ":" << m_uTime.wMinute << ":" << m_uTime.wSecond << ":" << m_uTime.wMilliseconds;
cout << setw(4)<< "\t" << m_exitCode << "\t\t" << m_programToLaunch << "\t" << m_programParams<< endl;
}
// printing out the vector
void DisplayVector(const vector<ProgramDetails>& finishedList)
{
cout << "Group\t" << "KernelTime\t" << "UserTime\t" << "ExitCode\t" << "Program\t\t" << "Parameters" << endl;
cout << "-----\t" << "----------\t" << "--------\t" << "--------\t" << "-------\t\t" << "----------" << endl;
for(unsigned int i = 0; i < finishedList.size(); ++i)
{
finishedList[i].Display();
}
}
int main(int argc, char* argv[] )
{
//const char* str = argv[1]; // remember to uncomment this line and the ifstrea fileStream(str) line
std::vector<ProgramDetails> progList;
std::vector<ProgramDetails> finishedList;
string line;
ifstream fileStream ("input3.txt");// remember to comment out this line
//ifstream fileStream(str);
while(getline(fileStream, line))
{
istringstream iss(line);
string group;
string programToLaunch;
string programParameters;
getline(iss, group, ',');
getline(iss, programToLaunch, ',');
getline(iss, programParameters);
ProgramDetails details(group, programToLaunch, programParameters);
progList.push_back(details);
}
//cout << progList.size() << endl;
STARTUPINFO sinfo ={0};
sinfo.cb = sizeof(STARTUPINFO);
PROCESS_INFORMATION pi = {0};
//int n = progList.size();
HANDLE* myThreads = NULL;
//myThreads = new HANDLE[n];
//for(int k = 0; k < n; ++k)
//{
// myThreads[k] = 0;
//}
int currGroup = progList[0].m_group;
vector<HANDLE> vecHandles;
for(unsigned int i = 0; i < progList.size();++i)
{
if(progList[i].m_group == currGroup)
{
string str1 = progList[i].m_programToLaunch;
string str2 = progList[i].m_programParams;
//cout << str1 << "," << str2 << endl;
string command = str1 + " " + str2;
unsigned long const CP_MAX_COMMANDLINE = 32768;
try
{
char* commandLine = new char[CP_MAX_COMMANDLINE];
strncpy_s(commandLine, CP_MAX_COMMANDLINE, command.c_str(), command.size());
CreateProcessA(NULL, commandLine, NULL, NULL, false, 0, NULL, NULL, &sinfo, &pi);
}
catch(std::bad_alloc& )
{
wcerr << L"Insufficient Memeory to launch application" << endl;
return 1;
}
DWORD exitCode = 0;
GetExitCodeProcess(pi.hProcess, &exitCode);
FILETIME creationTime, exitTime, kernelTime, userTime;
int Timer = GetProcessTimes(pi.hProcess, &creationTime, &exitTime, &kernelTime, &userTime);
//cout << "Timer Says: " << Timer;
SYSTEMTIME cTime, eTime, kTime, uTime;
::FileTimeToSystemTime(&creationTime, &cTime);
::FileTimeToSystemTime(&exitTime, &eTime);
::FileTimeToSystemTime(&kernelTime, &kTime);
::FileTimeToSystemTime(&userTime, &uTime);
vecHandles.push_back(pi.hProcess);
ProgramDetails finDetails(currGroup, str1, str2, exitCode, kTime, uTime);
finishedList.push_back(finDetails);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
}
else
{
myThreads = new HANDLE[i];
for(unsigned int k = 0; k < i; ++k)
{
myThreads[k] = vecHandles[k];
}
DWORD dwResults = WaitForMultipleObjects(i, myThreads, TRUE ,INFINITE);
switch(dwResults) {
case WAIT_OBJECT_0:
cout << "Got the first one" << endl;
break;
case WAIT_OBJECT_0 + 1:
cout << "Got the second one to work" << endl;
break;
case WAIT_OBJECT_0 + 2:
cout << "Got WHEEEE!!! third one to work" << endl;
break;
default:
cout << "Error: " << GetLastError();
break;
}
Sleep(2000);
currGroup = progList[i].m_group;
--i;
}
if(i == progList.size()-1)
{
myThreads = new HANDLE[i];
for(unsigned int k = 0; k < i; ++k)
{
myThreads[k] = vecHandles[k];
}
DWORD dwResults = WaitForMultipleObjects(i, myThreads, TRUE ,INFINITE);
switch(dwResults) {
case WAIT_OBJECT_0:
cout << "Got the first one" << endl;
break;
case WAIT_OBJECT_0 + 1:
cout << "Got the second one to work" << endl;
break;
case WAIT_OBJECT_0 + 2:
cout << "Got WHEEEE!!! third one to work" << endl;
break;
default:
cout << "Error: " << GetLastError();
break;
}
}
}
delete [] myThreads;
myThreads = NULL;
DisplayVector(finishedList);
return 0;
}
|
|
|
|
|
You're putting the handles into a vector and then closing the handle.
vecHandles.push_back(pi.hProcess); <<<<<--------
ProgramDetails finDetails(currGroup, str1, str2, exitCode, kTime, uTime);
finishedList.push_back(finDetails);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess); <<<<<--------
(And why use a vector? You already know the number of items.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thanks for the quick response. I have remove both of these lines and still get the same results. Actually I don't know the number of items already. This program will have a txt file piped in that lists the programs and groupNumbers. I also did this with a dynamic array without the vector and got the same results. Did it with a static array to test it and voila... same results. Any other mistakes you can see in the code?
|
|
|
|
|
Check the return from CreateProcess to make sure it's being created.
Note that you should close PROCESS_INFORMATION::hThread right away and PROCESS_INFORMATION::hProcess before terminating the program.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Yes, the CreateProcess is being made, BOOL comes back as true, and both test programs launch. I have also put the code back in to close the thread and the process.
|
|
|
|
|
Make sure the process handle is closed AFTER the wait, else it will fail. I wrote the following small program that successfully waited on both handles. I guess I just can't see where your program is going wrong right now.
HANDLE handles[2];
STARTUPINFO sinfo;
memset(&sinfo, 0, sizeof(sinfo));
PROCESS_INFORMATION pi;
if (CreateProcessA(NULL, "C:\\Util\\ProcMon.exe", NULL, NULL, false, 0, NULL, NULL, &sinfo, &pi))
{
handles[0] = pi.hProcess;
}
CloseHandle(pi.hThread);
if (CreateProcessA(NULL, "C:\\Util\\ProcExp.exe", NULL, NULL, false, 0, NULL, NULL, &sinfo, &pi))
{
handles[1] = pi.hProcess;
}
CloseHandle(pi.hThread);
int result = WaitForMultipleObjects(2, handles, TRUE, INFINITE);
if (result < 0 || result > 1)
{
printf("Error: %d\n", result);
}
CloseHandle(handles[0]);
CloseHandle(handles[1]);
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thanks for all your help, it really is helping me out. I will look at your code and see what I can do.
|
|
|
|
|
Compiled and ran it. The way you've nested loops, particularly if(i == progList.size()-1) , made the program not do what it looks like it's supposed to do, but the [single] wait did work for me. You should be using vecHandles since what matters is the number of actual handles you actually have.
It also appears that you'd be leaking a myThreads pointer after you finish with the first wait and if you allocate memory for the second.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|