C # modify MessageBox

Source: Internet
Author: User

Refer to the following two articlesArticleThe English dialog box is displayed on the Chinese system. I am very happy that this problem has plagued me for three days. Now we have finally solved the problem.

Key words: Using Hook Functions in C.

Http://www.codeproject.com/cpp/dMsgBox.asp
How to change the MessageBox window
Http://www.codeproject.com/cs/miscctrl/MessageBoxChk.asp
A "don't show this again" checkbox for the. NET MessageBox

Constructor

Public messageboxinternal ()
{
//
// Todo: Add constructor logic here
//
M_cbt = new localcbthook ();
M_cbt.windowcreated + = new localcbthook. cbteventhandler (wndcreated );
M_cbt.windowdestroyed + = new localcbthook. cbteventhandler (wnddestroyed );
M_cbt.windowactivated + = new localcbthook. cbteventhandler (wndactivated );
}

Private void wndcreated (Object sender, cbteventargs E)
{

If (E. isdialogwindow)
{
M_binit = false;
M_hwnd = E. Handle;
}
}

Private void wnddestroyed (Object sender, cbteventargs E)
{
If (E. Handle = m_hwnd)
{
M_binit = false;
M_hwnd = intptr. zero;
// If (bst_checked = (INT) sendmessage (m_hwndbtn, bm_getcheck, intptr. Zero, intptr. Zero ))
// M_bcheck = true;
}
}

Private void wndactivated (Object sender, cbteventargs E)
{
If (m_hwnd! = E. Handle)
Return;

// Not the first time
If (m_binit)
Return;
Else
M_binit = true;

If (thread. currentthread. currentuiculture. lcid = (new system. Globalization. cultureinfo ("En-us"). lcid)
{
Setdlgitemtext (m_hwnd, idok, "& OK ");
Setdlgitemtext (m_hwnd, idcancel, "& cancel ");
Setdlgitemtext (m_hwnd, idabort, "& abort ");
Setdlgitemtext (m_hwnd, idretry, "& retry ");
Setdlgitemtext (m_hwnd, idignore, "& ignore ");
Setdlgitemtext (m_hwnd, idyes, "& yes ");
Setdlgitemtext (m_hwnd, IDNO, "& No ");
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.