|
Could someone please give me some guidance how to troubleshoot this?
I am using OpenCV1.1 ( required for VC6.0) and have added functions requiring another OpenCV library - cxcore.
The library compiles without error and builds cxcored110.dll.
My application also compiles without error but fails to start.
I get "application failed to initialize...0xC0150002)" first, then in debug this snippet
...
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'X:\XP\Program Files\OpenCV\bin\cv110.dll', no matching symbolic information found.
LDR: LdrpWalkImportDescriptor() failed to probe x:\xp\Program Files\OpenCV\bin\cv110.dll for its manifest, ntstatus 0xc0150002
First-chance exception in OpenCV_.exe (NTDLL.DLL): 0xC0150002: (no name).
The thread 0x4C0 has exited with code -1072365566 (0xC0150002).
The program 'Z:\0\0 OpenCV_\V 1\OpenCV_\Debug\OpenCV_.exe' has exited with code -1072365566 (0xC0150002).
I also get another pop up error message
Could not execute - path not found (Win32 error 3)
I have compiled all OpenCV libraries in debug and they should have suffix ..d, but I do not get why "failed to probe ...cv110.dll" , it should be cv110d.dll.
Please note that I switched from Win2000 to XP and now I am getting this error ( on new application build from scratch in XP).
Similar application runs just fine in Win2000.
Please refrain from suggesting to "upgrade" to OpenCV2.2 etc.)
Any constructive help will be as always appreciated.
Thanks for reading.
Vaclav
-- Modified Friday, March 4, 2011 11:26 AM
|
|
|
|
|
Hi,
I have a project which I originally built as an MFC extension DLL using Visual Studio 2008 App Wizard. I would now like to be able to build the same project as a static library but I don't know how to do this.
Ideally, I would like to retain both DLL and static builds.
Can anyone please advise?
thanks Tony
|
|
|
|
|
In the toolbars at the top there is the configuration boxes, 1 containing Debug or Release and the other containing Win32. Drop down either of those boxes and select Configuration Manager.
From the Configuration Manager you can add extra configurations to each individual project.
Select the configuration (debug or release) next to your MFC DLL project and select <new> from the dropdown. Call it Static Debug (or anything else if you feel like it) and then change Copy settings from: to Debug.
Repeat again for Release, calling it Static Release.
If you want to change the default configuration from DLL to static LIB then you can change the Configuration type for the MFC DLL in the Configuraion Manager that is to be build with the Debug and Release compiles.
Close the Configuration Manager.
Now right click on the MFC DLL project in the solution explorer and select Project Properties.
Change the configuration at the top of the properties box to Static Debug, then go to the General page from the list at the left. change Configuration Type to Static Library.
Do the same for Static Release.
You may need to change a few other things as well, there is probably a definition in the C++>Preprocessor page for DLL or something that you will need to get rid of.
|
|
|
|
|
Thanks Andrew, this is exactly the information I needed.
Tony
|
|
|
|
|
I have a recursive CountFiles function that I just can't get to work properly. It counts all files in all directories under a given root. But when I run it it allways returns somewhat less nr of files than expected. I suspect I've made a logical dive somewhere, but I just can't see it! The code below is supposed to return 13.301 files for my image library, but comes with 12.110... Can anybody see what my mistake is??
int CBackupImagesDlg::CountFiles(const CString strRoot)
{
int count=0;
CFileFind f;
CString strDir = strRoot;
strDir +=+ _T("\\*");
CString csNewPath(_T(""));
if(f.FindFile(LPCTSTR(strDir)))
{
while(f.FindNextFile() )
{
BOOL bDir=f.IsDirectory();
BOOL bDot=f.IsDots();
csNewPath = f.GetFilePath();
if (bDot)
continue;
if(bDir)
{
count=count + CountFiles(csNewPath);
}
else
{
count++;
}
}
}
f.Close();
return count;
}
modified on Thursday, March 3, 2011 12:56 PM
|
|
|
|
|
Hi!
You are missing 1 file per call to countfiles(). Simply move the while to the bottom of the loop to solve this.
if ( f.FindFile(LPCTSTR(strDir)))
{
do
{
...
}
while ( f.FindNextFile() );
}
Regards
Frank
|
|
|
|
|
MSDN states that you must call FindNextFile() at least once before calling any other member function. Are you saying that's no longer required?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Very strange indeed, MSDN[^] says certain functions require a FindNextFile being executed first, however as FindFile returns the first file, and FindNextFile finds the next ones, how could one execute those functions on the first file at all?
Anyway, the Win32 functions FindFirstFile, FindNextFile don't show such a remark, although here[^] is a note suggesting to call GetFileInformationByHandle() . So did the MFC guys ignore the note? or is it no longer relevant?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I've always coded my recursive CFileFind code as follows:
void ProcessFolder( LPCTSTR lpszPath )
{
CString strPath(lpszPath);
CFileFind fileFind;
if (strPath.Right(1) != _T('\\'))
strPath += _T('\\');
BOOL bFound = fileFind.FindFile(strPath + _T("*.*"));
while (bFound)
{
bFound = fileFind.FindNextFile();
if (fileFind.IsDirectory())
{
if (! fileFind.IsDots())
ProcessFolder(fileFind.GetFilePath());
}
else
{
}
}
} It's worked for years like that.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
you're right, I had to read once more to discover in MFC FindFile opens the search but does not return the first file, so FindNextFile is needed to find even the first file; this is different from how Win32 works, and IMO quite confusing (FindFile should have been named PrepareFileSearch or something similar).
This also means the first reply (by Frank) is wrong, and the wrong count hasn't been explained yet.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thank you, David! I tried your code, and it works like a charm!!
I'm still not certain what was wrong with the original function, but that investigation has to wait for another day! Anyhow, thank you all for your help, David in perticular!
|
|
|
|
|
Mr_Gbg wrote: The code below is supposed to return 13.301 files for my image library...
According to what?
Mr_Gbg wrote: strDir +=+ _T("\\*");
What is +=+ ?
Mr_Gbg wrote: if(f.FindFile(LPCTSTR(strDir)))
Why the superfluous cast?
Mr_Gbg wrote: The code below is supposed to return 13.301 files for my image library, but
comes with 12.110... Can anybody see what my mistake is??[Rose]
To make sure your recursion logic is sound, you might try moving count outside of CountFiles() , either by making it global or a member variable.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Good Questions, both of them! Sloppy programming I guess is the answer. Fixed now, thanks!
I've tried the whole global count variable thing as well, I still can't see a way around this... Grrr!
|
|
|
|
|
what is telling you there would be 13.301 files?
and how many folders are there?
some ideas:
- hidden files (your code would see them all, or throw an exception, so can't really be that);
- maybe folders also count as files in the tool that said 13301;
- there may be something fishy with empty extensions;
- there might be a difference between * and *.*;
- there is something peculiar (and silly) in the way Windows treats wildcards in extensions; I don't recall the details.
- I wouldn't be surprised if some of the above would depend on the actual file system (FAT, NTFS, ...).
I suggest you try your tool and your code on a pretty small set of files and folders, and experiment a bit.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hey
I am opening the Disk Defragmenter from inside my C++ WIN32 app using the ShellExecuteEx function.
Now i want to make sure that the Disk Defragmenter is a modal dialog, so that User is not able to click any part of my app.
I set one window to EnableWindow(FALSE), but there are other frame windows which can be clicked by User and then the Disk Defragmenter will go hiding or to back ground.
Is there one generic way of making the Disk Defragmenter a modal window so that nothing else on the back ground can be clicked?
From the ShellExecuteEx function, i can get the process handle to Disk Defragmenter.
Thanks in advance.
|
|
|
|
|
You can try blocking using the following
WaitForSingleObject(m_hProcess, INFINITE);
This won't make DD modal, it will just block your app until DD is finished.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
I think I know how to do so in .NET, and I assume unmanaged code could do similar things:
- give your app a modal form F, and make it sufficiently large to hold DD's main form;
- let that form F call DD and set DD's main form's parent to F. I assume this function[^] does that.
Now DD itself should behave as a modal dialog to your app.
I have a managed app (C#) that does similar things with e.g. MS Word.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
On my computer I have various network connection wi-fi , ethernet , USB . Now I want to know the mac address and IP address of the connection and the Active network i.e. which is enabled
Trioum
|
|
|
|
|
Have you experimented with GetAdaptersInfo() , GetInterfaceInfo() , GetAdaptersAddresses() , GetNumberOfInterfaces() , etc?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
I tried but only able to get MAC address. not understand to get IP address and not able to find active network .
Trioum
|
|
|
|
|
trioum wrote: not understand to get IP address and not able to find active network .
How about showing the code you used for this?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
DWORD destRedColor = 0;
DWORD destBlueColor = 0;
DWORD destGreenColor = 0;
DWORD destAlphaColor = 0;
DWORD SrcRedColor = 0;
DWORD SrcBlueColor = 0;
DWORD SrcGreenColor = 0;
DWORD SrcAlphaColor = 0;
int src_const_alpha = 0;
for ( int i = ( ( bm.bmWidth * bm.bmHeight ) - 1 ); i >= 0; --i )
{
COLORREF clrRef = ptPixels[i];
clrRef = COLORREF2RGB( clrRef );
DWORD redDest = GetRValue( clrRef );
DWORD greenDest = GetGValue( clrRef);
DWORD blueDest = GetBValue( clrRef);
BYTE *ptrAlphaDest = reinterpret_cast<BYTE*>( &clrRef );
DWORD alphaDest;
alphaDest = ptrAlphaDest[0];
DWORD redSrc = GetRValue( _cNewColor );
DWORD greensrc = GetGValue( _cNewColor );
DWORD blueSrc = GetBValue( _cNewColor );
BYTE *ptrAlphaSrc = reinterpret_cast<BYTE*>( &_cNewColor );
DWORD alphaSrc;
alphaSrc = ptrAlphaSrc[0];
src_const_alpha = int( m_intensity * 2.55 );
SrcRedColor = redSrc * src_const_alpha / 255.0;
SrcGreenColor = greensrc * src_const_alpha / 255.0;
SrcBlueColor = blueSrc * src_const_alpha / 255.0;
SrcAlphaColor = alphaSrc * src_const_alpha / 255.0;
destRedColor = SrcRedColor + ( 1 - SrcAlphaColor ) * redDest;
destGreenColor = SrcGreenColor + ( 1 - SrcAlphaColor ) * greenDest;
destBlueColor = SrcBlueColor + ( 1 - SrcAlphaColor ) * blueDest;
destAlphaColor = SrcAlphaColor + ( 1 - SrcAlphaColor ) * alphaDest;
ptPixels[i]
= (destAlphaColor << 24 ) |
(destRedColor << 16 ) |
(destGreenColor << 8 ) |
(destBlueColor);
}
|
|
|
|
|
I expect there is a question in here somewhere but I can't quite see it.
I must get a clever new signature for 2011.
|
|
|
|
|
Perhaps elaborate on what you are trying to do so that we can help you better.
Also note that Bitmap pictures pad each scanline to a multiple of 4 bytes.
If your bitmaps are 32bit, then you can ignore this.
That is if your picture is 5 pixels wide, each pixel taking 3 bytes (24 bits) then each scanline would be 5 * 3 = 15bytes wide.
Since that is not a multiple of 4 some bytes (1 in this case) are added to align the next scanline.
Note: The MSDN page for BITMAP[^] says they are WORD (2 byte) aligned, but from previous experience I have found that they are DWORD (4 byte) aligned.
This means that you must iterate through bm.bmHeight , and then for each iteration of that, iterate through bm.bmWidth .
BYTE *pBitmapData = (BYTE *)XXX;
int nBytesPerPixel = bm.bmBitsPixel / 8;
for (int y = 0; y < bm.bmHeight; ++y) {
for (int x = 0; x < bm.bmWidth; ++x) {
COLORREF clrRef = *((COLORREF *)pBitmapData);
pBitmapData += nBytesPerPixel;
}
pBitmapData += (nBytesPerPixel * bm.bmHeight + 3) & 3;
}
|
|
|
|
|
Actually there is one Picture In Picture( PIP ) module in the application. There is a shadow functionality is available with masking for the front layer. My mask( like heart shape ) is a bitmap file ( of 32 bpp ) which is put in the place of front layer( picture ). It's shadow looks like the same.
We can give shadow color of my choice as well( it is a provision ). Shadow will have selected color. So as it should be shown a transparent look I have used AlphaBlend() function to show transparent and semi-transparent pixels present in mask bitmap.
For the BLENDFUNCTION structure( m_blendfunc ) I given at Initialization
m_blendfunc.BlendOp = AC_SRC_OVER;
m_blendfunc.BlendFlags = 0;
m_blendfunc.SourceConstantAlpha = 0;
m_blendfunc.AlphaFormat = AC_SRC_ALPHA;
We can change the intensity of shadow as well( it's a provision ). It's rage from 0 to 100.
So that In OnPaint() I have changed the SCA value as per intenisty value.
m_blendfunc.SourceConstantAlpha = int( m_intensity * 2.55 );
As per the MSDN I have taken the red, green, blue and alpha value from Source( mask bitmap ) and mix up with destination colors ( of selected shadow color ) by this type of calculation
Src.Red = Src.Red * SourceConstantAlpha / 255.0;
Src.Green = Src.Green * SourceConstantAlpha / 255.0;
Src.Blue = Src.Blue * SourceConstantAlpha / 255.0;
Src.Alpha = Src.Alpha * SourceConstantAlpha / 255.0;
Dst.Red = Src.Red + (1 - Src.Alpha) * Dst.Red
Dst.Green = Src.Green + (1 - Src.Alpha) * Dst.Green
Dst.Blue = Src.Blue + (1 - Src.Alpha) * Dst.Blue
Dst.Alpha = Src.Alpha + (1 - Src.Alpha) * Dst.Alpha
The shadow is not getting proper it's look like some type of animation when I change the intesity.
Are I am making any mistake for taking source and destination colors or there is some mistake in calculation of new colors.
I have tried ur suggetsion of iterating through bitmap height & width but the result is same.
|
|
|
|