vbÈçºÎ½øÐÐλ²Ù×÷ - VB / »ù´¡Àà
±ÈÈçÎÒÒ»¸ölongÀàÐ͵ıäÁ¿x
ÏÖÔÚÎÒÏë°ÑÕâËĸö×Ö½ÚдÈëµ½Õâ¸ö±äÁ¿
&H1
&H2
&H3
&H4
ʹÓÃÖ¸ÕëµÄ°ì·¨¿ÉÒÔ×öµ½£¬ÎÒÏëÖªµÀÓÐûÓв»Ê¹ÓÃÖ¸ÕëµÄ°ì·¨£¿
·Ç³£¸Ðл£¡
http://www.xbeat.net/vbspeed/c_LongToBit.htm
VB code:
Option Explicit
Dim bytSj(3) As Byte
Dim i As Integer
Dim lngSj As Long
Private Sub Command1_Click()
bytSj(0) = &H11
bytSj(1) = &H2
bytSj(2) = &H3
bytSj(3) = &H4
For i = 0 To UBound(bytSj)
lngSj = lngSj + bytSj(i) * 256 ^ (3 - i)
Next
Text1 = lngSj
End Sub
VB code:
Option Explicit
Private Type bb
b1 As Byte
b2 As Byte
b3 As Byte
b4 As Byte
End Type
Private Type lng
lng As Long
End Type
Private Sub Form_Load()
Dim b As bb
Dim l As lng
b.b1 = &H1
b.b2 = &H2
b.b3 = &H3
b.b4 = &H4
LSet l = b
Debug.Print l.lng
End Sub
Ïà¹ØÎÊ´ð£º
Private Sub Command1_Click()
Dim MyString() As String
Open "a.xml" For Binary As #1 ' ´ò¿ª¸Õ´´½¨µÄÎļþ¡£
ReDim MyString(LOF(1) - 1)
Put #1, , MyRecord ' ¶ÁÈëËùÓÐ×Ö·ûµ½±äÁ¿ÖÐ ......
vbÖÐ ÏÖÔÚÎÒÒª°ÑÊý¾Ý¿âÀï´æ´¢µÄÒ»¸ö¸½¼þµÄÄÚÈÝÌæ»»ÁË£¬Ôõô×ö£¬Ö»ÊÇÌæ»»ÎÒÖ¸¶¨µÄλÖ㬲»ÊÇÈ«²¿Ìæ»»
Ç뽫ÎÊÌâ˵Ã÷°×£¬´æ´¢×ֶθñʽ£¬Èç¹ûÊÇBinary¸ñʽµÄ±È½ÏÂé·³£¬Èç¹ûÊÇ×Ö´®£¬Ö±½ÓÌæ»»¡£×îºÃ²»Òª½øÐÐÖ¸¶¨Î»ÖÃÌæ»»¡ ......
ÏÖÔÚÓиöxmlÎļþÊÇ<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xm ......
form1ÖÐÓÐtext1-8£¬ ºÍcommand1
text8ÖÐΪ³ÌÐò´úÂ루Éú³É´°ÌåΪform2£¨ÒÑ×öºÃ£©£©
µ¥»÷command1ºó½«text2ÖеĴúÂëÉú³ÉEXEµ½d:\ ²¢ÇÒtext1-7·Ö±ð¶ÔÓ¦
²úÆ·Ãû ¹«Ë¾Ãû ºÏ·¨°æȨ ºÏ·¨É̱ê ÎļþÃèÊö ×¢ÊÍ ±êÌâ
......