|
Thanks for your reply.
Sorry, but I don't quite see what you are getting at.
The const in mc must be static in order to initialise it with a value.
For me, the end result must be that a string constant defined in the C# assembly must be able to be initialised to the value of a constant from the managed C++ class.
The code I provided works fine for integer constants, however, the C# does not regard the C++ string constant as a constant, and thus will not allow me to initialise the C# constant to that value.
|
|
|
|
|
What is the best way to integrate an MFC-component in a .Net application?
The MFC-component I want to use resides in an mfc-dll and consists of many c++ classes with big usage of the MFC-classes. I tried so far to use IJW with MC++ wrapper classes but the application crashes all the time in some new and I don't want to use PInvoke because then I loose the object oriented design. How about converting the MFC-component into a COM object? Can I use the MFC-component this way in a .Net application?
All suggestions are welcome.
Cheers
gunag
|
|
|
|
|
U should be able to make it working through IJW. whats the erro u are getting? Though converting to COM is a possible alternative, as far as workload is concerned IJW is best. Performancewise also IJW is better than Com interop according to msdn.
cheers..Milton KB.
|
|
|
|
|
Hi Milton KB,
I get lots of crashes related to new operators. Each time I allocated with new a CDC object, it might crash. I have the feeling that during the new operation there might be a conflict between the managed and unmanaged heap. Do you have any idea what i could do in this case?
|
|
|
|
|
There shouldn't be any crash normally. can u b more specific by posting some code which causes error..
Milton KB
|
|
|
|
|
Im trying to create an AsyncCall back instance but i get a weired error :
Code:
Static void function()
{
...
AsyncCallback* callback = new AsyncCallback(TestMethod, &TestMethod);
...
}
the error is:
error C3363: 'void ClientRequestReceived(System::IAsyncResult __gc *)' : cannot create a delegate handler for 'System::AsyncCallback' from a non-member function or a member of an unmanaged class
how do i fix this error?
Thanx in advance
Upon my end shall i begin?
Forsaking all i've fallen for..
i rise to meet the END!!
|
|
|
|
|
In C/C++ can any "macro" take variable number of arguments? Is it possible any way?
Pradosh
|
|
|
|
|
depends of the compiler. with VC6, i'm sure you can't, but on later versions, i don't remember how you can do such macros though
|
|
|
|
|
|
It's working in VC++ 8. I could not check it in any other compiler.
Pradosh
|
|
|
|
|
% is for tracking references to CLI object
& is for passing native heap objects
If I use % and pass a native object, what is the compiled behavior? In other words given the following trivial example, does the code for x and y end up being the same, or does x box the passed value and then unbox it?
void Test(int% x, int& y)
{
x++;
y++;
}
void SomeFunction()
{
int x = 0;
int y = 1;
Test(x, y);
}
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Seems like x would automatically get boxed. You can run ildasm on the compiled binary and see if this is the case.
I could've sworn Nish had an article on & and % but I can't find it right now.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
hi friends,
i am infront of you with another doubt. We are using cin and cout in C++. Whether these are class or object.
if they are object how can we use them without declaring that it belongs to this class. Thanks for u in advance.
Shamnar
shamnar
|
|
|
|
|
cin is a class...
well how do you percept a difference between class and object?
|
|
|
|
|
NrmMyth wrote: cin is a class
no, cin is an instance of a class (std::ofstream class).
the difference between a class and an object is that a class defines a type, while an object is an instance of that class (an instance of the type of the class)
|
|
|
|
|
my bad, weren't thinking
also, i never used word "object" for "instance", personal opinion
|
|
|
|
|
well, i not only don't understand what you mean, but for the second time, i tell you that you ask about UNMANAGED C++, in a Managed C++ forum... this is the wrong place !
BTW, see my reply to the other guy to get some infos. the point is that cout and cin are instanciated at the beginning of your program (implicitely)
|
|
|
|
|
cin and cout aren't class or object. They are both functions.
we can use them without declaring because they have been declared in iostream.h
-- modified at 2:53 Sunday 13th August, 2006
-- modified at 2:55 Sunday 13th August, 2006
I love this web
|
|
|
|
|
Hi everyone!
I am creating menuitems on the main menu during run time from user instructions but i am stuck on creating eventhandlers for them at the same time.
I've tried specifying the eventhandler in the constructor like this
System::Windows::Forms::MenuItem * Item = new
System::Windows::Forms::MenuItem(S"subItem1",new
EventHandler(this,Item_Click));
(saw an example on the internet) but get
error C2065: 'Item_Click' : undeclared identifier
error C3350: 'System::EventHandler' : a delegate constructor expects two arguments
Any help is much appreciated
george
george
|
|
|
|
|
Is there a way to have SPLASH WINDOW in VC++ .NET as in MFC ?
if not, any possible workaround ?
Cheers
Pavan
|
|
|
|
|
|
|
Hi Experts,
As i am a beginer in C++ i met with a confusion. I would like to know where the actual defention of library function is present. For eg: the defention of strlen(). Is it present in string.h. Or just the declaration only present in the string.h. please clrify my doubts.
Thanking you
Shamnar
shamnar
|
|
|
|
|
strlen() is defined in the C runtime. it is not a function you should use in C++/CLI.
|
|
|
|
|
I think you can't find the definition because they are compiled into library files.
|
|
|
|