NotNT.bas
上传用户:hyb6888
上传日期:2016-01-24
资源大小:5186k
文件大小:4k
- Attribute VB_Name = "NotNT"
- Public Const REG_SZ = 1
- Public Const REG_BINARY = 3
- Public Const REG_DWORD = 4
- Public Const HK_CUR_USER = &H80000001
- Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
- Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
- Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
- Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
- Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData 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 DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
- 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 GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
- Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
- Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
- Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
- Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
- Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
- Private Type RECT
- Left As Long
- Top As Long
- right As Long
- bottom As Long
- End Type
- Dim MyRec As RECT
- Private Declare Function BeginPath Lib "gdi32" (ByVal hdc As Long) As Long
- Private Declare Function EndPath Lib "gdi32" (ByVal hdc As Long) As Long
- Private Declare Function PathToRegion Lib "gdi32" (ByVal hdc As Long) As Long
- Sub SetText(MyWin As Object, Image As Object, sText As String)
- Dim Rgn1 As Long
- Dim hRgn As Long
- Dim Width As Long
- Dim Height As Long
- Dim HeightText As Long
- Dim widthText As Long
- Width = Image.Width / 15
- Height = Image.Height / 15
- widthText = MyWin.TextWidth(sText)
- HeightText = MyWin.TextHeight(sText)
- MyWin.Height = HeightText + Image.Height
-
- If (Image.Width < widthText) Then
- MyWin.Width = widthText
- Else
- MyWin.Width = Image.Width
- End If
-
- Rgn1 = CreateRectRgn(0, 0, Width, Height)
- BeginPath MyWin.hdc
- tt = TextOut(MyWin.hdc, 0, Height, sText, mylen(sText))
- EndPath MyWin.hdc
-
- hRgn = PathToRegion(MyWin.hdc)
-
- CombineRgn hRgn, Rgn1, hRgn, 2
- SetWindowRgn MyWin.hwnd, hRgn, True
- DeleteObject hRgn
-
- End Sub
- Sub SaveRegLong(hKey As Long, strPath As String, strValue As String, strData As String)
- Dim ret
- RegCreateKey hKey, strPath, ret
- RegSetValueEx ret, strValue, 0, REG_DWORD, CLng(strData), 4
- RegCloseKey ret
- End Sub