VC开发中的若干经验(2008-08-20更新)

//**********************************************************************

//如何控制可执行程序的执行(等待外部可执行程序运行完毕)

SHELLEXECUTEINFO ShExecInfo;
memset(&ShExecInfo,0,sizeof(SHELLEXECUTEINFO));
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "c://MyProgram.exe";
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
::ShellExecuteEx(&ShExecInfo);
if(ShExecInfo.hProcess)
{
 ::WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
 ::CloseHandle(ShExecInfo.hProcess);
}

 

//**********************************************************************

//得到系统分辨率
GetSystemMetris(SM_CXSCREEN);
GetSystemMetris(SM_CYSCREEN);

 

//**********************************************************************

CRect   rect;

GetWindowRect(&rect);  //取窗口大小  
GetClientRect(&rect);  //取客户区大小
ClientToScreen(&rect);  //客户区转到屏幕  
ScreenToClient(&rect);  //屏幕转到客户区

 

//**********************************************************************

AfxGetMainWnd()->SetWindowText("Application Title");  //更改应用程序主窗口标题
GetParentFrame()->SetWindowText("MDI Child Frame Title"); //更改MDI子窗口
GetDlgItem(IDC_BUTTON)->SetWindowText("Control Title");  //更改对话框控件标题

 

//**********************************************************************

//二维数组

char **level;

//构造
level = new char * [width];
for(int x = 0;x < width; x++)
 level[x] = new char [height];

//释放
for(int x = 0;x < width; x++)
 delete level[x];
delete [] level;

 

//**********************************************************************

//阻止窗体按下Enter或Esc后就退出

1.把OnOK()与OnCancle()掏空。注意函数架子别去掉
2.在你要退出dlg的地方调用CDialog::OnOK()或OnCancel()既可

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值