|
Then you can only use it as an "ActiveX" control, through the COM Callable Wrapper - CCW. There is MFC sample in the MSDN demonstrating using the WinForm as MFC View.
You can also read this MSDNMag artcle, which has a sample putting .NET control in MFC dialog.
You can use the Type Library Exporter tool (tlbexp.exe) to generate the type libraries or the other tools and classes provided by the .NET Framework.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Hi!
I'd like to use localized resources in my managed C++ project. The System that is available in e.g. C# (resx - localized satelite dlls) is exactly what I am looking for, so it would be nice to use it. However, vc++.net 2002 does not seem to support this natively. I can only add the "good ol'" .rc files.
How can I use resx files in my project? Do I have to write them manually, precompile them with resgen and then link them manually to my mc++ code?
Will VC++.net 2003 support resx-files natively?
Thanks in advance.
Andre (VizOne) Loker
|
|
|
|
|
VizOne wrote:
Will VC++.net 2003 support resx-files natively?
To tell the truth , the only serious MC++ project I am working on is only in VS.NET 2003. Due to problems in the VS.NET 2002, I moved quickly to the VS.NET 2003 before management could even decide
I cannot remember dealing with resource files under the VS.NET 2002, but with VS.NET 2003 the support is there even though not as straight as C# where you set it in the File Property Page. You have to use the Project property page to visually set the /ASSEMBLYRESOURCE flag for the file. You will get a list box, where you can list all the resource files.
In fact, you cannot do a complete .NET project without the commandline tools, whether in MC++ or C# - do not know if this will improve. So, make maximum use of the pre/post build process to set this once for your project where needed. Check the C# QuickStart tutorial on resources, it uses the commandline tools through the pre/post build options.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Hi Paul!
I solved my problems and (as you said) use the command line tools.
1. I add the resource files (resx and txt for strings) and the localized versions to the project.
2. For the neutral resource, I set
resgen $(InputFileName) $(InputName).resources
as the commandline and "$(InputName).resources" as the output file
3. For all localized resources I set the command line to e.g.
resgen $(InputFileName) $(InputName).resources
al /v:1.0.* /target:lib /embed:$(InputName).resources /culture:de /out:$(OutDir)/de/$(TargetName).resources.dll
and $(OutDir)/de/$(TargetName).resources.dll as the output file to create the satelite assemblies.
4. In the project settings Linker->Input->Embed managed resource file I add strings.resource
That's it, works sweetly for me, although it is not as easy as it could be. Why does MS stick to .rc/.res in VC++.net 2002?
- Andre
|
|
|
|
|
I have a managed C++ (windows.forms) application that needs to start unmanaged threads (real-time hardware stuff) that will run in the background until the application is terminated.
The interface commuication between the managed UI and the
unmanaged threads needs to be both ways with pointer references.
Is this possible? And how would it be done?
Thank you,
Della
|
|
|
|
|
Lets start this way, have ever programmed background thread in C++?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Yes, I have programmed background threads.
What's your point?
Thanks,
Della.
|
|
|
|
|
farnster wrote:
What's your point?
You should then have tried it with the case you are refering to and report any problem.
If you have never programmed a thread then you will need a startup code but having done it I see no reason why you should not try it first.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Paul, I bought the book "Advanced .NET Remoting" because of your review on Amazon, I'm only beginning to read it, and I just let you known that if I don't like the book, my reason to return it , will be that a fellow CPian played a trick on me
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
I stand by my review and will write a new book for you if this does not make the grade
Anyway, welcome to the .NET Remoting - be prepared to answer my questions on the forum on .NET Remoting since I will be starting a project on this next 2 weeks.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
I want to write an MFC application that can be turned into the icon on task bar (like Norton Antivirus).
If it is Windows 9x/2000, the icon will appear next to the clocks at the right bottom of screen.
Thank you for your concern!
|
|
|
|
|
Please use the Visual C++ forum. This is MC++ forum.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
|
Can't remember
Anyway, we are trying to make sure any MC++ programmer here is satisfied and we cannot include non-MC++ stuff
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
If you see that it means that object could come from several sources. Use the required namespace to get the one you want. Read the build message (not the TODO) to get detailed information.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Hi, we're going to develop an ANSI compliant C++ module and portablility is a major concern: We want to deploy this module to MS/UNIX/LINUX. We need a good ANSI compliant XML parser that supports at least DOM/XPATH/dynamic navigation.. any suggestion?
I presume I can load XML file via stdio and perform any subsequent manipulation using this XML parser..?
.NET offers very good tool but it's not portable.
norm
|
|
|
|
|
Hello Norm,
Please use the Visual C++ forum, this forum is mainly MC++.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
I thought of doing that actually. But I don't see how an ANSI C++ question is a better fit under VC++ category than under MC++.
Anyway...
Norm
|
|
|
|
|
You have everything having to do with C++ there, but with .NET here - that is the difference.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Hi,
i like to save received data files (.pmj) from a scanner serially numbered on my disc (001.pmj, 002.pmj, ...) I know i must work with a loop and a variable, but it is too tricky for me.
Untill now i do the following:
// Save the file...
if (r)
{
CString fileName = "e:\\data\\001.pmj";
SavePMJStream(fileName);
}
Thanks for help, Mark
|
|
|
|
|
Please this is MC++ forum, try the Visual C++ forum for MFC stuff.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
BTW in advance I apologize for this super lengthy post! Any help would be GREATLY apreciated. I am aware that my codeing is a bit messed up but thats ok.. for now.. the main thing is that I figure out how to put all this to use properly while understanding why it works.
Ok everybody I hope I am not stepping out of line in posting this question on this forum. I'm a new member of the code project and I am new to programing in general, have started programming in c++ but my knowledge is and will be fairly limmited for a while.. I am trying to put to use what I have learned in a simple program but have come across a problem. Mind you it could just be that my brain is completely fried from digesting 300 pages of the book I am studying to learn c++ in 3 days (OUCH!)
the program is as follows In brackets () I have put my questions hope this doesn't confuse anybody.. dont worry I havent use () in the program itself yet.
<br />
#include <stdio.h><br />
#include <iostream.h><br />
#include <string.h><br />
int main(int nNumberOfArgs, char* pzargs[])<br />
{
Int response;<br />
cout << "Enter a question or comment to which jeeney may respond:';<br />
cin >> response;<br />
//Calculate statement or question input to result a<br />
//coresponding statement or question to output
(The problem I have is here.. I need to create an "if" statement example
"if" input responce is "Hello Jeeney" "then" Jeeney would respond useing
another sentence or question such as Ex: "Hello, how are you today?"
I'm not entirely sure how to do this as I seem to be learning ONLY useing numbers. I somewhat understand HOW it should work but am not very sure of the codeing used.)
( int factor; this part is confuseing as well. I am working with character strings rather then integers so wouldn't this be more apropriately put as "char factor" ? and that doesn't seem to make any sence either.
( factor = )
return 0;<br />
}
|
|
|
|
|
Hello Caden,
To get a better response you will need to property phase your question.
Anyway, this forum is for MC++, try using the Visual C++ forum.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
OOPS! Go figure I'd mess up ... sorry!
|
|
|
|
|
Hi!
I am working on a function that returns an object initilized with some
specific values, like
<br />
__value struct MyStruct<br />
{<br />
public:<br />
MyStruct(int a, int b, int c)<br />
: a(in_a), b(in_b), c(in_c) {}<br />
<br />
static MyStruct One() { return MyStruct(1,1,1); }<br />
<br />
private:<br />
int a, b, c;<br />
};<br />
This is compiled to the following MSIL-code:
<br />
.method public static valuetype Cpp.MyStruct<br />
One() cil managed<br />
{<br />
.maxstack 4<br />
.locals (valuetype Cpp.MyStruct V_0)<br />
IL_0000: ldloca.s V_0<br />
IL_0002: initobj Cpp.MyStruct<br />
IL_0008: ldloca.s V_0<br />
IL_000a: ldc.i4.1<br />
IL_000b: ldc.i4.1<br />
IL_000c: ldc.i4.1<br />
IL_000d: call instance void Cpp.MyStruct::.ctor(int32,<br />
int32,<br />
int32)<br />
IL_0012: ldloca.s V_0<br />
IL_0014: ldobj Cpp.MyStruct<br />
IL_0019: ret<br />
}
I looked at IL_0002 and found a initobj. I tried to avoid initializing of
the members, so I defined an empty default c'tor:
MyStruct() {}
However, now my IL code expanded to:
<br />
.method public static valuetype Cpp.MyStruct<br />
One() cil managed<br />
{<br />
.maxstack 4<br />
.locals (valuetype Cpp.MyStruct V_0,<br />
valuetype Cpp.MyStruct V_1)<br />
IL_0000: ldloca.s V_1<br />
IL_0002: initobj Cpp.MyStruct<br />
IL_0008: ldloca.s V_1<br />
IL_000a: ldc.i4.1<br />
IL_000b: ldc.i4.1<br />
IL_000c: ldc.i4.1<br />
IL_000d: call instance void Cpp.MyStruct::.ctor(int32,<br />
int32,<br />
int32)<br />
IL_0012: ldloca.s V_0<br />
IL_0014: ldloca.s V_1<br />
IL_0016: cpobj Cpp.MyStruct<br />
IL_001b: ldloca.s V_0<br />
IL_001d: ldobj Cpp.MyStruct<br />
IL_0022: ret<br />
}
Which contains a cpobj and two local instances of MyStruct and therefore
seems to be even worse.
I wrote a similar struct in C# to compare compilation output:
<br />
public struct MyStruct<br />
{<br />
public MyStruct(int in_a, int in_b, int in_c)<br />
{<br />
a = in_a;<br />
b = in_b;<br />
c = in_c;<br />
}<br />
public static MyStruct One() { return new MyStruct(1, 1, 1); }<br />
int a, b, c;<br />
};<br />
This compiled to the following code:
<br />
.method public hidebysig static valuetype CSharp.MyStruct<br />
One() cil managed<br />
{<br />
.maxstack 8<br />
IL_0000: ldc.i4.1<br />
IL_0001: ldc.i4.1<br />
IL_0002: ldc.i4.1<br />
IL_0003: newobj instance void CSharp.MyStruct::.ctor(int32,<br />
int32,<br />
int32)<br />
IL_0008: ret<br />
}
Now I tested execution time and I am not really suprised: the the C++ struct
without default c'tor was about 30% slower than the C# version. The C++
Version with default c'tor even was 70% slower than the C# version.
Now I have two questions: first, is the C# version creating the object on
the heap or the stack?
And: how can I make the C++ version compile to the faster version?
Thanks in advance!
- Andre
|
|
|
|