Friday, April 27, 2012

Using thread on windows

#include <iostream>
#include <string>
#include <windows.h>

using namespace std;

#define BUFFER MAX_PATH

DWORD WINAPI function1(LPVOID lpParam);
void function2();



int main()
{
   HANDLE hthread;
   DWORD dwthreadID = 0;
   cout << "Entered the main function" << endl;
   hthread = CreateThread(NULL, 0, function1, NULL, 0, &dwthreadID);

   function2();
   return 0;
}

DWORD WINAPI function1(LPVOID lpParam)
{
      double val = 1000000;

   for(double v = 0; v < val; v++)
   {
       double num = v * 55;
       cout << "Thread-1:" << "  " << num << endl;
       Sleep(2000);
       cout << " " << endl;
   }
   return 0;
}

void function2()
{
      double val = 2000000;

   for(double v = 0; v < val; v++)
   {
       double num = v * 1;
       cout << "Thread-2:" << "  " << num << endl;
       Sleep(500);
       cout << " " << endl;
   }
}

How to create Custom push button in QT5

To be honest this is not my work its an exact copy from this link. http://mcmtechtips.blogspot.com/2012/03/shape-qpushbutton-in-your-own-st...