Waiting function

07/04/2012 16:36 Krasti#16
Quote:
Originally Posted by Neeya Nanaa View Post
Did your programm freez or what ?
It shouldn't freeze if you do ur stuff in a thread.
No,the program isn't freeze,but the function which check if a button is on,isn't work ( if(IsDlgButtonChecked(blabla)) )
07/04/2012 17:27 Omdi#17
Quote:
Originally Posted by Krasti View Post
No,the program isn't freeze,but the function which check if a button is on,isn't work ( if(IsDlgButtonChecked(blabla)) )
Code:
if(IsDlgButtonChecked(DlgHwnd,IDC_BUTTON01) == BST_CHECKED)
{
//do ur stuff here
}
^
it should work with this.
07/04/2012 17:41 Krasti#18
Quote:
Originally Posted by Neeya Nanaa View Post
Code:
if(IsDlgButtonChecked(DlgHwnd,IDC_BUTTON01) == BST_CHECKED)
{
//do ur stuff here
}
^
it should work with this.
Exactly
that i'm doing
07/04/2012 18:14 Omdi#19
Quote:
Originally Posted by Krasti View Post
Exactly
that i'm doing
Well then i think your Dialoghwnd is wrong.

Could you post a snippet of ur source?
07/04/2012 18:29 Krasti#20
Quote:
Originally Posted by Neeya Nanaa View Post
Well then i think your Dialoghwnd is wrong.

Could you post a snippet of ur source?
You mean the Events?(funcs etc)
or the the thread?
07/04/2012 21:20 Omdi#21
Quote:
Originally Posted by Krasti View Post
You mean the Events?(funcs etc)
or the the thread?
post a snippet of the Events.
07/04/2012 21:34 Krasti#22
Just a snippet

Code:
      case WM_INITDIALOG:
         return true;
      case WM_COMMAND:
      {
		 case IDC_BUTTON1:
			 CreateThread(0,0,(LPTHREAD_START_ROUTINE)Thread,0,0,0);
			break;
			}

         return true;
I did Thread as void,cause i get same result with the script you post
07/04/2012 21:43 Omdi#23
Quote:
Originally Posted by Krasti View Post
Just a snippet

Code:
      case WM_INITDIALOG:
         return true;
      case WM_COMMAND:
      {
		 case IDC_BUTTON1:
			 CreateThread(0,0,(LPTHREAD_START_ROUTINE)Thread,0,0,0);
			break;
      }

         return true;
I did Thread as void,cause i get same result with the script you post
Code:
      case WM_INITDIALOG:
         return true;
      case WM_COMMAND:
      {
		 case IDC_BUTTON1:
if(isDlgButtonChecked(hwndDlg, IDC_BUTTON1) == BST_CHECKED)
			 CreateThread(0,0,(LPTHREAD_START_ROUTINE)Thread,0,0,0);
			break;
			}

         return true;
^
;)
07/04/2012 22:09 Krasti#24
Quote:
Originally Posted by Neeya Nanaa View Post
Code:
      case WM_INITDIALOG:
         return true;
      case WM_COMMAND:
      {
		 case IDC_BUTTON1:
if(isDlgButtonChecked(hwndDlg, IDC_BUTTON1) == BST_CHECKED)
			 CreateThread(0,0,(LPTHREAD_START_ROUTINE)Thread,0,0,0);
			break;
			}

         return true;
^
;)
Well,the point is that after it check if S4 is on,the checkbox func isn't get work :/

Code:
void Thread()
{
        Sleep(100);
	while(isRunning("S4Client.exe")==false){}
	MessageBoxA(Dlg,"Test","Test1",MB_OK);
	if(IsDlgButtonChecked(Dlg,IDC_CHECK1))
	{
		MessageBoxA(Dlg,"Test","Test2",MB_OK);
	}
}
The first one works,but when i click CHECK1 no msg :/
I've use it for a Dll also,and it pretty worked,but it was in the loop
07/05/2012 13:26 Omdi#25
Quote:
Originally Posted by Krasti View Post
Well,the point is that after it check if S4 is on,the checkbox func isn't get work :/

Code:
void Thread()
{
        Sleep(100);
    while(isRunning("S4Client.exe")==false){}
    MessageBoxA(Dlg,"Test","Test1",MB_OK);
    if(IsDlgButtonChecked(Dlg,IDC_CHECK1))
    {
        MessageBoxA(Dlg,"Test","Test2",MB_OK);
    }
}
The first one works,but when i click CHECK1 no msg :/
I've use it for a Dll also,and it pretty worked,but it was in the loop
Code:
DWORD WINAPI Thread(LPVOID lpParam)
{
        Sleep(100);
    while(isRunning("S4Client.exe")==false){}
    MessageBoxA(Dlg,"Test","Test1",MB_OK);
    if(IsDlgButtonChecked(Dlg,IDC_CHECK1) == BST_CHECKED)
    {
        MessageBoxA(Dlg,"Test","Test2",MB_OK);
    }

return TRUE;
}
;)
07/05/2012 14:34 Nightblizard#26
Code:
void Thread()
Quote:
Originally Posted by msdn
Do not declare this callback function with a void return type and cast the function pointer to LPTHREAD_START_ROUTINE when creating the thread
:facepalm:
[Only registered and activated users can see links. Click Here To Register...]