先聲明一個委托:
我們提供的服務(wù)有:成都做網(wǎng)站、網(wǎng)站建設(shè)、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認證、鄞州ssl等。為上千企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學管理、有技術(shù)的鄞州網(wǎng)站制作公司
Public Delegate Function EnumChildProc(hwnd As Integer, iParam As Integer) As Integer
然后才能使用回調(diào)函數(shù),回調(diào)函數(shù)的參數(shù)要和委托完全一致。
然后那個 API 函數(shù)需要這樣聲明:
Declare Function EnumChildWindows Lib "user32" (hWndParent As Integer, lpEnumFunc As EnumChildProc, lParam As Integer) As Integer
Dim?file1?As?FileStream
filename?=?"c:\temp\MyTest.txt"
Dim?GetData(4)?As?Byte,?s(4)?As?Char
file1?=?System.IO.File.OpenRead(filename)
Dim?CMGs?As?Long
Dim?DPBo?As?Long
Dim?i?As?Integer?=?0,?j?As?Integer
While?file1.Read(GetData,?0,?5)??0
i?=?i?+?1
For?j?=?0?To?4
s(j)?=?ChrW(GetData(j))
Next
If?s?=?"CMG="""?Then?CMGs?=?i
If?s?=?"[Host"?Then?DPBo?=?i?-?2?:?Exit?While
End?While
主要是vb.net取消了定長字符串, 所以用字節(jié)數(shù)組讀入, 還得轉(zhuǎn)成字符數(shù)組來比較.
Option Explicit On
Option Strict On
Imports System
Module Program
Sub Main()
Dim y,m,t As Integer
begin:
' 輸入數(shù)據(jù)時一行一個
y=CInt(Console.ReadLine())
m=CInt(Console.ReadLine())
t=CInt(Console.ReadLine())
If y
200 Then
Console.WriteLine("ERROR")
goto begin
End If
pr(y,m,t)
Console.Write("Press any key to continue . . . ")
Console.ReadKey(True)
End Sub
Function pr(y As Integer,m As Integer,t As Integer) As Integer
Dim ye,[Me],i As Integer
ye=CInt((m+t-2)/12+y)
[Me]=(m+t-2) Mod 12+1
End If
End Function
Function mday(y As Integer,m As Integer) As Integer
Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}
Dim ad As I