wxWidgets 几个实用的系统函数

本文通过示例代码展示了如何使用wxWidgets库来获取系统的相关信息,包括用户的家目录、操作系统描述、用户名、用户ID、电子邮件地址、主机名、可用内存大小等。

http://www.cnblogs.com/godspeedsam/archive/2011/03/15/1984875.html

代码说话,各函数功能一目了然:

复制代码
  
1 void shelltest() 2 {
3 wxExecute(wxT( " notepad.exe newfile.txt " )); 4 } 5 6 void sysutils() 7 { 8 wxString output(wxT( " Home dir: " )); 9 output << wxGetHomeDir(); 10 output << wxT( " \nOs Description: " ) << wxGetOsDescription(); 11 output << wxT( " \nUse Name: " ) << wxGetUserName(); 12 output << wxT( " \nUser Id: " ) << wxGetUserId(); 13 output << wxT( " \nEmail Address: " ) << wxGetEmailAddress(); 14 output << wxT( " \nFull Host Name: " ) << wxGetFullHostName(); 15 output << wxString::Format(wxT( " \nFree Memory:%.2fG " ),( double )wxGetFreeMemory().ToLong() / 1024 / 1024 / 1024 ); 16 output << wxString::Format(wxT( " \n64bit?%s " ),wxIsPlatform64Bit() ? wxT( " Yes " ):wxT( " No " )); 17 output << wxString::Format(wxT( " \nLittle Endian?%s " ),wxIsPlatformLittleEndian() ? wxT( " Yes " ):wxT( " No " )); 18 cout << output << endl; 19 }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值