找回密码
 加入
搜索
查看: 9370|回复: 10

[AU3基础] [已解决]如何类似C++ Win32控制台应用程序那样可以直接将结果输出到cmd窗口

  [复制链接]
发表于 2014-3-25 22:12:59 | 显示全部楼层 |阅读模式
本帖最后由 jwwlchen 于 2014-3-26 22:52 编辑

类似C++ Win32控制台应用程序那样可以直接将结果输出到cmd窗口
这样的话就不用将结果写入到文本中在读出来了!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2014-3-25 23:37:00 | 显示全部楼层
#AutoIt3Wrapper_Change2CUI=y
ConsoleWrite("Hello World!")
发表于 2014-3-26 14:02:00 | 显示全部楼层
原来开头是要加AutoIt3Wrapper_Change2CUI这么一句啊 我就说之前怎么不行呢。
 楼主| 发表于 2014-3-26 22:51:28 | 显示全部楼层
原来如此 ! Thanks!
发表于 2014-9-25 11:10:17 | 显示全部楼层
回复 2# haijie1223


    可行,但是这个  AutoIt3Wrapper_Change2CUI  又何 解呢?
发表于 2014-9-25 13:34:04 | 显示全部楼层
发表于 2014-9-25 14:49:59 | 显示全部楼层
回复 6# haijie1223


    #AutoIt3Wrapper_Change2CUI=Y       ;编译为cui
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Label1 = GUICtrlCreateLabel("Label1", 48, 64, 204, 57)
$Button1 = GUICtrlCreateButton("Button1", 296, 80, 81, 33)

If $CmdLine[0] = 0 Then
        
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

Else
        If $CmdLine[1] = "-v" Then
                ConsoleWrite("版本 v0.0.1")
        Else
                ConsoleWrite("参数错误")
        EndIf
EndIf

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
以上代码 运行 如图:


点击没有反应呢

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2014-9-25 18:23:01 | 显示全部楼层
回复 7# au3x


    这个界面是别人随便写了一个做测试的吧,你想要做什么效果?
发表于 2014-9-25 23:36:35 | 显示全部楼层


;注意要编译为exe才有效果的
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <WinAPI.au3>
#NoTrayIcon
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 324, 189, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 192, 72, 57, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
DllCall("kernel32.dll", "BOOL", "AllocConsole")
$hConsole = _WinAPI_GetStdHandle(1)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        DllCall("kernel32.dll", "BOOL", "FreeConsole")
                        Exit
                Case $Button1
                        $s = @HOUR & ":" & @MIN & ":" &  @SEC & @CRLF
                        _WinAPI_WriteConsole($hConsole, $s)
                        If @error Then MsgBox(0,"",@error)
        EndSwitch
WEnd

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2014-9-26 11:45:34 | 显示全部楼层
回复 9# veket_linux


    win7专业版为何点击没有反应呢?
发表于 2014-9-26 11:52:42 | 显示全部楼层
偶木基 。。。 木有条件测试,管理员权限 ? maybe
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-3 04:04 , Processed in 0.080054 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表