接以前的,弹出messagebox的时候,修改其按钮文字

来源:互联网 发布:如何快速学习php 编辑:程序博客网 时间:2024/05/21 09:50
 
void CTestmessageboxDlg::OnButton1() {// TODO: Add your control notification handler code hereAfxMessageBox( _T( "请看确定按钮的文字" ) );}WNDPROC lpfnOldProc = 0; LRESULT CALLBACK SCWndProc(HWND hWnd, UINT wMsg, WPARAM wParam,LPARAM lParam){switch (wMsg){case WM_ACTIVATE:if( WA_INACTIVE == wParam ){HWND hwnd;TCHAR classname[ 0x200 ];hwnd = ( HWND )lParam;memset( classname, 0, sizeof( classname ) );GetClassName( hwnd, classname, sizeof( classname ) / sizeof( TCHAR ) );if( !_tcsncmp( classname, _T( "#32770" ), 6 ) ){DWORD processid;GetWindowThreadProcessId( hwnd, &processid );if( processid == GetCurrentProcessId() ){HWND hwndbutton = ::FindWindowEx( hwnd, NULL, NULL, _T( "确定" ) );if( hwndbutton ){::SetWindowText( hwndbutton, _T( "不  确定" ) );}}}}return TRUE;break;}  return CallWindowProc (lpfnOldProc, hWnd, wMsg, wParam, lParam); }  BOOL CTestmessageboxDlg::OnInitDialog(){CDialog::OnInitDialog();// Set the icon for this dialog.  The framework does this automatically//  when the application's main window is not a dialogSetIcon(m_hIcon, TRUE);// Set big iconSetIcon(m_hIcon, FALSE);// Set small icon// TODO: Add extra initialization herelpfnOldProc = ( WNDPROC )GetWindowLong( this->GetSafeHwnd(), DWL_DLGPROC );SetWindowLong( this->GetSafeHwnd(), DWL_DLGPROC, ( LONG )SCWndProc );return TRUE;  // return TRUE  unless you set the focus to a control}

原创粉丝点击