选数程序

选数程序- -

                                      

/*****************************************************************************
* FileName     : count.c
* Date            : 2005/05/11
* Author         : 蜀山木马
* Module        : 
* Description  : 
*
*   Copyright (c) 2005  All Rights Reserved.
*-----------------------------------------------------------------------------
*      Edit History
* NO Date            Modifier    Modified Content
* 1    2005/05/11 蜀山木马    Basic definition 
* 2    2005/05/17 蜀山木马                                
*****************************************************************************/
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>

#define MSG_STOP WM_USER+1

DWORD WINAPI CircleCount(LPVOID);

DWORD nCircleCountID;
HANDLE hCircleCount;

/****************************************************************************
* Function Name            : main
* Description                  : Functiong entry
* Input Parameters        : None
* Output Parameters     : None 
* Return Value               : None
* Caller                           : 
* Date                            : 2005/05/11
* Author                         : 蜀山木马
*****************************************************************************/
int main()
{
 printf("Press 'b'  to run...");
 while( _getch() != 'b'  );
 hCircleCount = CreateThread(NULL,0,CircleCount,NULL,0,&nCircleCountID);
 
 _getch();
 PostThreadMessage(nCircleCountID,MSG_STOP,0,0);

 CloseHandle(hCircleCount);

 return EXIT_SUCCESS;
}

/****************************************************************************
* Function Name            : CircleCount
* Description                  : Functiong entry
* Input Parameters        : LPVOID n
* Output Parameters     : NONE 
* Return Value               : DWORD
* Caller                           : 
* Date                            : 2005/05/11
* Author                         : 蜀山木马
*****************************************************************************/
DWORD WINAPI CircleCount(LPVOID n)
{
 MSG msg;
 int i = 0;
 BOOL flag = TRUE;
  
 while( flag )
 {
  if(PeekMessage( &msg,NULL,0,0,PM_REMOVE))
  {
   flag = FALSE;
  }
  else
  {
   printf("%d/n",i++);
   if(i == 500 )
    i = 0;
  }
 }
 
 printf("You select number is %d/n",i);

 return 0;

}

以上程序在VC++6.0下编译通过

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值