Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and work.


Instant Grammar Checker - Correct all grammar errors and enhance your writing

You have the vaccine, now let everyone know!
Teach Your Child To Read

BlueHost Web Hosting Black Friday

Bonsai Boy of New York Bonsai Trees and Accessories

DreamCloud The Comfortable Luxury Mattress Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

DreamHost Web Hosting

Disclosure We are a professional Programming & Software Q&A website, that receives compensation from some of the links whose we show you with Information. It means that my content may contain affiliate links.

17,954 questions

24,129 answers

573 users

How to create thread on windows in C

1 Answer

0 votes
#include <windows.h>
#include <stdio.h>

DWORD WINAPI ThreadFunction(LPVOID lpParam) {
    printf("ThreadFunction - Thread Running\n");
    return 0;
int main() {
    HANDLE hThread = NULL;
    DWORD ThreadID = 0;

    hThread = CreateThread(NULL, 0, &ThreadFunction, NULL, 0, &ThreadID);
    if (hThread == NULL) {
        printf("CreateThread Failed, Error: %ld\n", GetLastError());
    printf("CreateThread Success\n");

    printf("Thread ID - %ld\n", ThreadID);



    return 0;


CreateThread Success
Thread ID - 21720
ThreadFunction - Thread Running



answered Apr 28 by avibootz
edited Apr 29 by avibootz