|
I want to deliver my DLL which was written in VC++.net. I use CStringT extensively. When I try to run my DLL in a C# application in another machine which did not install Visual Studio.NET . It give exception problem.
How do I pack the ATLMFC in VC7.0?
I do not want it to be statically link because I had tested before and it give me problem saving some GDI32 functions is already in some of my other lib. Also I do not want my app to be bulky.
So, I would prefer dynamic bind. Where and how to get MFC7.0 redistributable?
Thank you
|
|
|
|
|
My answer to my own question (in case someone interested)
You will need this DLL
- msvcr70d.DLL
and other .NET redistributables
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi All
i am wrapping up a MFC custom control in Managed C++ by subclassing it.
I am having enum type in MFC which i want to expose to outside via Wrapper class.So i defined equivalent enum type in managed C++.How can i type cast from ManagedC++ to unmanaged type?Is there any otherway to avoid this redefinition?
Thanks in advance
Krishna
|
|
|
|
|
How about this:
namespace oldCpp
{
enum { myfirst = 0, mysecond };
}
public __value enum newMCpp { myfirst = oldCpp::myfirst, mysecond = oldCpp::mysecond };
Then you could do something like:
int oc = (int)newMCpp::myfirst;
Untested, but should hopefully get you started.
[edit] wrapped first enum in namespace. Learned this in another post in the VC forum. [/edit]
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
I noticed my program was leaking memory at a huge rate -- went in and did some debugging and it seemed pretty clear that managed memory was never being deallocated. After fretting for a while over why this should be so, I added a call System::GC::Collect() under certain circumstances. With this call in, there is no leak. Why shouldn't the gc have been collecting on its own -- isn't this the whole point of garbage collection?
READIN writin rhythmetic
|
|
|
|
|
The garbage collector in .NET is a lazy collector. What this means is that it will not collect until it needs to. Only when memory is getting low, will it collect.
Check the MSDN for more info.
-Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Thanks, I guess I just wanted it do happen a bit before it would by default -- are there any caveats I should be aware of afa using GC::Collect()?
READIN writin rhythmetic
|
|
|
|
|
Only a possible performance hit. How often are you calling a collect? A collection is very intensive operation since it has to go through all the objects in your process and see if they are to be collected.
-Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Yeah, I figured it was an expensive call -- I am doing it quite infrequently, immediately after a call which I know results in a whole lot of objects being eligible for reclamation -- is that the correct terminology? I want to just say "I deleted a lot of stuff" but obviously I did not delete it, I just removed references.
READIN writin rhythmetic
|
|
|
|
|
Jeremy Osner wrote:
eligible for reclamation
I think the phrase would be "eligible for collection", because "reclamation" to me sounds like you are recycling the objects themselves instead of just the memory. But I am sure that anyone you typed with or spoke to would readily understand .
-Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Thanks for the help, Nathan!
READIN writin rhythmetic
|
|
|
|
|
Hey,
First of all, I would like to say with only being a member of this site for a little while, I have found it very useful. I am pretty much a newbie in programming and don't know much about compiler and linker errors. I get this error when trying to compile.
playSound.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (playSound): (0x02000005).
LINK : fatal error LNK1255: link failed because of metadata errors
Anybody know what this is? If you need source code I can give it. I am sure I included all the includes and libraries. Thanks.
Also does anybody know how to convert a String to a LPCWSTR? I hadn't heard of LPCWSTR before but appears to be some other kind of string.
example:
String * str = S"Hello";<br />
<br />
somefunction(MyConvertedString)
Double thanks.
|
|
|
|
|
I can't answer your linker question but an LPCWSTR is a char pointer -- see the thread lower on this page regarding PtrToStringChars().
READIN writin rhythmetic
|
|
|
|
|
Thanks for answering my second question. Is there anyone who knows what my linker problem is or who can give tips to fix it?
|
|
|
|
|
I believe that your first error is from a type that is defined 2x and differently each time. Check that in your playsound files.
|
|
|
|
|
I have fixed both problems. Thanks. I made my class all inline and that fixed my linker errors whatever they were. Case closed.
|
|
|
|
|
Has anyone implemented Albert's article, "How to open a serial COM port in Managed C++, By Albert Pascual"
After I boot up my WinXP Pro system, Albert's implementation only works after I start up HyperTerminal. After that, it works fine from then on... Any clues? Has anyone else run into this on XP.
Thanks in Advance!
|
|
|
|
|
I worked through this. The code provided in the article is not sufficient to make the serial port work properly.
icdma
|
|
|
|
|
Hi,
I am learning C++ and Windows Forms and get a strange compiler error. I am using the directX header dshow.h for my project and when I do I get this error:
error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager'
stdafx.cpp(0) : see declaration of 'System::Resources::ResourceManager'
and it points to this code:
this->ButtonImages->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer * >(resources->GetObject(S"ButtonImages.ImageStream")));
and this was all generated by the designer.
I also get something similar when I try to use the MessageBox class. If I don't imclude dshow.h than these errors go away.
Any reasons and fixes are appreciated. Thanks.
|
|
|
|
|
That's because preprocessors are stupid. When a preprocessor finds GetObject, it replaces it with GetObjectA or GetObjectW, depending whether you compile a Unicode version or not.
Just put something like
#undef GetObject
after #include <windows.h>
and everything should work fine.
|
|
|
|
|
Hi all
HTF do you declare it? Now I know why it is called C++, like C, but you are require to do 2 things extra for every bloody thing@!!!
OK so I had this in C:
static Int32 rNums[512] = { 123,1231,....,2131};
In MC++ I try:
static Int32 rNums __gc[] = {123,1231,....,2131};
No luck, Int32 is defined. The error messages are useless as usual! Compiling as C++ with /clr.
at the declaration:
randtable.c(71) : error C2146: syntax error : missing ';' before identifier 'rNums'
randtable.c(71) : error C3150: '[' : '__gc' can only be applied to a class, struct, interface, array or pointer
at the end of the array:
randtable.c(123) : error C2501: 'leppie::RandomNumbers::rNums' : missing storage-class or type specifiers
randtable.c(123) : error C3845: 'leppie::RandomNumbers::rNums' : only static data members can be initialized inside a __gc class or value type
ANy one?
leppie::AllocCPArticle(Generic DFA State Machine for .NET);
|
|
|
|
|
OK I dont get this...
AT stattement level I can do this:
Int32 rNums __gc[] = {11,112,334,...,6667,8567};
But NOT at class level for a static instance. Nor can I do assignment at statement level, ie:
Int32 rNums __gc[];<br />
<br />
rNums = {11,112,334,...,6667,8567};
According to the docs the behaviour is the same as C++...
leppie::AllocCPArticle(Generic DFA State Machine for .NET);
|
|
|
|
|
|
__value struct V
{
static Int32 rNums[] = { 123, 345 };
static String* names[] = { S"ABC", S"DEF" };
};
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|