用c语言写一个登陆的界面遇到的问题
例子:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
#include <wincon.h>
#include <process.h>
int TabKey=1;
int main(void)
{
SMALL_RECT a1={0,5,20,7};
SMALL_RECT a2={25,5,50,7};
SMALL_RECT a3={55,5,75,7};
hIn=GetStdHandle(STD_INPUT_HANDLE);
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleOutputCP(437);
ClrScr();
DisBox(a1);
DisBox(a2);
DisBox(a3);
TabControl();
return 0;
}
void DisBox(SMALL_RECT rc)
{
char ch[6];
COORD ps;
DWORD z;
ch[0]=(char)0xda;
ch[1]=(char)0xbf;
ch[2]=(char)0xc0;
ch[3]=(char)0xd9;
ch[4]=(char)0xc4;
ch[5]=(char)0xb3;
for(ps.X=rc.Left+1;ps.X<rc.Right-1;ps.X++)
{
ps.Y=rc.Top;
//Drow Top Line
WriteConsoleOutputCharacterA(hOut,&ch[4],1,ps,&z);
if(ps.X==rc.Left+1)//Drow Left Top
{
ps.X--;
WriteConsoleOutputCharacterA(hOut,&ch[0],1,ps,&z);
ps.X++;
}
if(ps.X==rc.Right-2)//Drow Right Top
{
ps.X++;
WriteConsoleOutputCharacterA(hOut,&ch[1],1,ps,&z);
ps.X--;
}
ps.Y=rc.Bottom;//Drow Bottom Line
WriteConsoleOutputCharacterA(hOut,&ch[4],1,ps,&z);
if(ps.X==rc.Left+1)//Drow Left Bottom
{
ps.X--;
WriteConsoleOutputCharacterA(hOut,&ch[2],1,ps,&z);
ps.X++;
}
if(ps.X==rc.Right-2)//Drow Right Bottom
{
ps.X++;
WriteConsoleOutputCharacterA(hOut,&ch[3],1,ps,&z);
ps.X--;
}
}
for(ps.Y=rc.Top+1;ps.Y<=rc.Bottom-1;ps.Y++)
{
ps.X=rc.Left;
WriteConsoleOutputCharacterA(hOut,&ch[5],1,ps,&z);
ps.X=rc.Right-1;
WriteConsoleOutputCharacterA(hOut,&ch[5],1,ps,&z);
}
}void TabControl() //¼àÊÓÊäÈEÄÏ̺߳¯Êý
{
INPUT_RECORD keyRc;
INPUT_RECORD mouseRc;
DWORD kres,mres;
for(;;)
{
ReadConsoleInput(hIn,&keyRc,1,&kres);
if(keyRc.EventType==KEY_EVENT)
{
if(keyRc.Event.KeyEvent.wVirtualKeyCode==VK_TAB)
{
switch(TabKey)
{
case 1:
{
GotoXY(2,6);
TabKey++;
}break;
case 2:
{
GotoXY(26,6);
TabKey++;
}break;
case 3:
{
GotoXY(56,6);
TabKey++;
}break;
default:TabKey=1;
}
}
}
//DelayMS(100);
}
}
void GotoXY(int x,int y)
{
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(hOut,&csbiInfo);
csbiInfo.dwCursorPosition.X = x;
csbiInfo.dwCursorPosition.Y = y;
SetConsoleCursorPosition(hOut,csbiInfo.dwCursorPosition);
}
忘了把函数头贴上了,自己补上吧,大概
ReadConsoleInput,
GetConsoleScreenBufferInfo,
SetConsoleCursorPosition,
WriteConsoleOutputCharacter,
请问各位大神上面的四个函数加到哪里去啊?
而且这四个函数有什么用吗?