NO

Author Topic: About threads  (Read 4453 times)

sp00n

  • Guest
About threads
« on: May 04, 2007, 10:46:14 AM »
As I'm noob, i want to ask all: How can I realise the treatment of a button, when in the application in that time works another function?
For example:
void Loop()
{
while (true);
}
static LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// checking the buttons
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpszCmdLine, int nCmdShow)
{
  Loop();
}

I want to check buttons state when Loop() executes:)
Please explaine me this moment.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: About threads
« Reply #1 on: May 04, 2007, 11:03:35 AM »
Run the buttons checking routine in another thread.
To create and start a new thread look in the help for '_beginthread' function.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

sp00n

  • Guest
Re: About threads
« Reply #2 on: May 04, 2007, 11:17:02 AM »
Run the buttons checking routine in another thread.
To create and start a new thread look in the help for '_beginthread' function.
Thanks but which lib containes this macros/function? (I know the "process.h", but linker needs a lib-file:) )

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: About threads
« Reply #3 on: May 07, 2007, 12:58:33 PM »
Take a look in the PellesC help. It is part of C runtime. The help also give you reference for the win32 API native function.
Moreover you'll find how to create and run a new thread in my webserver code available in the user contribution section (http://www.smorgasbordet.com/forum/index.php?topic=726.0)
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide