|
MSDN[^] says:
The dialog box must have been created with the OFN_EXPLORER style; otherwise, the method will fail with an assertion.
You need to create the dialog like
CFileDialog dialog(true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER);
|
|
|
|
|
Sorry! It doesn't work.
anhld
|
|
|
|
|
Perhaps i should have read the next line on that page[^].
"You can call this method only while the dialog box is being displayed. After the dialog box has been closed, this function will no longer work, and the method will fail with an assertion."
Not sure why it works on Windows 7, but you can instead use
strFileName = dialog.GetPathName();
strFileName = strFileName.Left(strFileName.ReverseFind(_T('\\')) + 1);
That is just example code, and you should add error checking into it to ensure there is a '\' character
|
|
|
|
|
Yeah! You're right! I should read MSDN carefully before asking this question. Anyway, thank you so much!
anhld
|
|
|
|
|
Hello debug experts.
<b></b>I'll fess-up before I get flamed by someone here..
I did posted this in OpenCV group without success.
<b></b>This is basic dll debugging process I do not know how to do.
I need to debug , step thru, OpenCV function and I just cannot figure out the mechanics.
I put cv dll (dsp) as main project and then I added my application to the workspace.
I set a break point at the cv function entry in my application and then execute the cv dll.
However, I just cannot step into the cv dll function to check the code progress.
F11 goes right over the function.
What bugs me is that I can step thru other OpenCV code (Haar training) without a problem!
Can it be done and dhow ??
What am I missing??
Using VC6.0 , both - dll and my app - are configured for debug. No compiler or linker errors.
My app is linked to the debug library of the cv dll.
The application runs, sort of - bogus Haar objects are being detected.
Thanks for you help, it is as always appreciated.
Cheers Vaclav
|
|
|
|
|
Try rebuilding the complete project (application and DLL) in Debug mode and see if that works.
I must get a clever new signature for 2011.
|
|
|
|
|
Richard,
found out that the function I am after is not in cv but in cvaux.
Added all relevant libraries and dependencies, rebuild all with success.
Still no go.
The question is - do I need to link the correct debug libraries?
Right now I have a mix of release and debug.
I'll do that next anyway.
What about the preprocessor's NDEBUG #define?
The functions I can step thru are in debug libaries and have the NDEBUG defined.
Thanks
Vaclav
|
|
|
|
|
Richard,
noticed difference between project settings - the one which works has a "Link" tab option and the one which does not work - cvaux has a tab "library". No Link.
They both have _DEBUG in various places , no more NDEBUG.
Vaclav
PS Here are the library links. Both are set for debug option and cvhaartraining lets me step thru and the cvaux (both cvaux or cvaud) won't do it.
#pragma comment(lib,"G:\\Program Files\\OpenCV\\lib\\cvhaartraining")
#pragma comment(lib,"G:\\Program Files\\OpenCV\\lib\\cvauxd")
Thanks for helping me. I am stuck!
|
|
|
|
|
I can only assume that the cvauxd library should be a Debug build. You need to recheck all the project settings (Compiler and Library tabs) to ensure that they are creating all the Debug information required.
I must get a clever new signature for 2011.
|
|
|
|
|
Yes, OpenCV designates debug libraies wiht suffix "d". Clever but I had to ask!
I think I need to check if these libraries are the ones I am actually linking to.
Right now I chaged to cxcored and getting this error which I totally do not know how to troubleshoot.
HEAP[Open....exe]: Invalid Address specified to RtlValidateHeap( 1e20000, b570450 )
What is realy strange this "cvhaartraining" dll compiles and builds a library without telleing me if it is debug or release.
I bet I am missing where it should go, but it works!
....
--------------------Configuration: cvhaartraining - Win32 Debug--------------------
Compiling...
cvboost.cpp
cvcommon.cpp
cvhaarclassifier.cpp
cvhaartraining.cpp
OpenMP not defined
cvsamples.cpp
Creating library...
--------------------Configuration: cv - Win32 Debug--------------------
.....
And that is the dll I can step thru!!!
And this is "normal" output
Generating Code...
Linking...
Creating library ../../lib/cvd.lib and object ../../lib/cvd.exp
I guess I'll go over all the options again!
Thanks for your input.
|
|
|
|
|
Vaclav_Sal wrote: builds a library without telleing me if it is debug or release.
That is fairly normal. It is up to you to select the appropriate configuration to build and ensure that all the options are set correctly. As this is a third party product that I have never worked with I cannot make any better suggestions.
I must get a clever new signature for 2011.
|
|
|
|
|
1. Make sure the debug configuration is selected. Debugging works in Release mode but not as good
2. Check which library you are linking against. It should be cvd.lib (the main part is that you are lining against XXXd.lib for the debug libraries
3. Check the project properties for the DLLs to make sure debugging information is getting generated. I don't know where this is in VC6, but in VC9 is is Project Properties>Linker>Debugging>Generate Debug Info
4. Insert a breakpoint early in your code for the .exe you are testing it with. the first line of main() would be a good place
5. Check the loaded modules (in VC9 it is Debug>Windows>Modules ) and make sure the right versions of the DLLs are loaded in (XXXd.dll )
|
|
|
|
|
Hi all
I have two view ,Opengl and Live Video (Which convert live video data to image and show on CDC).
The 3D image draw in Opengl with different 3D point and draw in video CDC(convert 3D to 2D point).
Here My problem is how to draw 3D image in 2D live video CDC?.It should be show like OPengl with different shade,color,Blending and all feature which is provide by OpenGL.
AnyOne suggest the way for achive this thing.
Thanks
|
|
|
|
|
My application (32 bit) starts next process instance of itself. In new process I need to start debugging so I'm using __asm int 3; It worked good in WinXP/VS2008, it stopped the app and gave me selection whether start new VS instance or use existing VS instance to debug. I've switched to Win 7 64 bit and it does not work anymore. It offers nothing, app just hangs for some time, then exits, I cannot even attach debugger to the process manually. How can I solve this?
Thank you.
In VS options, the "Jst-in-time" I have all options active (managed,native,script)
modified on Friday, January 21, 2011 5:46 AM
|
|
|
|
|
try
#include "CrtDbg.h"
_CrtDbgBreak();
|
|
|
|
|
the same result
|
|
|
|
|
_CrtDbgBreak() is a valid function under Win64. Perhaps it expects a debugger to be attached.
Perhaps you could use something like:
while (!IsDebuggerPresent()) {
Sleep(1000);
}
It is quite a hack up, but if it is just for testing it doesn't really matter.
|
|
|
|
|
Thank you for tip.
while (!IsDebuggerPresent()) {
Sleep(1000);
}
__asm int 3;
works, but now I have to attach debugger to correct process manually It would me more convenient if it would work like before so other ideas are still welcome
|
|
|
|
|
Perhaps it is something wrong with your JIT settings.
I just ran
#include <Windows.h>
#include <CrtDbg.h>
int main() {
OutputDebugString(TEXT("Hello\n"));
_CrtDbgBreak();
OutputDebugString(TEXT("World\n"));
return 0;
}
Compiled in debug mode on VS 2008. It came up with the crashed message, 1 of the options was to debug the program.
This gave me an idea, if _CrtDbgBreak() doesn't work for you, just crash you program and attach the JIT then.
Once attached you can just drag the instruction pointer (the yellow arrow to the left of the code) to the next line and hit continue.
Something simple to crash your program would be
char *p = NULL;
*p = 0;
|
|
|
|
|
Andrew Brock wrote: char *p = NULL;
*p = 0; //Write 0 to an invalid address
also this does not work. It does nothing, but after some time standard windows crashed program dialog opens and offers me to send crash data to microsoft.
|
|
|
|
|
plz somebody tell me whats the problem with this little example? i get an error
Error 1 error LNK2019: unresolved external symbol "public: __thiscall B::B(void)" (??0B@@QAE@XZ) referenced in function _main
#include <iostream>
using namespace std;
class A {
public:
A();
~A();
};
class B : public A {
public:
B();
~B();
};
int main() {
A *p;
p = new B;
// ...
delete p;
}
|
|
|
|
|
If you declare the default constructors A::A() and B::B() then you must provide an implementation as well (the same applies to the destructors A::~A() B::~B() ).
Hence you either write:
class A
{
};
class B : public A
{
};
or
class A
{
public:
A(){}
~A(){}
};
class B : public A
{
public:
B(){}
~B(){}
};
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
can u just google it first.
Величие не Бога может быть недооценена.
|
|
|
|
|
if it is a resource dialog, just set the type to bitmap and select the image in the properties window.
If it is a coded control you need to pass in the BS_BITMAP flag with the flags to CreateWindow and then send the button a message with BM_SETIMAGE and a loaded HBITMAP or HICON with preferably PostMessage otherwise SendMessage
|
|
|
|