PDA

View Full Version : msgbox



mlf_mlv
شنبه 28 شهریور 1388, 11:02 صبح
چطوری می شه دکمه های توی msg box رو تغییر داد مثلا فارسی کرد؟

sh2007
شنبه 28 شهریور 1388, 12:24 عصر
سلام
بايد براشس كنترل بنويسي يه OCX

Navid Asadi
شنبه 28 شهریور 1388, 12:45 عصر
کنترل هایی تو این سایت هست اگه بگردی میتونی پیدا کنی...

naser_feb8646
شنبه 28 شهریور 1388, 13:19 عصر
سلام
بفرمایید

sari-1369
شنبه 28 شهریور 1388, 19:23 عصر
این هم چیز جالبیه ، تقریبا شبیه مسیج باکس خود دات نت هستش ، با آیکن های قشنگ .

من خودم تو همه پروژه هام از این استفاده میکنم.

saadi2
شنبه 28 شهریور 1388, 22:52 عصر
اینم یک نمونه دیگه که خودم نوشتم و تو برنامم استفاده کردم شما هم میتونی برای خودت بنویسید

reza1944
یک شنبه 29 شهریور 1388, 00:38 صبح
Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text
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

Public Class CMessageBox
<DllImport("user32.dll")> _
Public Shared Function GetWindowLong(ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
End Function
<DllImport("kernel32.dll")> _
Public Shared Function GetCurrentThreadId() As Integer
End Function
<DllImport("user32.dll")> _
Public 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")> _
Public Shared Function UnhookWindowsHookEx(ByVal hHook As Integer) As Integer
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function SetWindowText(ByVal hwnd As Integer, ByVal lpString As String) As Integer
End Function
<DllImport("user32.dll")> _
Public Shared Function EnumChildWindows(ByVal hWndParent As Integer, ByVal lpEnumFunc As CallBack_EnumWinProc, ByVal lParam As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Public Shared Function GetClassName(ByVal hwnd As Integer, ByVal lpClassName As StringBuilder, ByVal nMaxCount As Integer) As Integer
End Function
Dim TopCount As Integer
Dim 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 hHook As Integer
Dim strCaption1 As String
Dim strCaption2 As String
Dim strCaption3 As String
Public Function ShowMessage(ByVal hParent As Integer, ByVal Prompt As String, ByVal Title As String, ByVal Caption1 As String, ByVal Caption2 As String, ByVal Caption3 As String, ByVal buttons As MessageBoxButtons, ByVal icon As MessageBoxIcon, ByVal DefaultButton As MessageBoxDefaultButton, ByVal options As MessageBoxOptions) As DialogResult
Dim hInst As Integer
Dim Thread As Integer
TopCount = 0
ButtonCount = 0
strCaption1 = Caption1
strCaption2 = Caption2
strCaption3 = Caption3
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)
End Function
Private 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 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


تاپيك رو ببند!

sharifat
سه شنبه 26 بهمن 1389, 15:41 عصر
این هم چیز جالبیه ، تقریبا شبیه مسیج باکس خود دات نت هستش ، با آیکن های قشنگ .

من خودم تو همه پروژه هام از این استفاده میکنم.

سلام دوست محترم
شما فايل dll رو گذاشتيد. من بلد نيستم چگونه از اين فايل dll استفاده كنم. به refrence ها اضاف كردم اما توي برنامه قابل شناسايي نبود.
ميشه راهنمايي كنيد كه توي برنامه به چه نحو استفاده كنم؟؟؟ اگه با يه مثال كوچولو باشه كه چه بهتر.
ممنون

Hossis
سه شنبه 26 بهمن 1389, 22:31 عصر
این تاپیک رو ببینید (http://barnamenevis.org/showthread.php?174722-%DA%A9%D8%A7%D9%85%D9%BE%D9%88%D9%86%D9%86%D8%AA-%D9%85%D8%B3%D8%AC-%D8%A8%D9%88%DA%A9%D8%B3-%D9%81%D8%A7%D8%B1%D8%B3%DB%8C&p=974300&viewfull=1#post974300)
فکر کنم یک مثال هم توش باشه
این هم نحوه استفاده اش


Imports hekmat.Dialogs
Module myMsg
Dim mss As New MsgDialogs

#Region "MESSAGE"

Public Function MsgBox(ByVal Prompt As String) As MsgBoxResult
Return mss.Msgbox(Prompt)
End Function
Public Function MsgBox(ByVal Prompt As String, ByVal style As MsgBoxStyle) As MsgBoxResult
Return mss.Msgbox(Prompt, style + MsgBoxStyle.MsgBoxRtlReading + MsgBoxStyle.MsgBoxRight)
End Function
Public Function MsgBox(ByVal Prompt As String, ByVal style As MsgBoxStyle, ByVal Title As String) As MsgBoxResult
Return mss.Msgbox(Prompt, style + 1048576 + 524288, Title)
End Function
#End Region

#Region "Input"
Public Function InputBox(ByVal Prompt As String) As String
Return mss.Inputbox(Prompt)
End Function
Public Function InputBox(ByVal Prompt As String, ByVal Title As String) As String
Return mss.Inputbox(Prompt, Title)
End Function
Public Function InputBox(ByVal Prompt As String, ByVal Title As String, ByVal DefualtStr As String) As String
Return mss.Inputbox(Prompt, Title, DefualtStr)
End Function