I am trying to use kernell 32 to read the contents of the command window using the GetConsoleScreenBufferInfo windows function with Labview Call Library function. The function at the top of the vi works fine, which reads the computer name but the one below it doesn't return anything. The function is defined at the following site:
I'v never really used the Call Library function before so I'm not sure if I have it set up right. How do I get the right parameters set up?
GetConsoleScreenBufferInfo takes 2 input.
You provide none.
handle is the 1st input, not the 2nd.
The 2nd parameter is a pointer to a structure (Cluster in LabVIEW), not size.
You are very lucky. LabVIEW usually crashes when you make this kind of error.
Yes but how does one convert this to a cluster. What sort of data types are they to which inputs. And in what order should they be in. Its all very vague, unless one is very familier with the windows API's the parameters are difficult to interpret. I would interpret the below as 1 input with 3 outputs.
_In_ HANDLE (ip1) hConsoleOutput (op1) _Out_ PCONSOLE_SCREEN_BUFFER_INFO lp (op2) ConsoleScreenBufferInfo (op3)
> What sort of data types are they to which inputs. And in what order should they be in. Its all very vague
All defined in the link you provided.
I would also point out that you can use the .NET process library to launch a command-line process and you can then interact with it through STDIN and STDOUT to send commands to it, or to read out the current console window. I did post an example on the forums somewhere but I can't find it now.
Just thought I'd throw the alternative out there in case you struggle to get this working.
Sam. i think this the one you are referring to: Does it have a bug as when I run it it seems to run an indefinate loop and I cannot stop it and must use task manager to kill it.
With regards to kernell32 and call library function is there any documentation or examples on how to interact with labview?
I have modified your code to add a seperate button for read and replaced the while loop. This prevents it from hanging. It allows to do one read only. However the write function does not seem to work. It was initially but all of a sudden it has stopped. i would run it, send string, then read. It only displays the initial run window data. Any ideas to why this may be?