|
but in C#:
byte[] b; creates an instance for system.array
|
|
|
|
|
Hi all,
Recently, I am trying openCV to detect the face. All the methods work well. Now I want to compare all the methods at the same time, that means i have to use multi thread to archieve this purpose. Here is my code
In my form (Form1.h), i declared :
private: System::Threading::Thread^ trd;
and initialized the thread:
trd = gcnew Thread( gcnew ThreadStart( this->compareAlg));
and this is the compareAlg function:
private: static System::Void compareAlg ()
{
SCM *objSCM = new SCM ();
VAJ *objVAJ = new VAJ();
objVAJ ->showFaceDetect_Cam("Resource\\face.xml");
objSCM ->showFace_SkinDetect_Cam();
Thread::Sleep (0);
}
i also used a button to start the thread:
private: System::Void btnCompare_Click(System::Object^ sender, System::EventArgs^ e) {
trd->Start ();
}
The code compile well but the methods (showFaceDetect_Cam and showFace_SkinDetect) run sequently. What i want is the output of these methods appear at the same time on the screen. Can you suggest some advices, please? The thread code is found from http://msdn.microsoft.com/en-us/library/system.threading.thread.aspx
Thanks
|
|
|
|
|
bubuzzz wrote: The code compile well but the methods (showFaceDetect_Cam and showFace_SkinDetect) run sequently.
That's because you call them sequentially. If you want them to run
in parallel, you need a separate thread for each.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
How do I turn of command line in C++ managed forms projects from project configuration only, I already have created and compiled the project?
I am using VS 2010. But I guess that option should be the same as in VC++ 9.
Thanks,
Parth
|
|
|
|
|
I created the project ground up from empty one.
That's why I am having a command line window along with my form.
|
|
|
|
|
One more question:
How do I get the resource files to compile as separate satellite assemblies rather than in the exe itself.
Right now I have 5 language resources, all of which are getting compiled into the EXE itself.
I want them to be separate as they should be.
This resources are Form resources. I have named them appropriately with .en-US.resx, .de-De.resx etc names
|
|
|
|
|
What "command line" are you referring to?
If you mean a command window, then there shouldn't be one by default in a Forms app.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, I am talking about command window.
It is showing up. I created the app from scratch, so I guess there is some problem with configuration.
I did not create forms app using the VS wizard.
thanks,
parth
|
|
|
|
|
You need to change the subsystem to "windows". Read here[^] for more info
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hello,
I'm trying to create a dll in C++ with VS 2008 and creating an object MemoryStream.
So i write
MemoryStream *memStreamEncryptedData = new MemoryStream();
I included But it not work and i have a error message like this :
Error 1 error C2065: 'MemoryStream' : undeclared identifier
Error 2 error C2146: syntax error : missing ';' before identifier 'memStreamEncryptedData'
Error 3 error C2065: 'memStreamEncryptedData' : undeclared identifier
Error 4 error C2061: syntax error : identifier 'MemoryStream'
Please help me how can use it or if there is something else wich do the same work.
Thank you
|
|
|
|
|
khaliloenit wrote: Please help me how can use it or if there is something else wich do the same work.
Well you have to learn C++/CLI to use it or any other .NET classes. There are several introductory articles for C++/CLI here on CodeProject in the Articles or "CHAPTERS" part of the site.
|
|
|
|
|
So, have you please an example or some code to try it? I couldn't use C++/CLI and i had some problems with the included files.
Thank you
|
|
|
|
|
|
Well, there are several problems with the code if you are working in managed code. You should look up some tutorials.
You will have to include the namespace of Memorystream object(I have never used this class). Use gcnew instead of new and use ^ instead of *.
If you want to create unmanaged app, then I guess you have posted in wrong section.
Parth
|
|
|
|
|
Include this library System.IO.MemoryStream or System.IO
And have byte array (like: byte[] array )so to do
MemorySream^ Image = Gcnew MemoryStream(array);
Iam using Visual C++ Please.
modified on Thursday, August 20, 2009 9:17 AM
|
|
|
|
|
So I've been working on writing a C++/CLI wrapper around an unmanaged library. I've now got that working, but only on the command line, and I was hoping to get some quick help on how to get this all working in Visual Studio 2008.
I have the following files:
MyWrapper.dll
MyWrapper.dll.manifest
MyUnmanagedLibrary.lib
TestProgram.cs
MyWrapper.dll is compiled from C++/CLI code, MyUnmanagedLibrary.lib is compiled from unmanaged C code and TestProgram.cs is a C# program which calls functions defined in MyWrapper.dll
When I compile this code at the command line the following two commands are executed.
$ csc TestProgram.cs /r:MyWrapper.dll
$ mt /manifest MyWrapper.dll.manifest /outputresource:TestProgram.exe
Which produces TestProgram.exe
I'd like to know how I would go about importing this into, or creating, a Visual Studio 2008 project.
Any and all advice is very much appreciated.
|
|
|
|
|
Right click on the project and use Add reference. Browse MyWrapper.dll and you will get access to the types in that dll. If you have VS, I'd suggest to compile the C++/CLI application with it rather than command line. If you are doing this, you don't have to play with manifest tool manually. Visual studio does this for you.
Also are you not linking MyUnmanagedLibrary.lib to the MyWrapper.dll ?
|
|
|
|
|
I prefer to do things at the command line. I'm an emacs person to the core, and I really can't get on top of IDEs. I only need to know how to get my code working in Visual Studio for the tutorial I'm writing that will be packaged with the code.
Yes, MyUnmanagedLibrary.lib
|
|
|
|
|
I prefer to do things at the command line. I'm an emacs person to the core, and I really can't get on top of IDEs. I only need to know how to get my code working in Visual Studio for the tutorial I'm writing that will be packaged with the code.
Yes, MyUnmanagedLibrary.lib , is linked to MyWrapper.dll , but I assumed I didn't have to do anything special in Visual Studio, just drop the library file in the same folder as the dynamic link library. When I distribute the code to another machine, all I need to do to compile new C# applications that use MyWrapper.dll is direct the compiler at MyWrapper.dll using the /r:MyWrapper.dll flag. If there's something else I need to do, I'd love to hear.
Once again thank you very much, Navaneeth, you're quite the .NET guru.
|
|
|
|
|
Since the MyUnmanagedLibrary.lib is statically linked to MyWrapper.dll , you only need to distribute MyWrapper.dll .
Shadowsoal wrote: When I distribute the code to another machine, all I need to do to compile new C# applications that use MyWrapper.dll is direct the compiler at MyWrapper.dll using the /r:MyWrapper.dll flag
Yes.
Shadowsoal wrote: I prefer to do things at the command line. I'm an emacs person to the core,
I use EMACS at work for doing C++ on LINUX. It's a great editor. But when developing on top of .NET framework, I guess VS is more appropriate.
|
|
|
|
|
I'm trying to override an indexer in a Dictionary but I can't figure out what the syntax is (or even if this is possible). I tried overloading the operator but it simply complains that you cannot have both a default property indexer and an operator. There seems to be a lot of examples for C#, can anyone help me out?
Regards,
JP
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
Esmo2000 wrote: I'm trying to override an indexer in a Dictionary
Dictionary classes indexer is not virtual. So you can't override it. If you are looking for writing virtual indexer and overriding in a derived class, here you go.
ref class BaseClass
{
public:
property int Index[int]
{
virtual int get(int index)
{
Console::WriteLine("Base class get()");
return 0;
}
}
};
ref class DerivedClass : public BaseClass
{
public:
property int Index[int]
{
virtual int get(int index) override
{
Console::WriteLine("Derived class get()");
return 0;
}
}
};
int main()
{
BaseClass^ b = gcnew DerivedClass();
int a = b->Index[10];
return 0;
} Like in standard C++, implicit overriding is not supported in C++/CLI. You have to explicitly specify it with override keyword.
|
|
|
|
|
I am using Visual c++ 2005,
How can I read Excel Spreadsheet and write to it ?
I have expent much time to search how to do it.
Can you help me.
Urgent.
Thanks
|
|
|
|
|
Use Microsoft.Office.Interop.Excel
|
|
|
|