Click here to Skip to main content
15,921,169 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralInitDialog() VS ActiveX Pin
Usman Tasleem Akshaf17-Jul-05 4:52
Usman Tasleem Akshaf17-Jul-05 4:52 
GeneralRe: InitDialog() VS ActiveX Pin
toxcct17-Jul-05 20:45
toxcct17-Jul-05 20:45 
Generalloop speed Pin
locoone17-Jul-05 1:38
locoone17-Jul-05 1:38 
GeneralRe: loop speed Pin
CodeBeetle17-Jul-05 9:25
CodeBeetle17-Jul-05 9:25 
GeneralRe: loop speed Pin
locoone17-Jul-05 18:34
locoone17-Jul-05 18:34 
GeneralRe: loop speed Pin
khan++17-Jul-05 18:56
khan++17-Jul-05 18:56 
GeneralRe: loop speed Pin
locoone17-Jul-05 20:40
locoone17-Jul-05 20:40 
GeneralRe: loop speed Pin
khan++17-Jul-05 21:50
khan++17-Jul-05 21:50 
#include <windows.h>
#include <conio.h>
#include <stdio.h>

bool g_bWorking;
void Worker()
{
while (g_bWorking)
{
//this is the loop where the program does all the work.
printf("ASD");
}
}

unsigned long __stdcall Thread(void* lpVoid)
{
Worker();
return 0;
}
main()
{
unsigned long id;
HANDLE h;
g_bWorking = TRUE;
h = CreateThread(NULL,0,Thread,0,CREATE_SUSPENDED,&id);
SetThreadPriority(h,THREAD_PRIORITY_LOWEST);
ResumeThread(h);
getch();
SuspendThread(h);
getch();
ResumeThread(h);
getch();
return 0;
}
It will start the thread, then on keypress, pause it, then on keypress resume it. You can see the result by running this console application.
When you need to stop it, make g_bWorking = false.
And by-the-way, are you writing a console app, or a windows app?


this is this.
GeneralRe: loop speed Pin
locoone17-Jul-05 21:53
locoone17-Jul-05 21:53 
GeneralRe: loop speed Pin
khan++17-Jul-05 22:02
khan++17-Jul-05 22:02 
GeneralRe: loop speed Pin
locoone17-Jul-05 22:04
locoone17-Jul-05 22:04 
GeneralRe: loop speed Pin
khan++17-Jul-05 22:48
khan++17-Jul-05 22:48 
GeneralRe: loop speed Pin
locoone17-Jul-05 23:25
locoone17-Jul-05 23:25 
GeneralRe: loop speed Pin
khan++17-Jul-05 23:35
khan++17-Jul-05 23:35 
GeneralRe: loop speed Pin
locoone18-Jul-05 0:00
locoone18-Jul-05 0:00 
GeneralRe: loop speed Pin
khan++18-Jul-05 0:13
khan++18-Jul-05 0:13 
GeneralRe: loop speed Pin
locoone18-Jul-05 0:15
locoone18-Jul-05 0:15 
GeneralRe: loop speed Pin
khan++18-Jul-05 0:23
khan++18-Jul-05 0:23 
GeneralRe: loop speed Pin
locoone18-Jul-05 0:25
locoone18-Jul-05 0:25 
GeneralRe: loop speed Pin
khan++18-Jul-05 0:36
khan++18-Jul-05 0:36 
GeneralRe: loop speed Pin
locoone18-Jul-05 1:04
locoone18-Jul-05 1:04 
GeneralRe: loop speed Pin
David Crow18-Jul-05 2:56
David Crow18-Jul-05 2:56 
GeneralRe: loop speed Pin
David Crow18-Jul-05 2:59
David Crow18-Jul-05 2:59 
GeneralRe: loop speed Pin
locoone18-Jul-05 17:46
locoone18-Jul-05 17:46 
GeneralRe: loop speed Pin
David Crow19-Jul-05 2:27
David Crow19-Jul-05 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.