0 Replies - 1236 Views - Last Post: 08 October 2010 - 07:33 PM

#1 Larsonator  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 77
  • Joined: 13-August 10

Managed pointers and unmanaged pointers

Posted 08 October 2010 - 07:33 PM

ok, so pretty much im trying to solve a problem in my login service.

at the moment, the the program in initialised, the connects to the server, and the server thread then waits for the login details.
the only problem here is, that if the incorrected login details are send, the server threads are ended.

To solve this, im trying to create the socket connections when the login button is pressed.
only problem to this is that the main form need the use these created sockets as well, so i though id use pointers:D

the idea is, id parse the int pointers (which have been initialised as 0) to the login form when its created

so the login form will deal with the pointers, and the main form would have the in variables. when the sockets are created in the login form, it used the pointer to store the socket number in the variable in the main form.

only thing is, it seems that forms prefere to deal with managed pointers.

my experience with managed C++ is rather limited, and im sorta learning as i go.

Form1(void)
		{	
			MONITORING = false;
			CONNECTED = false;
			int ^monPtr = &monitorSocket; //command socket and monitor socket are int variables.
			int ^cmdPtr = &commandSocket;

			//connectSockets();
			myDelegate = gcnew AddTextBoxString(this, &Form1::OutPutBoxWork);
			
			InitializeComponent();
			Application::Run(gcnew loginForm(cmdPtr, monPtr));


loginForm(int ^commandSocket, int ^monitorSocket)


1>h:\serverclientproject\networkadmingui\networkadmingui\Form1.h(51) : error C2440: 'initializing' : cannot convert from 'cli::interior_ptr<Type>' to 'System::Int32 ^'
1>        with
1>        [
1>            Type=int
1>        ]
1>        No user-defined-conversion operator available, or
1>        There is no context in which this conversion is possible
1>h:\serverclientproject\networkadmingui\networkadmingui\Form1.h(52) : error C2440: 'initializing' : cannot convert from 'cli::interior_ptr<Type>' to 'System::Int32 ^'
1>        with
1>        [
1>            Type=int
1>        ]
1>        No user-defined-conversion operator available, or
1>        There is no context in which this conversion is possible



Is This A Good Question/Topic? 0
  • +

Page 1 of 1