真是不好意思,这个问题我自己翻API大全找到了
Private Const GWL_STYLE = (-16)
Private Const WS_SYSMENU = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Sub Form_Load()
Dim lStyle As Long
lStyle = GetWindowLong(hwnd, GWL_STYLE) Or WS_SYSMENU
SetWindowLong hwnd, GWL_STYLE, lStyle
end sub
图标文字一任具全
'This sample show you how to cut the caption title exactly with the icon not dispear.
'add a new form ,do nothing but copy this codes for it.
Option Explicit
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal x1 As Long, ByVal y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private WithEvents cmd1 As CommandButton
Private WithEvents cmd2 As CommandButton
Private Sub cmd2_Click() '*******************
Me.ScaleMode = 2
Dim area As Long
area = CreateRectRgn(0, 0, Me.Width, Me.Height) '画含标题栏的矩形框
area = SetWindowRgn(Me.hWnd, area, True) '恢复标题栏
End Sub
Private Sub Form_Load()
Me.Icon = LoadPicture("C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Misc\misc03.ico")
Me.WindowState = 0
Dim capheight As Long, area As Long
Me.ScaleMode = 2
Me.ForeColor = vbRed
Me.Line (1, 0)-(Me.Width, 0) '紧贴标题栏画线做标记
capheight = GetSystemMetrics(33) + GetSystemMetrics(4) ' 边框宽度+标题栏高度
area = CreateRectRgn(0, capheight, Me.Width, Me.Height) '画无标题栏的矩形框
area = SetWindowRgn(Me.hWnd, area, True) '裁剪标题栏
End Sub
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Const OFS_MAXPATHNAME = 128
Const OF_READ = &H0
Private Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(OFS_MAXPATHNAME) As Byte
End Type
Private Sub Form_Load()
Set Me.Icon = LoadPicture("C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Misc\FACE02.ICO")
SetWindowText Me.hwnd, "要显示的标题"