PureBasic Forum
https://www.purebasic.fr/english/

Get STDIN data
https://www.purebasic.fr/english/viewtopic.php?f=5&t=2890
Page 1 of 1

Author:  BackupUser [ Tue Jul 10, 2001 5:19 pm ]
Post subject: 

Restored from previous forum. Originally posted by wavemaker.

Hello:

I wrote this program trying to get the STDIN string to write a CGI program -handling forms data, etc.- in PB Windows, but I can't even get SetConsoleMode_ working. Any help?

InitWindow(0)
temporal.s = " "
numero.l = 0
If OpenWindow(0, 100, 100, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "PureBasic Window")
resultado = GetStdHandle_(#STD_INPUT_HANDLE)
If SetConsoleMode_(resultado,#ENABLE_LINE_INPUT | #ENABLE_ECHO_INPUT | #ENABLE_PROCESSED_INPUT)
Repeat
EventID.l = WaitWindowEvent()
If ReadConsoleInput_(resultado,@temporal,1000,@numero)
MessageRequester("Stdin:",temporal,0)
EndIf
If EventID = #PB_EventCloseWindow
Quit = 1
EndIf
Until Quit = 1
EndIf
EndIf
End

Thanks

Juan Calderón Alonso
Registered user

Author:  BackupUser [ Wed Jul 11, 2001 5:03 am ]
Post subject: 

Restored from previous forum. Originally posted by Mr.Skunk.

Don't have really time for the moment to experiment your code, but i saw two errors:
resultado must be Long => resultado.l (as the result is a handle DWORD)
There is a problem from GetStdHandle (the result is -1 instead of the handle address), so perhaps SetConsoleMode would work if you solve the GetStdHandle problem...

Hope it can help you...

Mr.Skunk

Edited by - mr.skunk on 11 July 2001 06:49:45

Author:  BackupUser [ Wed Jul 11, 2001 4:52 pm ]
Post subject: 

Restored from previous forum. Originally posted by Mr.Skunk.

On your code, you need AllocConsole_() just before calling GetStdHandle to make it work.

Your temporal.s is not the good way to retreive info from console with your ReadConsoleInput_(). See here :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/hh/winbase/conchar_8p6a.asp

You have to create an input record buffer which is much more than a simple string (key event, mouse event...)
It should works with this input record buffer

Hope it helps...

Mr Skunk

Edited by - mr.skunk on 11 July 2001 17:52:54

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/