Form Applications in Visual Studio and Threads

This is a discussion on Form Applications in Visual Studio and Threads within the C++ Programming forums, part of the General Programming Boards category; Hi, I'm writting messenger in c++, but this VS10 is ........ing me off. I have a class which has function ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    69

    Form Applications in Visual Studio and Threads

    Hi,
    I'm writting messenger in c++, but this VS10 is ........ing me off. I have a class which has function I run as thread :

    Code:
    cResult =  recv(this->_sock, Packet.buff, 1024, 0);
    		if (cResult > 0)
    		{
    			Packet.size = cResult;
    			Packet.from = (int*)this;
    
    			switch (Packet.buff[2])
    			{
    				case 1: return this->IcomingPacket_AuthResult(Packet); break;
    			}
    		}
    And now what I want to do is to display message in richBox on Form. How to call that stupid richBox within my class file let's say it "MyClass.cpp"??

    Another thing is that boost thread isnt working when I use GUI :
    Code:
    Error	3	error C3861: '_InterlockedExchange': identifier not found	C:\c++ visual\boost_1_49_0\boost\smart_ptr\detail\spinlock_w32.hpp	62	1	Messenger_Client
    Error	4	error C3861: '_InterlockedExchange': identifier not found	C:\c++ visual\boost_1_49_0\boost\thread\win32\basic_timed_mutex.hpp	46	1	Messenger_Client
    Error	5	error C3861: '_InterlockedExchangeAdd': identifier not found	C:\c++ visual\boost_1_49_0\boost\thread\win32\basic_timed_mutex.hpp	160	1	Messenger_Client
    Error	8	error C3861: '_InterlockedExchange': identifier not found	C:\c++ visual\boost_1_49_0\boost\smart_ptr\detail\spinlock_w32.hpp	62	1	Messenger_Client
    Error	9	error C3861: '_InterlockedExchange': identifier not found	C:\c++ visual\boost_1_49_0\boost\thread\win32\basic_timed_mutex.hpp	46	1	Messenger_Client
    Error	10	error C3861: '_InterlockedExchangeAdd': identifier not found	C:\c++ visual\boost_1_49_0\boost\thread\win32\basic_timed_mutex.hpp	160	1	Messenger_Client
    Please help me asap

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,160
    Just to make sure I understand, this is using C++ .NET with Windows Forms? And the problem you are having is that you cannot manipulate the GUI from a non-GUI thread?

    You can use richBox.Invoke() to cause code to run on the GUI thread. See here: Control.Invoke Method (Delegate) (System.Windows.Forms)

    The errors about missing InterlockedExchange functions are sometimes caused by not including windows.h, which could happen if boost is not properly configured, you're missing the Windows SDK, etc.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    69
    Quote Originally Posted by brewbuck View Post
    Just to make sure I understand, this is using C++ .NET with Windows Forms? And the problem you are having is that you cannot manipulate the GUI from a non-GUI thread?

    You can use richBox.Invoke() to cause code to run on the GUI thread. See here: Control.Invoke Method (Delegate) (System.Windows.Forms)

    The errors about missing InterlockedExchange functions are sometimes caused by not including windows.h, which could happen if boost is not properly configured, you're missing the Windows SDK, etc.
    I dont even know how to change Text of richbox within the method of my class. This class is in another file and I have to call somehow to my form object. Tried this way but didnt work :/

    Code:
    Form1.richTextBox1->Text("Logged");
    Honestly its my first gui in Visual, so far I wrote only console apps in c++ and gui in Delphi.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual Studio DLL and Visual Basic
    By mathguy in forum C Programming
    Replies: 18
    Last Post: 12-08-2011, 02:55 PM
  2. Visual C++ and Visual Studio 2010
    By 03jh01 in forum C++ Programming
    Replies: 5
    Last Post: 10-03-2010, 04:03 AM
  3. visual studio 6 and visual studio.net difference
    By gemini_shooter in forum Tech Board
    Replies: 5
    Last Post: 02-04-2006, 12:32 AM
  4. Replies: 1
    Last Post: 05-26-2004, 09:59 AM
  5. Frames in ASP.net Web Form (I'm using Visual C# .net)
    By Grayson_Peddie in forum Networking/Device Communication
    Replies: 0
    Last Post: 09-20-2003, 01:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21