jwwlchen 发表于 2014-3-25 22:12:59

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

本帖最后由 jwwlchen 于 2014-3-26 22:52 编辑

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

haijie1223 发表于 2014-3-25 23:37:00

#AutoIt3Wrapper_Change2CUI=y
ConsoleWrite("Hello World!")

zch11230 发表于 2014-3-26 14:02:00

原来开头是要加AutoIt3Wrapper_Change2CUI这么一句啊 我就说之前怎么不行呢。

jwwlchen 发表于 2014-3-26 22:51:28

原来如此 ! Thanks!

au3x 发表于 2014-9-25 11:10:17

回复 2# haijie1223


    可行,但是这个AutoIt3Wrapper_Change2CUI又何 解呢?

haijie1223 发表于 2014-9-25 13:34:04

回复 5# au3x


    http://www.autoitx.com/forum.php?mod=viewthread&tid=38822&highlight=%23AutoIt3Wrapper%5C_Change2CUI

au3x 发表于 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 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 = "-v" Then
                ConsoleWrite("版本 v0.0.1")
      Else
                ConsoleWrite("参数错误")
      EndIf
EndIf

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


点击没有反应呢

haijie1223 发表于 2014-9-25 18:23:01

回复 7# au3x


    这个界面是别人随便写了一个做测试的吧,你想要做什么效果?

veket_linux 发表于 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

dunphy 发表于 2014-9-26 11:45:34

回复 9# veket_linux


    win7专业版为何点击没有反应呢?

veket_linux 发表于 2014-9-26 11:52:42

偶木基 。。。 木有条件测试,管理员权限 ? maybe
页: [1]
查看完整版本: [已解决]如何类似C++ Win32控制台应用程序那样可以直接将结果输出到cmd窗口