51Testing软件测试论坛

标题: 如何获取command窗口中的信息? [打印本页]

作者: workcat    时间: 2006-4-18 16:10
标题: 如何获取command窗口中的信息?
我使用如下代码, 但是失败,谁能告诉我正确应该怎么做?


# Launch DOS Command Prompt
rc = invoke_application("cmd.exe","","",SW_SHOW);
wait(1);
if ( rc != E_OK) {
        tl_step("Opening cmd",FAIL,"Unable to open cmd. Error code: " & rc);
        return(rc);
}

tl_step("open_cmd",PASS,"cmd opened");
# Capture the handle and create a physical description
rc = reload ("win32api", 1, 1);
hWnd = FindWindowA("ConsoleWindowClass","C:\\" & windows_type & "\\System32\\cmd.exe");
DWIN = "{ handle: " & hWnd & " }";

if (win_exists(DWIN,5) != E_OK) {
  tl_step("open_cmd", FAIL,"DWIN window does not exist. Console not opened.");
  return(E_OPERATION_NOT_PERFORMED);
}

win_activate(DWIN);
set_window(DWIN,1);

type("cd temp" );
wait(1);
type("<kReturn>");

win_get_text (DWIN, text);



DWIN 的获取以及set, activate 都正常,但是win_get_text信息为空
why?




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2