want to attach console window using VB script

August 27, 2010 at 08:04:25
Specs: Windows XP
Hi! I have one consoile window and i want to attach it using attachConsole extern function but it is unable to attach to the console window. It is an urgent issue i want to resolve. please help

See More: want to attach console window using VB script

Report •


#1
August 27, 2010 at 08:14:16
If it's VBScript, you cannot. The Declare keyword is not included as part of VBScript's functionality.

Report •

#2
August 27, 2010 at 08:21:12
Thank you, but other functions like "FindWindow" and "SetWindowText" are working correctly. I want to write inside the screen for that i am using MapVirtual Key and pressKey fucntions. Please confirm whether it will work or not. Thanks

Report •

#3
August 27, 2010 at 08:28:50
Thank you, but other functions like "FindWindow" and "SetWindowText" are working correctly. I want to write inside the screen for that i am using MapVirtual Key and pressKey fucntions. Please confirm whether it will work or not. Thanks


Report •

Related Solutions

#4
August 27, 2010 at 08:59:28
other functions like "FindWindow" and "SetWindowText" are working correctly.
Then obviously you're not using VBScript. What language are you using?

Report •

#5
August 27, 2010 at 09:02:56
I am using VBScript only, these two function have used for finding out the window and setting the text of the window. Please tell me whether extern.attachConsole() will work or not. Please send the reply ASAP

Report •

#6
August 27, 2010 at 09:28:56
I am using VBScript pnly
No, I'm pretty sure you're not using vanilla VBS:
Fri 08/27/2010 12:26:34
E:\>copy con some.vbs
WScript.Echo FindWindow("Calculator")^Z
        1 file(s) copied.


Fri 08/27/2010 12:26:40
E:\>cscript //nologo some.vbs
E:\some.vbs(1, 1) Microsoft VBScript runtime error: Type mismatch: 'FindWindow'

So this leaves two choices. Either you're using some sort of custom/third party scriptable COM object, or you're confusing one of the four Visual Basics as Visual Basic Script.


Report •

#7
August 27, 2010 at 11:22:36
I am able to declare funcitons that use dll. I have used "extern.GetWindowThreadProcessId" and getting expected result also. Please let me knwo why attachConsole('Public Declare Function AttachConsole Lib "Kernel32.dll" (ByVal Pid As Long) As Boolean

Extern.Declare Bool,"AttachConsole", "Kernel32.dll","AttachConsole",micLong+micByVal) function is not wiorking.

Extern.Declare micHwnd, "FindWindow", "user32.dll", "FindWindowA", micString, micString

extern.Declare micLong,"GetWindowThreadProcessId","user32.dll","GetWindowThreadProcessId",micLong,micLong


Report •

#8
August 27, 2010 at 11:25:28
I am able to declare funcitons that use dll. I have used "extern.GetWindowThreadProcessId" and getting expected result also. Please let me knwo why attachConsolefunction is not wiorking.

Extern.Declare micHwnd, "FindWindow", "user32.dll", "FindWindowA", micString, micString

extern.Declare micLong,"GetWindowThreadProcessId","user32.dll","GetWindowThreadProcessId",micLong,micLong


Report •

#9
August 27, 2010 at 11:29:16
I am using VBScript in QTP tool

Report •

#10
August 27, 2010 at 12:00:55
So there you go; you're using QTP.

I don't use QTP, but I do use C++, and the Win32 API's are in C, so I can take a shot at the declare statement:

Extern.Declare micInteger, "AttachConsole", "Kernel32.dll", micULong


Report •

#11
August 27, 2010 at 13:44:31
I am using this declaration "Extern.Declare Bool,"AttachConsole", "Kernel32.dll","AttachConsole",micLong+micByVal"

Please tell me can i create a class and object into it for this dll and then by any way can use it?


Report •

#12
August 27, 2010 at 13:57:05
"Extern.Declare Bool,
Except it's not a boolean. It's a BOOL. And a BOOL is a WINBOOL is an Integer.

But yes, you could make a COM wrapper for it.


Report •

#13
August 27, 2010 at 14:12:54
If you have any reference code for how to make, please share it

Report •

Ask Question