| |

VerySource

 Forgot password?
 Register
Search
View: 670|Reply: 1

Anxious !! Line problems --- delegate constructor

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-17 01:00:01
| Show all posts |Read mode
readThread = gcnew Thread (gcnew ThreadStart (this, RunClient ()));
readThread-> Start ();
   .
   .
   .
// ------------------------------------------------ --------------------
public:
      void RunClient ()
      {
       ........
       ........
       ........
      }

error C3867: "client :: Form1 :: RunClient": Missing parameter list for function call; please use "&client :: Form1 :: RunClient" to create pointers to members
error C3350: "System :: Threading :: ThreadStart": The delegate constructor requires 2 parameters
How to solve this problem ???
Reply

Use magic Report

0

Threads

36

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-4-25 10:30:01
| Show all posts
Your RunClient is not static, you need to use member function pointer to get its address
System :: Threading :: ThreadStart ^ ts = gcnew System :: Threading :: ThreadStart (this,&Form1 :: RunClient);
System :: Threading :: Thread ^ readThread = gcnew System :: Threading :: Thread (ts);
readThread-> Start ();
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list