|
VS is unable to locate the DirectShow library, probably Strmiids.lib
See my reply about setting up your build environment properly below
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
I have a project using DShow.It works well in VC6.
But when I convert it to VC2005,some errors occur.
Especially,a error like this:
1>d:\program files\microsoft visual studio .net\vc\platformsdk\include\winnt.h(222) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
I thinks there is some wrong in the configuration of the DirectX(9.0b).
Someone would tell me how to config it and correct such error?
Thanks
|
|
|
|
|
The error has been resloved.
But another error occured.
It said that could not find such external :
_CLSID_VideoInputDeviceCategory
error LNK2001: _CLSID_SystemDeviceEnum
error LNK2001: _IID_ICreateDevEnum
How to resolve it?
Thanks
|
|
|
|
|
When you install the DirectX SDK, it updates the directories in your VS2005 settings
automatically. You may need to do this manually.
The errors you show look DirectShow-related. For DirectShow, you need the platform SDK as well,
unless you're using an old DirectX SDK.
Regardless, in VS 2005, go to Tools/Options Projects and Solutions/VC++ Directories and make sure
you have valid paths to the directX and DirectShow include and library directories in the
appropriate lists. These should be added at the top so they are searched before the include/lib
directories in the VS installation.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
its a linker error you need to import a lib file to your project.
|
|
|
|
|
I need a browse dialog that can select files that have file paths longer then _MAX_PATH(260).
I've tried using GetOpenFileName, but I get a "File name is invalid" error when I select a file with a name longer then 260 (_MAX_PATH) characters.
Does anyone have a method or know of an existing library/project that can display a browse dialog which can select file names longer then 260 characters?
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
Windows not support files longer than 259.
TCHAR lpstrFilename[MAX_PATH]="";
OPENFILENAME ofn;
CString pathname;
CString filename;
int nTerm=0;
char stemp[255]={0};
TCHAR *p;
memset(&ofn,0,sizeof(OPENFILENAME));
ofn.lStructSize=sizeof(OPENFILENAME);
ofn.lpstrFile=lpstrFilename;
ofn.hwndOwner=m_hWnd;
ofn.nMaxFile=MAX_PATH*2;
ofn.lpstrFilter="All files(*.*)\0*.*\0";
if(WINVER >= 0x0400)
ofn.Flags=OFN_ALLOWMULTISELECT|OFN_EXPLORER|OFN_LONGNAMES|OFN_FILEMUSTEXIST;
else ofn.Flags=OFN_FILEMUSTEXIST;
ofn.lpstrTitle="GetOpenFileName";
ofn.nFilterIndex=0;
if(GetOpenFileName(&ofn))
{
pathname=lpstrFilename;
if(pathname.Right(1)!="\\")pathname+="\\";
for(int i=0;;i++)
{
if(lpstrFilename[i]==0)
{
nTerm++;
if(lpstrFilename[i+1]==0)
{
if(nTerm==1)
m_FileList.AddString(lpstrFilename);
break;
}
else
{
p=&(lpstrFilename[i+1]);
strcpy(stemp,p);
m_FileList.AddString(pathname+stemp);
}
}
}
}
|
|
|
|
|
Windows does support files longer then 259 characters, but you have to use a different syntax.
You have to use prefix "\\?\" with the file name, and use CreateFile.
For more information, look at CreateFile in MSDN.
I've already tried using GetOpenFileName, and I gave it required buffer size which was greater then MAX_PATH, but it still failed.
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
As KevinXli pointed out, make sure you pass large enough buffers and set the nMaxFilexxx members
of the OPENFILENAME struct accordingly.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
I've already tried using GetOpenFileName, and I gave it required buffer size which was greater then MAX_PATH, but it still failed.
Here's example code:
void TestLongFileBrowse()
{
TCHAR acPath[2048] = _T("\0");
OPENFILENAME ofn;
ZeroMemory(&ofn,sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.nMaxFile = 2048;
ofn.lpstrFile = acPath;
if (GetOpenFileName(&ofn)) {
printf("Path length: %d\n", _tcslen(ofn.lpstrFile));
printf("Path: %S\n", ofn.lpstrFile);
} else printf("CommDlgExtendedError(): %d\n");
}
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
Are you using the Unicode version of GetOpenFileName() ? Only the Unicode APIs support full paths longer than MAX_PATH
|
|
|
|
|
I've tried it with both UNICODE and ANSI.
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
Axter wrote: http://www.experts-exchange.com/Cplusplus
Non-existent page.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Axter wrote: I've tried using GetOpenFileName, but I get a "File name is invalid" error...
Which is different than FNERR_BUFFERTOOSMALL .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Will the following code get rid of any exception that might be thrown in a destructor
Session::~Session()
{ try {
logDestruction(this);
}
catch (...) { }
}
What are the scenarios in which a destructor is likely to riase an exception?
I have not seen in any prodution code with a destrcutor having a try/catch clause like above?
Comments
|
|
|
|
|
Throwing exceptions from constructors or destructors is a bad idea.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
That is what I thought. Isn't there something in the C++ standards about this?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
John Simmons / outlaw programmer wrote: Throwing exceptions from constructors or destructors is a bad idea
I don't think so.
BTW the OP snipped doesn't show an exception thrown from the contructor, it shows an exception handled inside it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
John Simmons / outlaw programmer wrote: Throwing exceptions from constructors or destructors is a bad idea.
Huh? ;)
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
It's just something I don't do.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I don't know about the ctors but for the dtors, reference Effective C++ Third Edition by Scott Meyers.
Specifically, "Item 8: Prevent exceptions from leaving destructors"
There seem to be many schools of thought on this type of issue so I'm not claiming this is the gospel truth but it's worth a read.
|
|
|
|
|
I wasn't necessarily agreeing or disagreeing with John's comment. I meant more to open up a
discussion.
As far as destructors goes, I agree. It makes no sense. Destructors aren't called explicitly
and when they are called, one would have to have complete knowledge of when. It could be during
the unwinding of another exception. It doesn't even make sense for something exceptional to
happen during destruction anyway.
For constructors, I don't throw exceptions either. Maybe I'm old-school, but I prefer a two-part
construction/initialization if error handling is necessary.
For constructors I don't agree that one shouldn't throw exceptions. I don't think exceptions
should be used for error handling, nor do I think they were meant to be used that way. IMO they
were meant for exceptional cirumstances - something that happens out of the programmer and user's
control that is unrecoverable.
For framework/library development, however, where a programmer may use a class the wrong way, it
may be ok. An exception during the design/implementation phase can be useful to me at that
stage, maybe providing enough info to show me immediately what I did wrong.
Just my rambling 2-cents
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Mark Salsbery wrote: Maybe I'm old-school, but I prefer a two-part
construction/initialization if error handling is necessary.
I must be old school, too, because that is along the lines of my thinking. I have never put exception handling in the constructors/destructors and I don't plan on doing so. That's my 2 cents
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Mark Salsbery wrote: Mark Salsbery
Microsoft MVP - Visual C++
congrats for becoming MVP!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
Thank you Alok!
Are you a Visual C++ MVP??
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|