473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Upgrade to GUI



/*

I am trying to use message box instead of Console::WriteLine() to upgrad my
code from just using the console to using GUI.

In the buttom 2 lines, #1 works, but I have hard time to make # 2 works. Can
anybody give a hand here to make the infomation to be shown on the message
box instead of being shown on the console.

I am using visual C++ .NET 2003

Thanks

*/







#include "stdafx.h"

#include <gcroot.h>

#using <mscorlib.dll>

using namespace System;

using namespace System::Runtime::InteropServices;

typedef void* HWND;

[DllImportAttribute("User32.dll", CharSet=CharSet::Auto)]

extern "C" int MessageBox(HWND hw, String* text,

String* caption, unsigned int type);

__gc class MClass

{

public:

int val;

MClass(int n) //costructor

{

val = n;

}

};

class UClass

{

public :

gcroot<MClass*mc;

UClass(MClass* pmc) //constructor

{

mc = pmc;

}

int getValue() //get function

{

return mc->val;

}

};

int _tmain()

{

Console::WriteLine(S"Testing...");

//Create a managed object and assign 3 to it

MClass* pm = new MClass (3);

//Create an unmanaged object and assign the value of the manged object (pm)
to it

UClass uc(pm);
Console::WriteLine(S"Value is {0}", __box(uc.getValue())); //<-------- This
will work # 1

//MessageBox(0, uc.getValue(), S"Message Box...", 0 ); //<------- this will
not work # 2

return 0;

}
Jun 2 '07 #1
0 924

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dave Harney | last post by:
Hi Newsgroup, I'm currently using VS Ver 7.0.9466 with an OS of Server 2000 (domain controller) Ver 5.0.2195 (Build 2195) SP4. I have MSDN Universal and would like to upgrade my development...
3
by: John | last post by:
Hello, I am trying to figure out how to determine if I have fixed an upgrade warning. If I delete the green text then the upgrade warning goes away. However, I would expect it to come back...
36
by: Tim | last post by:
Is there a way to upgrade from Visual C++ Net 2002 to Visual C++ Net 2003? The 2002 version does not provide a Windows Forms Designer. I can't find any upgrade package on Microsoft's website. ...
4
by: Dave Harney | last post by:
Hi Newsgroup, I'm currently using VS Ver 7.0.9466 with an OS of Server 2000 (domain controller) Ver 5.0.2195 (Build 2195) SP4. I have MSDN Universal and would like to upgrade my development...
3
by: John | last post by:
Hello, I am trying to figure out how to determine if I have fixed an upgrade warning. If I delete the green text then the upgrade warning goes away. However, I would expect it to come back...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.