If DWord And &H8000& Then
LoWord = DWord Or &HFFFF0000
Else
LoWord = DWord And &HFFFF&
End If
End Function
Function HiWord(ByVal DWord As Long) As Integer
HiWord = (DWord And &HFFFF0000) \ 65536
End Function
Function MakeDWord(wHi As Integer, wLo As Integer) As Long
If wHi And &H8000& Then
MakeDWord = (((wHi And &H7FFF&) * 65536) Or (wLo And &HFFFF&)) Or &H80000000
Else
MakeDWord = (wHi * 65536) + wLo
End If
End Function
3.怎样从文件中读到内容
Private Function OpenDoc(ByVal sFIle As String) As Boolean
Dim iFile As Integer
Dim sBuf As String
On Error GoTo ErrorHandler
If sFIle = "" Then
' pick file
If Not m_cComDlg.VBGetOpenFileName(sFIle, , , , , , "Text Files (*.TXT)|*.TXT|Web Pages (*.HTML;*.HTM)|*.HTML;*.HTM|Resource Compiler Files (*.RC)|*.RC|VB Files (*.VBP;*.FRM;*.BAS;*.CLS;*.CTL)|*.VBP;*.FRM;*.BAS;*.CLS;*.CTL|C Files (*.H;*.C;*.CPP)|*.H;*.C;*.CPP|SQL Files (*.SQL)|*.SQL|Report Files (*.RPT)|*.RPT|All Files (*.*)|*.*", 1, , "Pick File to Open", "TXT", Me.hwnd) Then
Exit Function
End If
End If
iFile = FreeFile
Open sFIle For Binary Access Read Lock Write As #iFile
sBuf = Space$(LOF(iFile))
Get #iFile, , sBuf
Close #iFile
iFile = 0
m_sFileName = sFIle
txtTest.Text = UEFLoadTextFile(pvStripNulls(m_sFileName)) 'sBuf
SetTitle
Exit Function
ErrorHandler:
Dim lErr As Long, sErr As String
lErr = Err.Number: sErr = Err.Description
If lErr <> 26001 Then ' cd cancel
If iFile <> 0 Then
Close #iFile
End If
MsgBox "An error occurred:" & sErr, vbExclamation
End If
Exit Function
End Function