Вместо русских (да и английских тоже) букв - иероглифы.
Подскажите, плиз, что здесь не так.
Код VB6:
- Код: Выделить всё
Option Explicit
Private Type MSGBOXPARAMS
cbSize As Long
hwndOwner As Long
hInstance As Long
lpszText As Long
lpszCaption As Long
dwStyle As Long
lpszIcon As Long
dwContextHelpId As Long
lpfnMsgBoxCallback As Long
dwLanguageId As Long
End Type
Private Type MSGBOXDATA
params As MSGBOXPARAMS
pwndOwner As Long
wLanguageId As Integer
pidButton As Long ' // Array of button IDs
ppszButtonText As Long ' // Array of button text strings
cButtons As Long
DefButton As Long
CancelId As Long
Timeout As Long
End Type
Private Declare Function SoftModalMessageBox Lib "user32" (pMsgBoxParams As MSGBOXDATA) As Long
Sub Main()
Dim mbd As MSGBOXDATA, Buttons(3) As Long, Captions(3) As String
Captions(0) = "Нафиг"
Buttons(0) = vbAbort
Captions(1) = "Нефиг"
Buttons(1) = vbRetry
Captions(2) = "Пофиг"
Buttons(2) = vbIgnore
Captions(3) = "Отмена"
Buttons(3) = vbCancel
With mbd
With .params
.cbSize = LenB(mbd.params)
.lpszText = StrPtr(Replace("Чтобы сделать месседжбокс с собственными подписями\nкнопок, совсем не обязательно рисовать форму самому:\nдля этого идеально подходит малодокументированная\nфункция SoftModalMessageBox.", "\n", vbCrLf))
.lpszCaption = StrPtr("Круто, да?")
MsgBox .lpszCaption
.dwStyle = vbQuestion & vbOKCancel
End With
.DefButton = 2
.CancelId = vbCancel
.cButtons = 4
.pidButton = VarPtr(Buttons(0))
.ppszButtonText = VarPtr(Captions(0))
.Timeout = -1
End With
Debug.Print SoftModalMessageBox(mbd)
End Sub
Код PB8:
- Код: Выделить всё
#Compile Exe
#Dim All
#Include "Win32API.inc"
Type MSGBOXDATA
params As MSGBOXPARAMS
pwndOwner As Dword
wLanguageId As Dword
pidButton As Dword
ppszButtonText As Dword
cButtons As Dword
DefButton As Dword
CancelId As Dword
TimeOut As Dword
End Type
Declare Function SoftModalMessageBox Lib "USER32.DLL" Alias "SoftModalMessageBox" (pMsgBoxParams As MSGBOXDATA) As Long
Function PBMain () As Long
Local mbd As MSGBOXDATA, Buttons() As Long, Captions() As String,s As String, c As String
ReDim Captions(3)
ReDim Buttons(3)
Captions(0) = ("Нафиг")
Buttons(0) = 3
Captions(1) = ("Нефиг")
Buttons(1) = 4
Captions(2) = ("Пофиг")
Buttons(2) = 5
Captions(3) = ("Отмена")
Buttons(3) = 2
s="Чтобы сделать месседжбокс"
c="Caption"
mbd.params.dwLanguageId=1049
mbd.wLanguageId =1049
mbd.params.cbSize = Len(mbd.params)
mbd.params.lpszText =StrPtr(s$)
mbd.params.lpszCaption = StrPtr(c$)
mbd.params.dwStyle = 32+1
mbd.DefButton = 2
mbd.CancelId = 2
mbd.cButtons = 4
mbd.pidButton = VarPtr(Buttons(0))
mbd.ppszButtonText =VarPtr(Captions(0))
mbd.Timeout = -1
SoftModalMessageBox mbd
End Function