PDA

View Full Version : message box فارسی



saeid.memfis
دوشنبه 19 بهمن 1388, 12:41 عصر
سلام دوستان
من یک messagebox فارسی لازم دارم با همه امکانات
سرچ کردم چند تا هم پیدا کردم ولی یا کار نمی کرد یا مشکل داشت و اسم برنامه نویسش روش بود
ممنون میشم برام بزارید(فوریه)
ممنون

mmd2009
دوشنبه 19 بهمن 1388, 12:54 عصر
منظورت همچین چیزیه؟؟؟؟؟




MsgBox("Programmer : Alireza Zare" & vbCrLf & "Y-Mail : alireza_2297@yahoo.com" & vbCrLf & "G-Mail : jacksmith354@gmail.com" & vbCrLf & "Web : www.ali-virus.blogfa.com", vbExclamation, "INFO")

saeid.memfis
دوشنبه 19 بهمن 1388, 13:06 عصر
منظورت همچین چیزیه؟؟؟؟؟




MsgBox("Programmer : Alireza Zare" & vbCrLf & "Y-Mail : alireza_2297@yahoo.com" & vbCrLf & "G-Mail : jacksmith354@gmail.com" & vbCrLf & "Web : www.ali-virus.blogfa.com", vbExclamation, "INFO")


این خوشگل بود ولی من میخوام فارسی باشه
اگه کسی فارسیشو داره بزاره لطفا

sari-1369
دوشنبه 19 بهمن 1388, 13:25 عصر
اینو امتحان کن ، مطمعنم پشیمون نمیشی .

http://barnamenevis.org/forum/showpost.php?p=809652&postcount=5

mmd2009
دوشنبه 19 بهمن 1388, 14:40 عصر
این خوشگل بود ولی من میخوام فارسی باشه
اگه کسی فارسیشو داره بزاره لطفا

خوب عزیزم فارسیش کن خودت اینم یه مثال دیگه





MsgBox("برنامه نویس : علی رضا زارع" & vbCrLf & " alireza_2297@yahoo.com : ایمیل " & vbCrLf & " jacksmith354@gmail.com : جی میل " & vbCrLf & " www.ali-virus.blogfa.com : وبلاگ ", MsgBoxStyle.Information, "اطلاعات")



خودت روش کار کنی بهتر هم میشه

saeid.memfis
دوشنبه 19 بهمن 1388, 14:43 عصر
اینو امتحان کن ، مطمعنم پشیمون نمیشی .

http://barnamenevis.org/forum/showpost.php?p=809652&postcount=5

ممنون.من این گرفته بودم ولی کار نمی کرد
نتونستم ازش استفاده کنم.یه ارور می داد مبنی براینکه یک فایل با پسوند rtl (اگه اشتباه نکنم) رو پیدا نمی کنه
اگه درستش کنی بزطاری ممنون میشم

saeid.memfis
دوشنبه 19 بهمن 1388, 14:45 عصر
خوب عزیزم فارسیش کن خودت اینم یه مثال دیگه





MsgBox("برنامه نویس : علی رضا زارع" & vbCrLf & " alireza_2297@yahoo.com : ایمیل " & vbCrLf & " jacksmith354@gmail.com : جی میل " & vbCrLf & " www.ali-virus.blogfa.com : وبلاگ ", MsgBoxStyle.Information, "اطلاعات")

خودت روش کار کنی بهتر هم میشه
ممنون
ولی فکر می کنم شمات منظور منو متوجه نشدی...خودم میتونم فارسی بنویسم
می خوام کلیداش فارس باشه...مثلا برای ok بنویسه قبول و r2l باشه

bah_jaf
دوشنبه 19 بهمن 1388, 15:59 عصر
این یک کلاس هست فوق العاده هم خوب کار میکنه من تو همین جا پیداش کردم:
اینم نحوه کار کردنش:

