要散就散技术分入门题
请给出VB取命令行参数示例进阶题
已取得(另一个正在运行的程序的)窗口内控件的句柄,如何识别该控件的属性?
比如说, 它是一个按钮还是复选框?它是否visble 是否enable等...说明
答题一定有分
接分的...应该能接到, 但不能保证祝每一个看到此帖的网友都会享受一个快乐的元旦^_^

解决方案 »

  1.   

    text1.text=text.visble? 我新手中的新手呵呵。等看大家答案:)
      

  2.   

    汗啊text后边的数字都没打上,更丢人了。。
      

  3.   

    Command 函数
          返回命令行的参数部分,该命令行用于装入 Microsoft Visual Basic 或 Visual Basic 开发的可执行程序。语法Command说明当从命令行装入 Visual Basic 时,/cmd 之后的命令行的任何部分作为命令行的参数传递给程序。下面的示例中,cmdlineargs 代表 Command 函数返回的参数信息。VB /cmd cmdlineargs对于使用 Visual Basic 开发并编译为 .exe 文件的应用程序,Command 返回出现在命令行中应用程序名之后的任何参数。例如:MyApp cmdlineargs想知道如何在正在使用的应用程序的用户界面中改变命令行参数,请搜寻关于“命令行参数”的帮助。
      

  4.   

    Command 函数示例
    本示例在某个函数中用 Command 函数获得命令行参数,并将命令行参数以 Variant 类型之数组返回。Function GetCommandLine(Optional MaxArgs)
       '声明变量。
       Dim C, CmdLine, CmdLnLen, InArg, I, NumArgs
       '检查是否提供了 MaxArgs 参数。
       If IsMissing(MaxArgs) Then MaxArgs = 10
       ' 使数组的大小合适。
       ReDim ArgArray(MaxArgs)
       NumArgs = 0: InArg = False
       '取得命令行参数。
       CmdLine = Command()
       CmdLnLen = Len(CmdLine)
       '以一次一个字符的方式取出命令行参数。
       For I = 1 To CmdLnLen
          C = Mid(CmdLine, I, 1)
          '检测是否为 space 或 tab。
          If (C <> " " And C <> vbTab) Then
             '若既不是 space 键,也不是 tab 键,
             '则检测是否为参数内含之字符。
             If Not InArg Then
             '新的参数。
             '检测参数是否过多。
                If NumArgs = MaxArgs Then Exit For
                   NumArgs = NumArgs + 1
    InArg = True
                End If
             '将字符连接到当前参数中。
             ArgArray(NumArgs) = ArgArray(NumArgs) & C
          Else
             '找到 space 或 tab。
             '将 InArg 标志设置成 False。
             InArg = False
          End If
       Next I
       '调整数组大小使其刚好符合参数个数。
       ReDim Preserve ArgArray(NumArgs)
       '将数组返回。
       GetCommandLine = ArgArray()
    End Function
      

  5.   

    要慢慢看就看msdn,抄出来的……
      

  6.   

    入门题:用Command
    进阶题:用TypeOf
      

  7.   

    返回命令行的参数部分,该命令行用于装入 Microsoft Visual Basic 或 Visual Basic 开发的可执行程序。语法Command说明当从命令行装入 Visual Basic 时,/cmd 之后的命令行的任何部分作为命令行的参数传递给程序。下面的示例中,cmdlineargs 代表 Command 函数返回的参数信息。VB /cmd cmdlineargs对于使用 Visual Basic 开发并编译为 .exe 文件的应用程序,Command 返回出现在命令行中应用程序名之后的任何参数。例如:MyApp cmdlineargs想知道如何在正在使用的应用程序的用户界面中改变命令行参数,请搜寻关于“命令行参数”的帮助。不错!!
      

  8.   

    truewill(无处不在)
    谢谢!各位继续说说
    比如VBS里怎么处理 VBA里怎么处理 ......
      

  9.   

    text1.text=text.visble? 我新手中的新手呵呵。等看大家答案:)这个不行, 因为是"另一个正在运行的程序的"窗口
    有的只是一个句柄
    =======================================
     yangao(偶新手 请问门在哪里?) ( ) 信誉:100    Blog  2006-12-30 9:51:33  得分: 0  
     
     
       
    郁闷啊
    入门题都不会所以才是星星嘛 这点东东都是小时候玩剩下的...
    嘎嘎...开个玩笑
    祝节日快乐 ^_^
      

  10.   

    gaiwa(我不是大侠) ( ) 信誉:85    Blog  2006-12-30 10:53:26  得分: 0  入门题:用Command
    进阶题:用TypeOf
    ==================
    typeof? 没这么简单吧 给你的只是一个句柄唉
      

  11.   

    命令行直接用“shell”函数就可以了,
    句柄调用获得控件属性一般要用到API函数,示例如下:
    Declare Function GetDeviceCaps Lib "gdi32" Alias _
    "GetDeviceCaps" (ByVal hdc As Long, _
    ByVal nIndex As Long) As Long'将窗体或 Printer 对象的 hDC 属性传递到上面的过程中,从而得到屏幕或当前选定的打印机支持的颜色数:Private Sub Form_Click ()
    Const PLANES = 14, BITS = 12
       Print "Screen colors "; 
       Print GetDeviceCaps(hDC, PLANES)* 2 ^ _
       GetDeviceCaps(hDC, BITS)
       Print "Printer colors ";
       Print GetDeviceCaps(Printer.hDC, PLANES) * _
       2 ^ GetDeviceCaps(Printer.hDC, BITS)
    End Sub
      

  12.   

    chanfengsr(巉沨散人) ( ) 信誉:100    Blog  2006-12-30 14:39:58  得分: 0  
     
     
       命令行直接用“shell”函数就可以了,
    =========================================
    不是命令行
    是将命令行里的参数传递进来===================================================
    句柄调用获得控件属性一般要用到API函数,示例如下:
    Declare Function GetDeviceCaps Lib "gdi32" Alias _
    "GetDeviceCaps" (ByVal hdc As Long, _
    ByVal nIndex As Long) As Long'将窗体或 Printer 对象的 hDC 属性传递到上面的过程中,从而得到屏幕或当前选定的打印机支持的颜色数:Private Sub Form_Click ()
    Const PLANES = 14, BITS = 12
       Print "Screen colors "; 
       Print GetDeviceCaps(hDC, PLANES)* 2 ^ _
       GetDeviceCaps(hDC, BITS)
       Print "Printer colors ";
       Print GetDeviceCaps(Printer.hDC, PLANES) * _
       2 ^ GetDeviceCaps(Printer.hDC, BITS)
    End Sub
    ================================================
    用API就对了^_^
    恐怕得用一堆API
    先提名几个候选人:
    FindWindowEx
    GetWindow
    EnumChildWindows
    GetDlgItem
    大家还可以提自己心目中的候选人 =_=  
     
      

  13.   

    -----------------------------------
    ╭═══╮ ╭═══╮ ╭══════╮      
    ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭══╮╰╮     
      ║ ║   ║ ║   ║ ║  ╰╮╰╮    
      ║ ║   ║ ║   ║ ║   ║ ║    
      ║ ║   ║ ║   ║ ║   ║ ║    
      ║ ║   ║ ║   ║ ║  ╭╯╭╯    
      ║ ║   ║ ║   ║ ╰══╯╭╯     
      ║ ║   ║ ║   ║ ╭═══╯      
      ║ ║   ║ ║   ║ ║          
      ║ ║   ║ ║   ║ ║          
      ║ ║   ║ ║   ║ ║          
      ╰╮╰╮ ╭╯╭╯   ║ ║          
       ╰╮╰═╯╭╯   ╭╯ ╰╮         
        ╰═══╯    ╰═══╯     IT者-IT开发者的网站 10万篇技术资料 天天更新
                                             www.itzhe.cn
      

  14.   

    1就是命令行参数,用split(xx," ")或者split(xx,"/")自己分开,
    2使用API查找句柄,对象是什么自己判断类型,属性嘛,就是直接访问就是了
      

  15.   

    dabie() ( ) 信誉:100    Blog  2006-12-30 17:03:53  得分: 0  
     
     
       为什么能开200分的贴在这里,我开不了赐教!!!
      
     
    ============================================
    多穿几条三角裤就行了(比如偶今天就穿了5条来)
    如果长得跟猩猩一样
    不用穿三角裤就能发300分的贴子
      

  16.   

    使用API查找句柄,对象是什么自己判断类型,属性嘛,就是直接访问就是了
    =====================================
    给个例子让俺窥窥
    行不?
      

  17.   

    入门题
    请给出VB取命令行参数示例:msgbox command
      

  18.   

    进阶题:模块中:
    Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Public Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Public Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
    Public Declare Function EnumChildWindows Lib "user32.dll" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
    Public Declare Function IsWindowVisible Lib "user32.dll" (ByVal hwnd As Long) As Long
    Public Declare Function IsWindowEnabled Lib "user32.dll" (ByVal hwnd As Long) As Long  Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
            Dim strclsname As String, str1 As String, l As Long, h1 As Long, h2 As Long
            strclsname = Space(255)
            str1 = Space(255)
            l = GetClassName(hwnd, strclsname, Len(strclsname))
            h1 = IsWindowVisible(hwnd)
            h2 = IsWindowEnabled(hwnd)        If Left(strclsname, l) <> "" Then Form1.List1.AddItem Left(strclsname, l) & ":" & IIf(h1, "Visible", "Invisible") & "," & IIf(h2, "Enable", "Disable")
              'continue   enumeration
              EnumChildProc = 1
      End Function
    form中:
    Private Sub Command1_Click()
    Dim h As Long, l As Long, strclsname As String, strwndname As String
    strclsname = vbNullString
    strwndname = "!@#$%^&"'你要找的窗口名
    h = FindWindow(strclsname, strwndname)
    EnumChildWindows h, AddressOf EnumChildProc, ByVal 0&
    End Sub但是找不到label控件!!!   求解