|
Any chance, anyone has code to maintain the format:
(###) ###-####
for a CEdit? There are some masked edit controls, but I
cant get them to blend in with what I have. Im just looking
for something small to let me maintain the above phone
format.
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle Brina
|
|
|
|
|
i'm not sure about CEdit. That looks like an MFC control. You might have better luck in the C/C++/MFC forum.[^]
if you're looking for a C++/CLI way of doing this you could use a MaskedTextBox.[^] If you must use a CEdit control you could use .net to validate the text entered using a Regular Expression.[^]
Hope this helps,
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
// IN C++ /clr
// BOXED VALUE TYPE ON GC HEAP
int ^ gc_i = gcnew int;
// WHAT EXACTLY IS THE STORAGE TYPE FOR THIS int ?
int * i = new int;
*i = 5;
// PRESUMABLY ON THE UNMANAGED HEAP, BUT HOW CAN THIS HAPPEN FOR INT?
// DOESN'T INT ALWAYS MAP TO System.Int32?
// OR DOES THE COMPILER GIVE US A NATIVE INT INSTEAD, TO PLACE ON THE UNMANGED HEAP?
|
|
|
|
|
Will5801 wrote: // WHAT EXACTLY IS THE STORAGE TYPE FOR THIS int ?
That's a native int on the CRT heap.
Will5801 wrote: // PRESUMABLY ON THE UNMANAGED HEAP, BUT HOW CAN THIS HAPPEN FOR INT?
// DOESN'T INT ALWAYS MAP TO System.Int32?
You're using int in the native context (*, new) so the compiler
can infer what int to use....the native one in this case.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
// IN A CLR C++ PROJECT
// AN ARRAY. SHOWS IN LOCALS WINDOW AS TYPE array
array<byte> ^ a = gcnew array<BYTE>(10);
// A BYTE ARRAY. SHOWS IN LOCALS WINDOW LIKE A NATIVE ARRAY
BYTE b[10];
b[0] = 5;
// A POINTER
LPBYTE p = &b[0];
The pointer is to be passed to api as a buffer to fill
The question: is b actually a ref system.array instance and
therefore pin_ptr should be used instead? If so this must
cause some subtle bugs?
|
|
|
|
|
Will5801 wrote: The question: is b actually a ref system.array instance
No.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
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
|
|
|
|