If you want to use dynamic_cast, it seems that you must use a template instead of a generic. That is by replacing generic<class WindowType> where WindowType : MyWindowBase with template<class WindowType>
This does make some sense since generics are run-time and templates are compile-time and dynamic_cast need to know T type at compile time.
Every body know this question answer please send me the reply?
In visual studio 6.0 .Debugging operation performed press F10 it takes to the next step into host information(means takes assembley) in windows 7 64-bit environment.
As far as I know, safe_cast is more like dynamic_cast (which you can also use on managed types). safe_cast and dynamic_cast are for casting between handles to polymorphic types within a class hierarchy (much as you would do in C++ with pointers). The difference is that safe_cast throws an exception when the cast is not possible rather than returning nullptr. This means you don't have to write code that checks to see whether the cast succeded, just handle the exception, meaning potentially less cluttered code.
Just wondering how and if you can pre-select multiple files as the dialog opens? Do you place a list of them in the Initial Filename area, as I've tried this already the answer seems to be, No.
Am I missing something?
Basically I'd like a user to be able to select multiple files, I then do some checking of the filenames and if one of these checks comes back false, I want to reload this dialog with the files that the user had previously selected.
I've a file called test.ini. The contents of this file is:
I've to read the file and assign each value after the equal(=) sign to three System::String^ variables. I don't want the text preceding the equal sign(i.e PreviousCheck =,LID = and PWD = all I don't want). How to do this in C++/CLI?
I used the following code to get a line from the file(and then I will split it into parts).
System::IO::StreamReader reader("test.ini", System::IO::FileMode::Open);
System::String^ line = reader.ReadLine();
But I got the following error:
error C2664: 'System::IO::StreamReader::StreamReader(System::IO::Stream ^,bool)' : cannot convert parameter 1 from 'const char ' to 'System::IO::Stream ^'
Reason: cannot convert from 'const char *' to 'System::IO::Stream ^'
No user-defined-conversion operator available, or
Cannot convert an unmanaged type to a managed type
I think this is a subtle one; you have provided a char* in parameter 1 of the constructor, but no such constructor exists. You need to use a String object as the path parameter for the compiler to select the correct constructor. You can find all the gory details here[^] on MSDN.
The constructor and destructor are defined but empty. I even DONT use this class anywhere, just define it.
And I try it. Everything is compiled without warnings, but when ClearCanvas attempts to load plugin - it fails.
"first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll"
Well, next point. If I comment the inheritance from interface it works!
In my project, I have few classes that are inherited exactly the same (I mean IDisposable->ISomeSimpleInterface->SomeClass) and they work!
What a hell!?
Here is the code for IRenderingSurface interface, it's in C#. Nothing interesting:
Does IJW is enabled automatically (so just need to write our native code) or we need to do something to make it works..??
In other mean, what is the advantage of IJW over using pragma directive or the other way around??
IJW is just a term they used back in 2003/2004 to talk about how the managed-unmanaged transitions and marshaling were smoothly handled for you by the compiler. No one uses the term these days, and instead people just say C++ interop to refer to anything where mixed-mode code comes into play.
#pragma unmanaged is a pre-compiler directive that tells the compiler that any code in that block must be compiled natively (meaning no msil at all). It's mostly used to ensure that frequently used code is compiled for better performance (which usually implies native code generation).