easyx 简单的inputbox制作

先上图片:

由于visual studio2008经常因为TCHAR和char的转换问题,所以这次干脆在vc6的环境下制作了。代码如下:(vc2008可能编译不通过)

// inputbox.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

char s[1000];
char tmp;
int i=0;
int row=0;

int main(int argc, char* argv[]){
	initgraph(250,20);
	setbkcolor(WHITE);
	setcolor(BLACK);
	cleardevice();
	for(;;){
		tmp=_getch();
		if(tmp==8){
			if(i==0)goto end;
			--i;s[i]='\0';
		}
		else{
			s[i]=tmp;++i;s[i]='\0';
		}
		cleardevice();
end:
		outtextxy(0,0,s);
	}
	closegraph();
	return 0;
}

stdafx.h的内容如下:(大部分是注释)

// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//

#if !defined(AFX_STDAFX_H__89DA211D_4E1E_4B54_A06F_5887A7B3D040__INCLUDED_)
#define AFX_STDAFX_H__89DA211D_4E1E_4B54_A06F_5887A7B3D040__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers

#include <stdio.h>

// TODO: reference additional headers your program requires here

#include<graphics.h>
#include<iostream>
#include<string.h>
#include<conio.h>

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__89DA211D_4E1E_4B54_A06F_5887A7B3D040__INCLUDED_)

posted @   计算机知识杂谈  阅读(1621)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
点击右上角即可分享
微信分享提示