- 积分
- 7
- 最后登录
- 2018-1-31
- 阅读权限
- 10
- 积分
- 7
- 帖子
- 27
- 精华
- 1
TA的每日心情 | 郁闷 2026-2-11 11:36 |
|---|
签到天数: 8 天 连续签到: 1 天 [LV.3]偶尔看看II 老百姓

- UID
- 14
- 小七币
- 33
- 贡献
- 2
- 在线时间
- 6 小时
- 注册时间
- 2011-12-26
|
Keyboard.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("MainForm.cpp", Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------
MainForm.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "MainForm.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
this->Edit1->Text="";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn2Click(TObject *Sender)
{
this->Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
int iType=GetKeyboardType(0);
switch(iType)
{
case 1:
this->Edit1->Text="IBM PC/XT or compatible (83-key) keyboard";
break;
case 2:
this->Edit1->Text="Olivetti 'ICO' (102-key) keyboard";
break;
case 3:
this->Edit1->Text="IBM PC/AT (84-key) or similar keyboard";
break;
case 4:
this->Edit1->Text="IBM enhanced (101- or 102-key) keyboard";
break;
case 5:
this->Edit1->Text="Nokia 1050 and similar keyboards";
break;
case 6:
this->Edit1->Text="Nokia 9140 and similar keyboards";
break;
case 7:
this->Edit1->Text="Japanese keyboard";
break;
}
}
//---------------------------------------------------------------------------
MainForm.h
//---------------------------------------------------------------------------
#ifndef MainFormH
#define MainFormH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TLabel *Label1;
TEdit *Edit1;
TBitBtn *BitBtn1;
TBitBtn *BitBtn2;
void __fastcall BitBtn2Click(TObject *Sender);
void __fastcall BitBtn1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
|
|