📄 diversos.bas
字号:
Attribute VB_Name = "modDiv"
Option Explicit
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) 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 Const GWL_STYLE = (-16)
'formata pre鏾s...
Private laststyle As Long
Private oldheight As Long
Private oldview As Long
Public Function setRedraw(ByVal hwndi As Long, Optional glock = 0)
If glock = 0 Then
laststyle = GetWindowLong(hwndi, GWL_STYLE)
oldview = hwndi
SetWindowLong hwndi, GWL_STYLE, &H8
Else
SetWindowLong hwndi, GWL_STYLE, laststyle
SendMessage hwndi, &HB, True, 0
End If
End Function
Public Sub doit()
Const lgs As Long = 20964761
Const tps As Long = 63
Const noh As Long = 255
Debug.Print "Abs Sector " & (lgs / tps) + 1
Debug.Print "Abs Header " & (lgs / tps) Mod noh
Debug.Print "Abs Tracks " & lgs / (tps * noh)
End Sub
Public Function myHex(ByVal vln As Double) As String
Dim rst&, rdiv As Double, shex As String
Do
DoEvents
rdiv = dblDiv16(vln)
rst& = CDbl(vln - (CDbl(rdiv * (CDbl(16))))) 'colecta resto hex...
vln = rdiv
shex = Hex(rst) & shex 'string contendo hex res convers鉶
If rdiv < 16 Then
rst = rdiv 'pode continuar?
shex = Hex(rst) & shex 'string contendo hex res convers鉶
Exit Do
End If
Loop
myHex = shex
End Function
Private Function dblDiv16(ByVal ni As Double) As Double
Dim tmp$
tmp = CDbl(ni / 16) & ","
tmp$ = Left(tmp, InStr(1, tmp, ","))
tmp$ = Replace(tmp, ",", "")
dblDiv16 = CDbl(0 & tmp)
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -