回 帖 发 新 帖 刷新版面

主题:在关于窗口中显示系统信息。

#include <vcl.h>
#pragma hdrstop
#include <stdio.h>
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------
#pragma resource "*.dfm"
TAboutBox *AboutBox;
//---------------------------------------------------------------------
__fastcall TAboutBox::TAboutBox(TComponent* AOwner)
: TForm(AOwner)
{
}
//---------------------------------------------------------------------
void __fastcall TAboutBox::OKButtonClick(TObject *Sender)
{
Close();        
}
//----------------------------------------------------------------------void __fastcall TAboutBox::FormCreate(TObject *Sender)
{
Label3->Caption="作者:fff";
TOSVersionInfo VerInfo;
AnsiString OSName;
VerInfo.dwOSVersionInfoSize=sizeof(VerInfo);
if(GetVersionEx(&VerInfo))
{
  switch(VerInfo.dwPlatformId)
  {
    case VER_PLATFORM_WIN32s:
       OSName="Win32s";
       break;
     case VER_PLATFORM_WIN32_WINDOWS:
       OSName="Windows95/98";
        break;
     case VER_PLATFORM_WIN32_NT:
       OSName="Windows NT";
       break;
    default:
      break;  //检测体统版本
    }
   Label5->Caption=AnsiString(OSName+" Version"+IntToStr(VerInfo.dwMajorVersion)
+"."+IntToStr(VerInfo.dwMinorVersion));
  }
TMemoryStatus Ms;
Ms.dwLength=sizeof(Ms);
GlobalMemoryStatus(&Ms);
AboutBox->Label1->Caption=FormatFloat((AnsiString)"#,###'KB'",Ms.dwTotalPhys/1024);
LPSTR lpMemLoad=new char[5];
sprintf(lpMemLoad,"%d%%",Ms.dwMemoryLoad);
AboutBox->Label2->Caption=(AnsiString)lpMemLoad;
delete[] lpMemLoad;    //检测内存与使用率
}
//------------------------------------------------------------------------

回复列表 (共4个回复)

沙发

这么麻烦,不会用ShellAbout ?

板凳

密码老不对

3 楼

[em10]

4 楼

怎么不加一些注释呀!
这样让人看起来很是麻烦呀!

我来回复

您尚未登录,请登录后再回复。点此登录或注册