UI Issue

I've tried to make a little applet using C++ with VS2015. However I have ran into an issue that has been confusing me. The GUI is designed to call a function to get the ping of a server. But when I try to loop it the program freezes and does not accept any input. So my question is how can I make the program run the function without freezing it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
	void setText(int data)
	{
		pingOutbox->Text = Convert::ToString(data);
		pingOutbox->Refresh();
		cout << data << endl;
	}

	void mainPingThing()
	{
		int speed;
		setText(runPing());
		Sleep(1000);
		//mainPingThing();
	}
You can run the function runPing in a separate thread or use the BackgroundWorker component.

http://www.sourcecodester.com/tutorials/cc/6583/c-tutorial-using-backgroundworker-component-ccli.html
Topic archived. No new replies allowed.