Pmsgbox.ShowMessage(1, "اشکال در باز نمودن پایگاه اطلاعاتی" & vbCrLf & ex.ToString, "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error)

sari-1369
دوشنبه 19 بهمن 1388, 17:00 عصر
ممنون.من این گرفته بودم ولی کار نمی کرد
نتونستم ازش استفاده کنم.یه ارور می داد مبنی براینکه یک فایل با پسوند rtl (اگه اشتباه نکنم) رو پیدا نمی کنه
اگه درستش کنی بزطاری ممنون میشم

من توی همه برنامه هام دارم ازش استفاده میکنم ، تا حالا که مشکلی نداشته .

میشه بگی چطوری استفاده میکنی ؟ (مراحل کار)

mina.net
دوشنبه 19 بهمن 1388, 20:43 عصر
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




سلام
من این کلاس رو چند وقت پیش تو همین سایت گرفتم نمی دونم کی بود. و شرمنده که نمی تونم اسمی ازش بیارم. من 8-9 ماهی هست دارم باهاش کار می کنم مشکلی نداره.
استفاده ازش هم دقیقا مثل مسیج باکس خود دات نت هست. فقط بجای MessageBox بنویس MessageBoxFa

saeid.memfis
دوشنبه 19 بهمن 1388, 21:16 عصر
من توی همه برنامه هام دارم ازش استفاده میکنم ، تا حالا که مشکلی نداشته .

میشه بگی چطوری استفاده میکنی ؟ (مراحل کار)
سلام مهندس
من اونو میگیرمش و رو toolbox رها می کنم و یه کار دیگه هم که کردم از choose item که استفاده کردم که ارور میداد
زیاد یاد ندارم..ممنون میشم بگی چطوری به پروژه اضافه کنم؟
دمت گرم

sari-1369
دوشنبه 19 بهمن 1388, 23:36 عصر
سلام مهندس
من اونو میگیرمش و رو toolbox رها می کنم و یه کار دیگه هم که کردم از choose item که استفاده کردم که ارور میداد
زیاد یاد ندارم..ممنون میشم بگی چطوری به پروژه اضافه کنم؟
دمت گرم

من مهندس نیستم عزیز ( تو کاردانیش موندیم :لبخند: )

همونی که فکر میکردم .

0- فایل DLL رو تو فولدر Debug کپی کن .

1- تو قسمت Solution روی آیکون پروژه راست کلیک کن .

2- گزینه Add Renrece کلیک کن .

3- تب Browse رو انتخاب کن .

4- فایل Dll رو انتخاب کن و ok رو کلیک .

5- تو قسمت Solution روی آیکون پروژه راست کلیک کن و Peropertis رو انتخاب کن .

6- تب Refrences رو انتخاب کن .

7- پایین پنجره ، تو قسمت Imported namespaces گزینه PardisSoft و PardisSoft.Components رو تیک بزن .

8- طریقه استفاده :


FarsiMessageBox.Show()


مثال :



FarsiMessageBox.Show("پیغام", "عنوان", PardisSoft.Components.MessageBoxButtons.YesNoCance l, PardisSoft.Components.MessageBoxIcon.Warning, MessageBoxPosition.CenterScreen)

در ضمن این مسیج باکی قابلیت Result رو هم داره و میتونه دکمه کلیک شده توسط کاربر رو برگردونه .

که به این صورت استفاده میشه :


If FarsiMessageBox.Show("پیغام", "عنوان", PardisSoft.Components.MessageBoxButtons.YesNoCance l, PardisSoft.Components.MessageBoxIcon.Warning, MessageBoxPosition.CenterScreen) = Windows.Forms.DialogResult.Yes Then
'dastorat
End If

saeid.memfis
سه شنبه 20 بهمن 1388, 00:45 صبح
من مهندس نیستم عزیز ( تو کاردانیش موندیم :لبخند: )

همونی که فکر میکردم .

0- فایل DLL رو تو فولدر Debug کپی کن .

1- تو قسمت Solution روی آیکون پروژه راست کلیک کن .

2- گزینه Add Renrece کلیک کن .

3- تب Browse رو انتخاب کن .

4- فایل Dll رو انتخاب کن و ok رو کلیک .

5- تو قسمت Solution روی آیکون پروژه راست کلیک کن و Peropertis رو انتخاب کن .

6- تب Refrences رو انتخاب کن .

7- پایین پنجره ، تو قسمت Imported namespaces گزینه PardisSoft و PardisSoft.Components رو تیک بزن .

8- طریقه استفاده :


FarsiMessageBox.Show()
مثال :



FarsiMessageBox.Show("پیغام", "عنوان", PardisSoft.Components.MessageBoxButtons.YesNoCance l, PardisSoft.Components.MessageBoxIcon.Warning, MessageBoxPosition.CenterScreen)در ضمن این مسیج باکی قابلیت Result رو هم داره و میتونه دکمه کلیک شده توسط کاربر رو برگردونه .

که به این صورت استفاده میشه :


If FarsiMessageBox.Show("پیغام", "عنوان", PardisSoft.Components.MessageBoxButtons.YesNoCance l, PardisSoft.Components.MessageBoxIcon.Warning, MessageBoxPosition.CenterScreen) = Windows.Forms.DialogResult.Yes Then
'dastorat
End If

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

mina.net
سه شنبه 20 بهمن 1388, 09:47 صبح
این کلاسی که من گذاشتم رو به پروژه ات اضافه کن. و هر جا خواستی ازش استفاده کن. در ضمن چون سورسش رو در اختیار داری حتی می تونی براساس سلیقه خودت تغییرش بدی.

y.saied
چهارشنبه 07 فروردین 1392, 17:50 عصر
سلام دوستان، عیدتون مبارک
کلاسی رو که دوستمون گذاشتن، فکر کنم مشکل داره، مثلاً وقتی MessageBoxButtons.AbortRetryIgnore رو انتخاب میکنم، فقط Caption کلید اولی که Abort هستش رو فارسی میکنه و بقیه رو انگلیسی نشون میده.
لطفاً امتحان کنین و اگه مشکلی داشت اصلاح بفرمایین تا این کلاس قابل استفاده باشه.
مرسی




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




سلام
من این کلاس رو چند وقت پیش تو همین سایت گرفتم نمی دونم کی بود. و شرمنده که نمی تونم اسمی ازش بیارم. من 8-9 ماهی هست دارم باهاش کار می کنم مشکلی نداره.
استفاده ازش هم دقیقا مثل مسیج باکس خود دات نت هست. فقط بجای MessageBox بنویس MessageBoxFa

xxnagin
چهارشنبه 07 فروردین 1392, 23:14 عصر
سلام
منم همین مشکل شما رو دارم احتمالا کدش ناقص هستش
این کامل هستش و نام دکمه ها رو خوب نشون میده
اینو ببین خوبه

Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text
Public Class Pmsgbox
Private Delegate Function CallBack_WinProc(ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private 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 Function ShowMessage(ByVal hParent As Integer, 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(hParent, 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 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 1
End Function
End Class

y.saied
چهارشنبه 07 فروردین 1392, 23:19 عصر
مرسی
برا فراخوانی این کلاس از دستور

Pmsgbox.ShowMessage("سلام بر همگی", "گروه", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)

استفاده میکنم ولی عمل نمیکنه.... میشه یه توضیحی بدین یا راهنمای بفرمایید
ممنون


سلام
منم همین مشکل شما رو دارم احتمالا کدش ناقص هستش
این کامل هستش و نام دکمه ها رو خوب نشون میده
اینو ببین خوبه

Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text
Public Class Pmsgbox
Private Delegate Function CallBack_WinProc(ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private 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 Function ShowMessage(ByVal hParent As Integer, 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(hParent, 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 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 1
End Function
End Class

xxnagin
چهارشنبه 07 فروردین 1392, 23:42 عصر
به خاطر اینه که
شما اولش باید از me.handle استفاده بکنید
بعدش همون کد خودتون

y.saied
چهارشنبه 07 فروردین 1392, 23:54 عصر
شما اول باید اینو بنویسی me.handle بعدش همونی که تو تایپیک نوشتی رو به بقیه کد اضافه کن
ByVal Handle As Integer

SharedFunction Show(ByVal Handle AsInteger, ByVal Prompt AsString, OptionalByVal Title AsString = "", OptionalByVal buttons AsByVal m As

خب حالا کاره این Integer چیه؟
چه لزومی داره؟

xxnagin
پنج شنبه 08 فروردین 1392, 00:25 صبح
handle هندل پنجره مورد نظر
http://visualbasic.mihanblog.com/post/7

gilsoft
پنج شنبه 08 فروردین 1392, 11:29 صبح
سلام دوستان

این کلاس رو خودم نوشتم و احتمالا مشکل شما رو برطرف میکنه

کلاس MessgeBox کاملا فارسی بهمراه مثال و سورس (http://barnamenevis.org/showthread.php?374588)

EvErY OnE
دوشنبه 05 خرداد 1393, 14:14 عصر
سلام
من برنامه نویسی رو تازه شروع کرد
و این اولین برناممه که با c# مینویسم
یکی میتونه این مباحث رو خیلی ساده و برا یه مبتدی مثل من بنویسه
کدهاش رو هم بزارید ممنون میشم

EvErY OnE
دوشنبه 05 خرداد 1393, 16:48 عصر
یعنی واقعا هیچکس جواب این سوال ساده ی من رو نمیدونه
این سومین پست که میزارم تو این سایت،ولی جوابی نمیگیرم:گریه::گریه::گریه::گر ه::گریه::متفکر::متفکر::متفکر:

EvErY OnE
دوشنبه 05 خرداد 1393, 19:29 عصر
سلام
من برنامه نویسی رو تازه شروع کرد
و این اولین برناممه که با C#‎ مینویسم
یکی میتونه این مباحث رو خیلی ساده و برا یه مبتدی مثل من بنویسه
کدهاش رو هم بزارید ممنون میشم