Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7979623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:49:26+00:00 2026-06-04T09:49:26+00:00

Hello I am using Code::Blocks in Windows XP. When I am running this program

  • 0

Hello I am using Code::Blocks in Windows XP.
When I am running this program I am getting a run time error as "drawing operation was attempted when there was no current window".
I would like to know why it is happening so.

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <windows.h>
#include <conio.h>
void *print_message_function( void *ptr );

main()
{
   pthread_t thread1, thread2;
   char *message1 = "Thread 1";
   char *message2 = "Thread 2";
   int  iret1, iret2;

   iret1 = pthread_create( &thread1, NULL, print_message_function, (void*) message1);
   iret2 = pthread_create( &thread2, NULL, print_message_function, (void*) message2);

   pthread_join( thread1, NULL);
   pthread_join( thread2, NULL);

   printf("Thread 1 returns: %d\n",iret1);
   printf("Thread 2 returns: %d\n",iret2);

   exit(0);
}

void *print_message_function( void *ptr )
{
   char *message;
   char hello;
   for(;;)
   {
        message = (char *) ptr;
        printf("%s \n", message);
        Sleep(1000);
      //  break;


         fflush(stdin);   
/*drawing operation was attempted when there was no current window*/
//The happens from next line onwords
           if(kbhit())
           {
               hello = getchar();
               printf("The interrupt %d", hello);
           }
       }

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:49:27+00:00Added an answer on June 4, 2026 at 9:49 am

    kbhit() is deprecated, use _kbhit() instead. Perhaps it was the reason.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this problem when trying to run hello world program using android SDK.
Hello I'm trying to write some tool using code::blocks, wxWidgets and libxml2 on Windows
Consider this code: #include <iostream> using namespace std; class hello{ public: void f(){ cout<<f<<endl;
This code: #include <iostream> using namespace std; int main() { cout << Hello world!\n;
Hello I'm using following code for checkbox to close some type of time picker,
Hello I am using this jquery code onclick=jQuery('.hidden').show() to show the class labeled .hidden
Hello everyone my problem is very simple. Using entity framework code first I want
Hello I'm using this star rating widget http://www.fyneworks.com/jquery/star-rating/ to add functionality for users to
I've been using http://code.google.com/p/plblocks/ for a while now to get blocks support in our
I'm having some problems with Code::Blocks, and this is the output after / while

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.