试一下这个:Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Private Type SYSTEMTIME
    wYear As Integer
    wMonth As Integer
    wDayOfWeek As Integer
    wDay As Integer
    wHour As Integer
    wMinute As Integer
    wSecond As Integer
    wMilliseconds As Integer
End Type
Private Sub Form_Load()
    Dim SysTime As SYSTEMTIME
    'Set the graphical mode to persistent
    Me.AutoRedraw = True
    'Get the system time
    GetSystemTime SysTime
    'Print it to the form
    Me.Print "The System Date is:" & SysTime.wMonth & "-" & SysTime.wDay & "-" & SysTime.wYear
    Me.Print "The System Time is:" & SysTime.wHour & ":" & SysTime.wMinute & ":" & SysTime.wSecond
End Sub

解决方案 »

  1.   

    我想你的问题应该不是出在这里.你添加的是不是标准模块?即 module?
    上面的代码是否放在模块上面了?
      

  2.   

    在你的函数声明前加上Public(如果在其它模块调用它的话),或是Private(如果在本模块调用),
    即:
    Public Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
    Public Type SYSTEMTIME
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Integer
    End Type

    Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
    Private Type SYSTEMTIME
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Integer
    End Type然后在相应的地方调用就可以了。
      

  3.   

    如果只在你的aa.bas里用,把TYPE改成PRIVATE TYPE;DECLARE改成PRIVATE DECLARE。如果想在工程里任意位置调用,把前面的PRIVATE改成PUBLIC。
      

  4.   


    chanet(黑夜猫,正在不断努力!) :按照你那样是能用的,可是要是有很多窗体的话.我不是要声明好多遍.那多繁亚,
      

  5.   

    明白了,谢谢各位了,随便还问个问题:我做了两个屏保文件a.scr,b.scr,然后我分别安装他们,可是为什么只能看到一个呢?另一个就没了,后安装的在.为什么呢?
      

  6.   

    好好看看MSDN的关于Public和Private的讲解。
      

  7.   

    对于API声明,没有加Private、Public表示Private在窗体模块、控件模块、类模块中只能用Private
    在标准模块中,Private、Public都能用,只不过定义为Public可以让其他模块调用
      

  8.   

    明白了,谢谢各位了,随便还问个问题:我做了两个屏保文件a.scr,b.scr,然后我分别安装他们,可是为什么只能看到一个呢?另一个就没了,后安装的在.为什么呢?
      

  9.   

    明白了,谢谢各位了,顺便还问个问题:我做了两个屏保文件a.scr,b.scr,然后我分别安装他们,可是为什么只能看到一个呢?另一个就没了,后安装的在.为什么呢?
      

  10.   

    明白了,谢谢各位了,顺便还问个问题:我做了两个屏保文件a.scr,b.scr,然后我分别安装他们,可是为什么只能看到一个呢?另一个就没了,后安装的在.为什么呢?
      

  11.   

    明白了,谢谢各位了,顺便还问个问题:我做了两个屏保文件a.scr,b.scr,然后我分别安装他们,可是为什么只能看到一个呢?另一个就没了,后安装的在.为什么呢?