|
Again with some newbie question.
I have started a C# windows application and it look really nice with all those new controls and the WinForms stuff (looks much more to Delphi than VB 6 though ). I was wondering how I can use WinForms in MC++? I mean draging and dropping WinForms components on the managed form and stuff like that.
Thanks
Best regards,
Alexandru Savescu
|
|
|
|
|
You can't
MC++ lacks the CodeDOM support which is required for a visual designer to write the neccesary code.
James
Simplicity Rules!
|
|
|
|
|
Check this out. If you have VB6 you can use the designer. I have not yet tried it.
http://www.gotdotnet.com/userfiles/toml/VBWinForms.zip
|
|
|
|
|
http://www.codeproject.com/useritems/mcppwinforms01.asp
http://www.codeproject.com/managedcpp/mcppwinforms02.asp
http://www.codeproject.com/useritems/mcppoutlookgui.asp
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Thanks Nish, but as you said in the first article, there is now GUI support in Manage C++
Best regards,
Alexandru Savescu
|
|
|
|
|
Alexpro wrote:
Thanks Nish, but as you said in the first article, there is now GUI support in Manage C++
Yeah, that's really sad!!!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi!
I just my first semi-project in .NET that combines both MFC and MC++ and it works fine! However, when I needed to use any .NET classes I had to declare them as pointers and pass pointers to methods etc., like this
SqlConnection* s = new SqlConnection();
f (s);
Is this the only way it works? Apparently yes, and I feel sad, I've been using C++ for a while and got used to using references and not pointers....
Best regards,
Alexandru Savescu
|
|
|
|
|
You'll have to create all reference types on the heap. Thus you cannot have a String but only a String*.
On the other hand you can have value types on the stack.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Thanks Nish, but could you please provide me with some examples with those differences?
Thanks.
Best regards,
Alexandru Savescu
|
|
|
|
|
Alexpro wrote:
Thanks Nish, but could you please provide me with some examples with those differences?
String *s = new String("hey there");
Point p = Point(10,19);
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Thanks! I better lookup in the documentation to see the difference between refernce types and value types!
Best regards,
Alexandru Savescu
|
|
|
|
|
Alexpro wrote:
Thanks! I better lookup in the documentation to see the difference between refernce types and value types!
Have fun
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
I am deriving a class from ComboBox. I override OnKeyPress. But OnKeyPress never gets called! Anyone knows whether there is anything special I need to be doing?
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Well
It's not an MC++ issue here. The same thing happens when I use C#
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Ensure that IsInputKey/Char returns true for that key; if it returns false you won't get the OnKey* events.
James
Simplicity Rules!
|
|
|
|
|
James T. Johnson wrote:
Ensure that IsInputKey/Char returns true for that key; if it returns false you won't get the OnKey* events.
You mean in addition to overriding OnKeyPress I also need to override IsInputKey ???
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
I did this :-
protected override bool IsInputKey(System.Windows.Forms.Keys keyData)
{
base.IsInputKey(keyData);
return true;
}
But still OnKeyPress never gets called!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Use Anakrino. When you have anakrino you don't need to ask any quetions anywhere.
|
|
|
|
|
Rama Krishna wrote:
Use Anakrino. When you have anakrino you don't need to ask any quetions anywhere
How do I use Anakrino in this situation, Rama? My problem is that a handler is not getting called in the derived class despite the fact that I have overridden it
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
I overrode WndProc and found that the WM_KEYDOWN message is not being received
protected override void WndProc(ref System.Windows.Forms.Message m)
{
base.WndProc(ref m);
if(m.Msg == 0x0100)
Text = "Hello World";
}
Nish
p.s. In an MC++ program I can #include windows.h to get the defines for various messages, in a C# program how do I get the defines for messages. Above I have hardcoded 0x0100 [WM_KEYDOWN]
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Find in Files for WM_KEYDOWN
There are a couple programs out there which will let you get the constants but I find it much easier to just do a Find in Files.
James
Simplicity Rules!
|
|
|
|
|
James T. Johnson wrote:
Find in Files for WM_KEYDOWN
Blast!!!
Of all things, a Jambo joke!!!
Boooohhhhhhhhh!
We don't want Jambo jokes! Booooooooooo!
We want jambo-edited articles
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish - Native CPian wrote:
We want jambo-edited articles
I'll get back to editing once I figure out what has caused me headaches the past 2 days.
James
Simplicity Rules!
|
|
|
|
|
Incidentally there was a discussion about this in one of my articles
Link
Don't use WndProc, use PreProcessMessage.
|
|
|
|
|
Rama Krishna wrote:
Incidentally there was a discussion about this in one of my articles
Link
Thanks. Checked it out!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|