Q: How do I access a form's control from another thread? Using VC++ 2010.
I want to access a form's control from a class in another thread.. and can't figure out the best (or any) way to do this.  How can I pass a reference of my form instance?  Im using createthread() as opposed to the managed version, wanting to make my app compatible with XP.
I've tried passing a reference and other values in a struct through the lpParameter, but I can't seem to figure out how to declare the reference properly.
ref class SZClass {
    private:
        FMain ^bound_form;
        int server_port;
    public:
        void BindForm(FMain ^bf);
        void Initialize(int sp)
}

struct param_data {
    public:
        FMain ^form_tobind;
        int port_num;
}

are giving me errors:
error C2143: syntax error : missing ';' before '^'

FMain is the name of my form class, and I have a delegate method already set up to make it multithread safe:
public:
    FMain(void)
    {
        InitializeComponent();
        //
        //TODO: Add the constructor code here
        //
    }

    void FMain::PrintConsole(std::string mzg) {
        String ^Smzg = marshal_as<String^>(mzg);
        if (this->textBox1->InvokeRequired) {
            SetTextDelegate^ d =  gcnew SetTextDelegate(this, &FMain::PrintConsole);
            this->Invoke(d, gcnew array<Object^> { Smzg });
        } else {
            textBox1->Text += Smzg;
            textBox1->SelectionStart = textBox1->TextLength;
        }
    }

How do I declare a reference to my form?
Or is there an easier or better way to do this?

A: I don't know what forms library you're using, but the general rule of thumb for your question is, "Don't."
Unless you have a peculiar GUI library, Windows UI is thread-affinitized. All access to UI elements should be done via the ui's affinitized thread. Manipulating UI state from an unaffinitized execution context should be done by marshaling the update request to the affinitized context. It should not be done directly.
