设为首页 收藏本站 联系我们 网站导航
下面的例子完全用VB进行ASM编程的示例,本例获得CPU ID. 工程文件分为一个form1.frm 和一个模块module1.bas ----------------------form1.frm的源文件--------------------- VERSION 5.00 Begin VB.form form1 Caption = "form1" ClientHeight = 1965 ClientLeft = 60 ClientTop = 345 ClientWidth = 3105 LinkTopic = "form1" ScaleHeight = 1965 ScaleWidth = 3105 StartUpPosition = 2 ’Bildschirmmitte Begin VB.CommandButton Command1 Caption = "Get CPU Name" Height = 495 Left = 840 TabIndex = 0 Top = 315 Width = 1425 End Begin VB.Label Label2 Alignment = 2 ’Zentriert AutoSize = -1 ’True BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 ’False Italic = 0 ’False Strikethrough = 0 ’False EndProperty Height = 240 Left = 1515 TabIndex = 2 Top = 1065 Width = 60 End Begin VB.Label Label1 Alignment = 2 ’Zentriert AutoSize = -1 ’True BeginProperty Font Name = "Arial" Size = 12 Charset = 0 Weight = 700 Underline = 0 ’False Italic = 0 ’False Strikethrough = 0 ’False EndProperty Height = 285 Left = 1515 TabIndex = 1 Top = 1350 Width = 75 End End Attribute VB_Name = "form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single) Label1 = "" Label2 = "" End Sub Private Sub Command1_Click() Label1 = GetCpuName() & " CPU" Label2 = "You have a" & IIf(InStr("AEIOU", Left$(Label1, 1)), "n", "") End Sub ------------------------------end--------------------------------- 下面是modu1e.bas的源代码 ----------------------module1.bas的源文件-------------------------- Option Explicit ’ ’This shows how to incorporate machine code into VB ’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’ ’The example fills the array with a few machine instructions and then copies ’them to a procedure address. The modified procedure is then called thru ’CallWindowProc. The result of this specific machine code is your CPU Vendor Name. ’
版权所有 2007 黑客防线 廊(公)备13100138000530号