PDA

View Full Version : سوال: تایید به جای OK در دکمه مسیج باکس



MehdiElexal
دوشنبه 01 شهریور 1389, 21:46 عصر
سلامی مجدد
چطور میتونم به جای دکمه OK در مسیج باکسم تایید باشه؟

Shahram_Shobeiri
دوشنبه 01 شهریور 1389, 21:55 عصر
تو همین سایت «مسیج باکس فارسی» رو سرچ کن

nasim bahari
دوشنبه 01 شهریور 1389, 21:56 عصر
سلام........دوست عزیز

یه کلاس واسه مسیج باکس فارسی گذاشتم....امید وارم منظورت همین بوده باشه...




Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text

Public Class MessageBoxFa
Public Delegate Function CallBack_WinProc(ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Public Delegate Function CallBack_EnumWinProc(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer

<DllImport("user32.dll")> _
Private Shared Function GetWindowLong(ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
End Function
<DllImport("kernel32.dll")> _
Private Shared Function GetCurrentThreadId() As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function SetWindowsHookEx(ByVal idHook As Integer, ByVal lpfn As CallBack_WinProc, ByVal hmod As Integer, ByVal dwThreadId As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function UnhookWindowsHookEx(ByVal hHook As Integer) As Integer
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Private Shared Function SetWindowText(ByVal hwnd As Integer, ByVal lpString As String) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function EnumChildWindows(ByVal hWndParent As Integer, ByVal lpEnumFunc As CallBack_EnumWinProc, ByVal lParam As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function GetClassName(ByVal hwnd As Integer, ByVal lpClassName As StringBuilder, ByVal nMaxCount As Integer) As Integer
End Function

Shared TopCount As Integer
Shared ButtonCount As Integer
Private Const GWL_HINSTANCE As Integer = (-6)
Private Const HCBT_ACTIVATE As Integer = 5
Private Const WH_CBT As Integer = 5
Private Shared hHook As Integer
Shared strCaption1 As String = ""
Shared strCaption2 As String = ""
Shared strCaption3 As String = ""
Shared Drk As New Form

Shared Function Show(ByVal Prompt As String _
, Optional ByVal Title As String = "", Optional ByVal buttons As MessageBoxButtons = MessageBoxButtons.OK _
, Optional ByVal icon As MessageBoxIcon = MessageBoxIcon.None _
, Optional ByVal DefaultButton As MessageBoxDefaultButton = MessageBoxDefaultButton.Button1 _
, Optional ByVal options As MessageBoxOptions = MessageBoxOptions.RtlReading _
, Optional ByVal m As MsgBoxStyle = MsgBoxStyle.ApplicationModal) As DialogResult
'
Dim hInst As Integer
Dim Thread As Integer
TopCount = 0
ButtonCount = 0
Select Case (buttons)
Case MessageBoxButtons.AbortRetryIgnore
strCaption1 = "رها کردن"
strCaption2 = "کوشش مجدد"
strCaption3 = "چشم پوشی"
Case MessageBoxButtons.OK
strCaption1 = "تایید"
Case MessageBoxButtons.OKCancel
strCaption1 = "تایید"
strCaption2 = "لغو"
Case MessageBoxButtons.RetryCancel
strCaption1 = "کوشش مجدد"
strCaption2 = "لغو"
Case MessageBoxButtons.YesNo
strCaption1 = "بله"
strCaption2 = "خیر"
Case MessageBoxButtons.YesNoCancel
strCaption1 = "بله"
strCaption2 = "خیر"
strCaption3 = "لغو"
Case MessageBoxButtons.OK
strCaption1 = "تایید"
End Select
'If Title = "" Then Title = Application.ProductName
Dim myWndProc As CallBack_WinProc = New CallBack_WinProc(AddressOf WinProc)
hInst = GetWindowLong(1, GWL_HINSTANCE)
Thread = GetCurrentThreadId()
hHook = SetWindowsHookEx(WH_CBT, myWndProc, hInst, Thread)
'Return MessageBox.Show(Prompt, Title, buttons, icon, DefaultButton, options)

Return MsgBox(Prompt, buttons + icon + DefaultButton + MsgBoxStyle.MsgBoxRight + options + m, Title)
End Function

Private Shared Function WinProc(ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Dim myEnumProc As CallBack_EnumWinProc = New CallBack_EnumWinProc(AddressOf EnumWinProc)
If uMsg = HCBT_ACTIVATE Then
EnumChildWindows(wParam, myEnumProc, 0)
UnhookWindowsHookEx(hHook)
End If
Return 0
End Function

Private Shared Function EnumWinProc(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer
Dim sal_mali As Integer
Dim strBuffer As StringBuilder = New StringBuilder(256)
TopCount += 1
GetClassName(hWnd, strBuffer, strBuffer.Capacity)
Dim ss As String = strBuffer.ToString()
If (ss.ToUpper().StartsWith("BUTTON")) Then
ButtonCount += 1
Select Case (ButtonCount)
Case 1
SetWindowText(hWnd, strCaption1)
Exit Select
Case 2
SetWindowText(hWnd, strCaption2)
Exit Select
Case 3
SetWindowText(hWnd, strCaption3)
Exit Select
End Select
End If
Return sal_mali
End Function
End Class

موفق باشین

naser_feb8646
سه شنبه 02 شهریور 1389, 01:19 صبح
سلام
دوست عزیز فکر کنم این کامپوننت کارتو راه بندازه


http://www.barnamenevis.org/forum/attachment.php?attachmentid=37156&d=1253348316 (http://www.barnamenevis.org/forum/attachment.php?attachmentid=37156&d=1253348316)

Saman_12
سه شنبه 02 شهریور 1389, 03:28 صبح
سلام.
با اینکه جواب های دوستان کامل هست اما من نظر خودم رو دارم :
شما میتونید یک فورم به صورت مسیج باکس درست کنید و از اون استفاده کنید.(با یکم کد نویسی میشه یه مسیج باکس رو شبیه سازی کرد.)

nasim bahari
سه شنبه 02 شهریور 1389, 11:10 صبح
سلام
دوست عزیز فکر کنم این کامپوننت کارتو راه بندازه


http://www.barnamenevis.org/forum/attachment.php?attachmentid=37156&d=1253348316 (http://www.barnamenevis.org/forum/attachment.php?attachmentid=37156&d=1253348316)

سلام....دوست عزیز

از اینکه در تایپیک شرکت کردین ممنون.....

اما من فکر می کنم از کلاسی که گذاشتم استفاده نمایید بهتر باشه تا از کامپوننت استفاده نمایید. زیرا شما به راحتی می توانید تغییرات دلخواهتون مثل اسم دکمه ها رو تغییر بدین. در حالی که در زمان استفاده از کامپوننت نمی توانید این کار رو به راحتی انجام بدین......

موفق باشین

naser_feb8646
سه شنبه 02 شهریور 1389, 23:31 عصر
سلام....دوست عزیز

از اینکه در تایپیک شرکت کردین ممنون.....

اما من فکر می کنم از کلاسی که گذاشتم استفاده نمایید بهتر باشه تا از کامپوننت استفاده نمایید. زیرا شما به راحتی می توانید تغییرات دلخواهتون مثل اسم دکمه ها رو تغییر بدین. در حالی که در زمان استفاده از کامپوننت نمی توانید این کار رو به راحتی انجام بدین......

موفق باشین

سلام
دوست عزیز بنده هم با صحبتهای شما کاملاً موافقم یه برنامه وقتی برنامه می شه که برنامه نویسش تمام کد ها رو خودش نوشته باشه اما گاهی وقتها استفاده از تجربه دیگران می تونه سرعت کار خیلی بالاتر ببره

یاعلی

morrning
سه شنبه 02 شهریور 1389, 23:40 عصر
سلام.
با اینکه جواب های دوستان کامل هست اما من نظر خودم رو دارم :
شما میتونید یک فورم به صورت مسیج باکس درست کنید و از اون استفاده کنید.(با یکم کد نویسی میشه یه مسیج باکس رو شبیه سازی کرد.)

با نظر شما موافقم چون استفاده از فرم انعطاف بیشتری داره و کار باهاش راحت تره در ضمن کد نویسیش هم در حد صفره

FastCode
چهارشنبه 03 شهریور 1389, 00:01 صبح
سلام.
با اینکه جواب های دوستان کامل هست اما من نظر خودم رو دارم :
شما میتونید یک فورم به صورت مسیج باکس درست کنید و از اون استفاده کنید.(با یکم کد نویسی میشه یه مسیج باکس رو شبیه سازی کرد.)
من ۱۰ بار این کار رو کردم.چیز خوبی از کار در نیومده.

از دوستان اگر کسی چیزی درست کرد که احساس کرد حرفی برای گفتن داره یه مقدار ار تجربیاتش در طول پروژه رو به ما هم بگه که فیض ببریم.

mahdi_1986
چهارشنبه 03 شهریور 1389, 02:01 صبح
سلام....دوست عزیز

از اینکه در تایپیک شرکت کردین ممنون.....

اما من فکر می کنم از کلاسی که گذاشتم استفاده نمایید بهتر باشه تا از کامپوننت استفاده نمایید. زیرا شما به راحتی می توانید تغییرات دلخواهتون مثل اسم دکمه ها رو تغییر بدین. در حالی که در زمان استفاده از کامپوننت نمی توانید این کار رو به راحتی انجام بدین......

موفق باشین

با سلام
با تشکر از کلاسي که شما گذاشتيد
ولي وقتي از اين کلاس استفاده مي‌کنم تنها يک دکمه به صورت فارسي نمايش داده ميشه؟

Saman_12
چهارشنبه 03 شهریور 1389, 04:52 صبح
اون دوستانی که گفتن خوب در نمیاد من یه دونه ساختم که سه تا از حالت های مسیج باکس رو پشتی بانی می کنه با گرافیک مناسب , البته هنوز می گم کمی کد نویسی داره مگه اینکه شما دوستان بخواید برای یک مسیج باکس ساده چندین تا فرم Add کنید :
"اینم سورس مسیج باکس طرا حی شده" (http://italia-host.coolpage.biz/uploads/1282706269.rar)
دوستان اگه کسی دانلود کرد و دوست داشت نظرش رو بگه تا دیگران هم از نظر شما با خبر بشوند.

modirmasool
چهارشنبه 03 شهریور 1389, 14:12 عصر
اون دوستانی که گفتن خوب در نمیاد من یه دونه ساختم که سه تا از حالت های مسیج باکس رو پشتی بانی می کنه با گرافیک مناسب , البته هنوز می گم کمی کد نویسی داره مگه اینکه شما دوستان بخواید برای یک مسیج باکس ساده چندین تا فرم Add کنید :
"اینم سورس مسیج باکس طرا حی شده" (http://italia-host.coolpage.biz/uploads/1282706269.rar)
دوستان اگه کسی دانلود کرد و دوست داشت نظرش رو بگه تا دیگران هم از نظر شما با خبر بشوند.

خوب بود. دیگه ظاهرش بستگی به خودمون داره و کاری نداره. به نظر من این کار خیلی بهتره و دستمون بازتر میشه.

parselearn
پنج شنبه 04 شهریور 1389, 04:19 صبح
نمي دونم اين كامپوننت در .net كار ميكنه يا نه، امتحان كنيد
http://barnamenevis.org/forum/showpost.php?p=777637&postcount=347

Saman_12
پنج شنبه 04 شهریور 1389, 05:39 صبح
نمي دونم اين كامپوننت در .net كار ميكنه يا نه، امتحان كنيد
http://barnamenevis.org/forum/showpost.php?p=777637&postcount=347
دوست عزیز از اینکه توی این تایپیک شرکت کردین خیلی خوشحالم ولی .....
مشکل اینجاست که ما می خوایم انعطاف پذیری داشته باشه.
پست 6 رو یه نگاه بیندازین.

y.saied
جمعه 27 بهمن 1391, 22:33 عصر
سلام، میشه نحوه استفاده شو هم بفرمایین
ممنون




سلام........دوست عزیز

یه کلاس واسه مسیج باکس فارسی گذاشتم....امید وارم منظورت همین بوده باشه...




Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text

Public Class MessageBoxFa
Public Delegate Function CallBack_WinProc(ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Public Delegate Function CallBack_EnumWinProc(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer

<DllImport("user32.dll")> _
Private Shared Function GetWindowLong(ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
End Function
<DllImport("kernel32.dll")> _
Private Shared Function GetCurrentThreadId() As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function SetWindowsHookEx(ByVal idHook As Integer, ByVal lpfn As CallBack_WinProc, ByVal hmod As Integer, ByVal dwThreadId As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function UnhookWindowsHookEx(ByVal hHook As Integer) As Integer
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Private Shared Function SetWindowText(ByVal hwnd As Integer, ByVal lpString As String) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function EnumChildWindows(ByVal hWndParent As Integer, ByVal lpEnumFunc As CallBack_EnumWinProc, ByVal lParam As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function GetClassName(ByVal hwnd As Integer, ByVal lpClassName As StringBuilder, ByVal nMaxCount As Integer) As Integer
End Function

Shared TopCount As Integer
Shared ButtonCount As Integer
Private Const GWL_HINSTANCE As Integer = (-6)
Private Const HCBT_ACTIVATE As Integer = 5
Private Const WH_CBT As Integer = 5
Private Shared hHook As Integer
Shared strCaption1 As String = ""
Shared strCaption2 As String = ""
Shared strCaption3 As String = ""
Shared Drk As New Form

Shared Function Show(ByVal Prompt As String _
, Optional ByVal Title As String = "", Optional ByVal buttons As MessageBoxButtons = MessageBoxButtons.OK _
, Optional ByVal icon As MessageBoxIcon = MessageBoxIcon.None _
, Optional ByVal DefaultButton As MessageBoxDefaultButton = MessageBoxDefaultButton.Button1 _
, Optional ByVal options As MessageBoxOptions = MessageBoxOptions.RtlReading _
, Optional ByVal m As MsgBoxStyle = MsgBoxStyle.ApplicationModal) As DialogResult
'
Dim hInst As Integer
Dim Thread As Integer
TopCount = 0
ButtonCount = 0
Select Case (buttons)
Case MessageBoxButtons.AbortRetryIgnore
strCaption1 = "رها کردن"
strCaption2 = "کوشش مجدد"
strCaption3 = "چشم پوشی"
Case MessageBoxButtons.OK
strCaption1 = "تایید"
Case MessageBoxButtons.OKCancel
strCaption1 = "تایید"
strCaption2 = "لغو"
Case MessageBoxButtons.RetryCancel
strCaption1 = "کوشش مجدد"
strCaption2 = "لغو"
Case MessageBoxButtons.YesNo
strCaption1 = "بله"
strCaption2 = "خیر"
Case MessageBoxButtons.YesNoCancel
strCaption1 = "بله"
strCaption2 = "خیر"
strCaption3 = "لغو"
Case MessageBoxButtons.OK
strCaption1 = "تایید"
End Select
'If Title = "" Then Title = Application.ProductName
Dim myWndProc As CallBack_WinProc = New CallBack_WinProc(AddressOf WinProc)
hInst = GetWindowLong(1, GWL_HINSTANCE)
Thread = GetCurrentThreadId()
hHook = SetWindowsHookEx(WH_CBT, myWndProc, hInst, Thread)
'Return MessageBox.Show(Prompt, Title, buttons, icon, DefaultButton, options)

Return MsgBox(Prompt, buttons + icon + DefaultButton + MsgBoxStyle.MsgBoxRight + options + m, Title)
End Function

Private Shared Function WinProc(ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Dim myEnumProc As CallBack_EnumWinProc = New CallBack_EnumWinProc(AddressOf EnumWinProc)
If uMsg = HCBT_ACTIVATE Then
EnumChildWindows(wParam, myEnumProc, 0)
UnhookWindowsHookEx(hHook)
End If
Return 0
End Function

Private Shared Function EnumWinProc(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer
Dim sal_mali As Integer
Dim strBuffer As StringBuilder = New StringBuilder(256)
TopCount += 1
GetClassName(hWnd, strBuffer, strBuffer.Capacity)
Dim ss As String = strBuffer.ToString()
If (ss.ToUpper().StartsWith("BUTTON")) Then
ButtonCount += 1
Select Case (ButtonCount)
Case 1
SetWindowText(hWnd, strCaption1)
Exit Select
Case 2
SetWindowText(hWnd, strCaption2)
Exit Select
Case 3
SetWindowText(hWnd, strCaption3)
Exit Select
End Select
End If
Return sal_mali
End Function
End Class

موفق باشین

ghayour
جمعه 27 بهمن 1391, 23:24 عصر
سلام
ابتدا یک کلاس با نام MessageBoxFa ایجاد کنید سپس مانند مسیج باکس خود ویژوال استفاده کنید.
به عنوان مثال:
MessageBoxFa.Show("ghayour")

y.saied
شنبه 28 بهمن 1391, 00:39 صبح
سلام
امکانش هس که فونت متن پیغام رو به Tahoma تغییر بدیم؟؟
میشه زحمتشو بکشین
ممنون



سلام........دوست عزیز

یه کلاس واسه مسیج باکس فارسی گذاشتم....امید وارم منظورت همین بوده باشه...




Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text

Public Class MessageBoxFa
Public Delegate Function CallBack_WinProc(ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Public Delegate Function CallBack_EnumWinProc(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer

<DllImport("user32.dll")> _
Private Shared Function GetWindowLong(ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
End Function
<DllImport("kernel32.dll")> _
Private Shared Function GetCurrentThreadId() As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function SetWindowsHookEx(ByVal idHook As Integer, ByVal lpfn As CallBack_WinProc, ByVal hmod As Integer, ByVal dwThreadId As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function UnhookWindowsHookEx(ByVal hHook As Integer) As Integer
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Private Shared Function SetWindowText(ByVal hwnd As Integer, ByVal lpString As String) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function EnumChildWindows(ByVal hWndParent As Integer, ByVal lpEnumFunc As CallBack_EnumWinProc, ByVal lParam As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function GetClassName(ByVal hwnd As Integer, ByVal lpClassName As StringBuilder, ByVal nMaxCount As Integer) As Integer
End Function

Shared TopCount As Integer
Shared ButtonCount As Integer
Private Const GWL_HINSTANCE As Integer = (-6)
Private Const HCBT_ACTIVATE As Integer = 5
Private Const WH_CBT As Integer = 5
Private Shared hHook As Integer
Shared strCaption1 As String = ""
Shared strCaption2 As String = ""
Shared strCaption3 As String = ""
Shared Drk As New Form

Shared Function Show(ByVal Prompt As String _
, Optional ByVal Title As String = "", Optional ByVal buttons As MessageBoxButtons = MessageBoxButtons.OK _
, Optional ByVal icon As MessageBoxIcon = MessageBoxIcon.None _
, Optional ByVal DefaultButton As MessageBoxDefaultButton = MessageBoxDefaultButton.Button1 _
, Optional ByVal options As MessageBoxOptions = MessageBoxOptions.RtlReading _
, Optional ByVal m As MsgBoxStyle = MsgBoxStyle.ApplicationModal) As DialogResult
'
Dim hInst As Integer
Dim Thread As Integer
TopCount = 0
ButtonCount = 0
Select Case (buttons)
Case MessageBoxButtons.AbortRetryIgnore
strCaption1 = "رها کردن"
strCaption2 = "کوشش مجدد"
strCaption3 = "چشم پوشی"
Case MessageBoxButtons.OK
strCaption1 = "تایید"
Case MessageBoxButtons.OKCancel
strCaption1 = "تایید"
strCaption2 = "لغو"
Case MessageBoxButtons.RetryCancel
strCaption1 = "کوشش مجدد"
strCaption2 = "لغو"
Case MessageBoxButtons.YesNo
strCaption1 = "بله"
strCaption2 = "خیر"
Case MessageBoxButtons.YesNoCancel
strCaption1 = "بله"
strCaption2 = "خیر"
strCaption3 = "لغو"
Case MessageBoxButtons.OK
strCaption1 = "تایید"
End Select
'If Title = "" Then Title = Application.ProductName
Dim myWndProc As CallBack_WinProc = New CallBack_WinProc(AddressOf WinProc)
hInst = GetWindowLong(1, GWL_HINSTANCE)
Thread = GetCurrentThreadId()
hHook = SetWindowsHookEx(WH_CBT, myWndProc, hInst, Thread)
'Return MessageBox.Show(Prompt, Title, buttons, icon, DefaultButton, options)

Return MsgBox(Prompt, buttons + icon + DefaultButton + MsgBoxStyle.MsgBoxRight + options + m, Title)
End Function

Private Shared Function WinProc(ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Dim myEnumProc As CallBack_EnumWinProc = New CallBack_EnumWinProc(AddressOf EnumWinProc)
If uMsg = HCBT_ACTIVATE Then
EnumChildWindows(wParam, myEnumProc, 0)
UnhookWindowsHookEx(hHook)
End If
Return 0
End Function

Private Shared Function EnumWinProc(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer
Dim sal_mali As Integer
Dim strBuffer As StringBuilder = New StringBuilder(256)
TopCount += 1
GetClassName(hWnd, strBuffer, strBuffer.Capacity)
Dim ss As String = strBuffer.ToString()
If (ss.ToUpper().StartsWith("BUTTON")) Then
ButtonCount += 1
Select Case (ButtonCount)
Case 1
SetWindowText(hWnd, strCaption1)
Exit Select
Case 2
SetWindowText(hWnd, strCaption2)
Exit Select
Case 3
SetWindowText(hWnd, strCaption3)
Exit Select
End Select
End If
Return sal_mali
End Function
End Class

موفق باشین

y.saied
شنبه 28 بهمن 1391, 00:54 صبح
سلام
تو این کلاس ، امکانش هس که فونت مسیج رو به Tahoma تغییر بدین




سلام........دوست عزیز

یه کلاس واسه مسیج باکس فارسی گذاشتم....امید وارم منظورت همین بوده باشه...




Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text

Public Class MessageBoxFa
Public Delegate Function CallBack_WinProc(ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Public Delegate Function CallBack_EnumWinProc(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer

<DllImport("user32.dll")> _
Private Shared Function GetWindowLong(ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
End Function
<DllImport("kernel32.dll")> _
Private Shared Function GetCurrentThreadId() As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function SetWindowsHookEx(ByVal idHook As Integer, ByVal lpfn As CallBack_WinProc, ByVal hmod As Integer, ByVal dwThreadId As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function UnhookWindowsHookEx(ByVal hHook As Integer) As Integer
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Private Shared Function SetWindowText(ByVal hwnd As Integer, ByVal lpString As String) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function EnumChildWindows(ByVal hWndParent As Integer, ByVal lpEnumFunc As CallBack_EnumWinProc, ByVal lParam As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function GetClassName(ByVal hwnd As Integer, ByVal lpClassName As StringBuilder, ByVal nMaxCount As Integer) As Integer
End Function

Shared TopCount As Integer
Shared ButtonCount As Integer
Private Const GWL_HINSTANCE As Integer = (-6)
Private Const HCBT_ACTIVATE As Integer = 5
Private Const WH_CBT As Integer = 5
Private Shared hHook As Integer
Shared strCaption1 As String = ""
Shared strCaption2 As String = ""
Shared strCaption3 As String = ""
Shared Drk As New Form

Shared Function Show(ByVal Prompt As String _
, Optional ByVal Title As String = "", Optional ByVal buttons As MessageBoxButtons = MessageBoxButtons.OK _
, Optional ByVal icon As MessageBoxIcon = MessageBoxIcon.None _
, Optional ByVal DefaultButton As MessageBoxDefaultButton = MessageBoxDefaultButton.Button1 _
, Optional ByVal options As MessageBoxOptions = MessageBoxOptions.RtlReading _
, Optional ByVal m As MsgBoxStyle = MsgBoxStyle.ApplicationModal) As DialogResult
'
Dim hInst As Integer
Dim Thread As Integer
TopCount = 0
ButtonCount = 0
Select Case (buttons)
Case MessageBoxButtons.AbortRetryIgnore
strCaption1 = "رها کردن"
strCaption2 = "کوشش مجدد"
strCaption3 = "چشم پوشی"
Case MessageBoxButtons.OK
strCaption1 = "تایید"
Case MessageBoxButtons.OKCancel
strCaption1 = "تایید"
strCaption2 = "لغو"
Case MessageBoxButtons.RetryCancel
strCaption1 = "کوشش مجدد"
strCaption2 = "لغو"
Case MessageBoxButtons.YesNo
strCaption1 = "بله"
strCaption2 = "خیر"
Case MessageBoxButtons.YesNoCancel
strCaption1 = "بله"
strCaption2 = "خیر"
strCaption3 = "لغو"
Case MessageBoxButtons.OK
strCaption1 = "تایید"
End Select
'If Title = "" Then Title = Application.ProductName
Dim myWndProc As CallBack_WinProc = New CallBack_WinProc(AddressOf WinProc)
hInst = GetWindowLong(1, GWL_HINSTANCE)
Thread = GetCurrentThreadId()
hHook = SetWindowsHookEx(WH_CBT, myWndProc, hInst, Thread)
'Return MessageBox.Show(Prompt, Title, buttons, icon, DefaultButton, options)

Return MsgBox(Prompt, buttons + icon + DefaultButton + MsgBoxStyle.MsgBoxRight + options + m, Title)
End Function

Private Shared Function WinProc(ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Dim myEnumProc As CallBack_EnumWinProc = New CallBack_EnumWinProc(AddressOf EnumWinProc)
If uMsg = HCBT_ACTIVATE Then
EnumChildWindows(wParam, myEnumProc, 0)
UnhookWindowsHookEx(hHook)
End If
Return 0
End Function

Private Shared Function EnumWinProc(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer
Dim sal_mali As Integer
Dim strBuffer As StringBuilder = New StringBuilder(256)
TopCount += 1
GetClassName(hWnd, strBuffer, strBuffer.Capacity)
Dim ss As String = strBuffer.ToString()
If (ss.ToUpper().StartsWith("BUTTON")) Then
ButtonCount += 1
Select Case (ButtonCount)
Case 1
SetWindowText(hWnd, strCaption1)
Exit Select
Case 2
SetWindowText(hWnd, strCaption2)
Exit Select
Case 3
SetWindowText(hWnd, strCaption3)
Exit Select
End Select
End If
Return sal_mali
End Function
End Class

موفق باشین