March 28, 2024, 03:19:40 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Removing Console Cursor

Started by ids065, August 04, 2016, 07:05:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ids065

I've been rewriting an old PB35 16 bit application in IWDEV3 Console mode so that it will run under Windows 10.
The program updates the screen quite often by using locate and then print to various positions on the screen.
The problem is that the cursor keeps flashing on and off at the start of each print position and I know of no way to turn it off or change it to another character like 'space' so that it wouldn't show.
If anyone has a solution for this problem I would be most grateful.

Brian

August 04, 2016, 09:00:09 AM #1 Last Edit: August 04, 2016, 09:36:34 AM by Brian Pugh
A quick look finds the SetConsoleCursorInfo API call:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms686019(v=vs.85).aspx

I would like to know if it works!

Brian

Edit: Try the attached IWB program

Egil

Brian,

Your code works fine here on Win7/64.

I modified your code slightly to show how to turn the original cursor back on after removing it with your code, in case it is needed for further input to the program.



' Console mode cursor manipulation

TYPE cInfo
INT s
INT v
ENDTYPE
int size,visible

DECLARE IMPORT,GetConsoleCursorInfo(hConsoleOutput:INT, lpConsoleCursorInfo:CONSOLE_CURSOR_INFO),INT
DECLARE IMPORT,SetConsoleCursorInfo(hConsoleOutput:INT,lpConsoleCursorInfo:cInfo),INT
DECLARE IMPORT,GetStdHandle(nStdHandle:INT),INT

cInfo cInf

OPENCONSOLE

PRINT" Press any key to step forward"

' Save original cursor information
hStdOut=GetStdHandle(0xFFFFFFF5)
GetConsoleCursorInfo(hStdOut,cInf)
size = cInf.s
visible = cInf.v

' Show original cursor
locate 5,5
PRINT "Original cursor: ",

do:until inkey$<>""

' Hide the cursor
cInf.s=100
cInf.v=0
p=SetConsoleCursorInfo(hStdOut,cInf)
PRINT
locate 5,5
PRINT "Hey, no cursor! "
do:until inkey$<>""

' Show original cursor
hStdOut=GetStdHandle(0xFFFFFFF5)
cInf.s = size
cInf.v = visible
p=SetConsoleCursorInfo(hStdOut,cInf)

locate 5,5
PRINT"Now the cursor is back: ",
do:until inkey$<>""
CLOSECONSOLE
END


Support Amateur Radio  -  Have a ham  for dinner!

Brian

Egil,

And yours works for me, too, on Windows 10 64-bit

Brian

ids065

Thanks guys,

that was a quick response and yes the code works fine with windows 10 64 bit.

I'm really grateful

Ian

Egil

Hi Ian,

When I served in the navy, the vessels commander said in his welcome speech: "Remember that from now on the word "Problems" does not exist. Use "Challenges" instead. And if that  does not help, ask somebody!"

That have always worked for me.    ;D ;D ;D


Egil

Support Amateur Radio  -  Have a ham  for dinner!

ids065

Hi Egil,

sounds like good advice and I was thankful for the help with this annoying 'challenge'  :)
Think you must be a radio amateur and the program I am converting from PB3.5 (16 bit DOS program) to run under 64bit Windows 10 is my ARTALK program to control my AOR8600 scanner.
It's working really well and I just have to add a few bells and whistles to get all the functions I had before and a few more.
Maybe we will talk on the bands some time.
73,
Ian (DJ0HF/G3ULO)

Egil

August 07, 2016, 09:48:04 AM #7 Last Edit: August 07, 2016, 10:01:55 AM by Egil
Hi Ian,

Your right, been licensed since January 1964. Last twenty years my main radio activity has been trying to decode all kinds of obscure digital transmissions on  the HF Utility bands.
Took up coding as a hobby when I retired some yars ago, mainly trying to make radio utilities.  Both CB and IWB are ideal for making such programs.

I do not know the scanner you mention, but AOR are famous for making good receivers. I hope you  succeed with the conversion.

That reminds me of a project I started a while ago, a remote control program for  the Yaesu FT-817ND QRP Transceiver. The project was put on hold  while waiting for an update of the CB Serial Comms library. But I don't think it will ever be released, so now I have made my own routines, and have no excuse for not finishing the project. Just have been too busy coding other utilities.

By the way, many of the IWB Forum users are radio amateurs, so you have found the right place!

73's
Egil



EDIT: Almost forgot... I hope you noticed the discussion Graham and me had in the CB section (http://www.ionicwind.com/forums/index.php?topic=5901.0)
What we discussed there is also true for IWB.


Support Amateur Radio  -  Have a ham  for dinner!

ids065

yup, program is working a treat just as well as the old 16 bit version.
73,
Ian
DJ0HF/G3ULO

GWS

Hello Ian,

I'm pleased you found your way to these useful Basic languages ..  ;D

Also very impressed with your amateur radio exploits over the years - you're much more organised than I ever was  :)

http://www.spencerweb.net/Ian_and_Julie/Hobbies/Amateur_Radio/amateur_radio.html

A year or so ago, I sold all my gear except for an FRG 7700 receiver and a few bits of QRP kit.
I've got no aerial to speak of .. just a bit of dangling wire - so I doubt you'll ever hear my little squeaks ..  ;D

I still like valve kit, but it's getting almost impossible to find anything that works now.
(Attached pic of my sort of kit .. )

best wishes, :)

Graham G4EVW
Tomorrow may be too late ..

ids065

Hi Graham,

thank you for your kind words but if you look at my shack it doesn't often look  very organised  ;)
Basic, well I think we are of a similar generation and I first used Basic back in 1970 and progressed from interpreters to Power Basic 3.5 for DOS in which I wrote several control programs for my rigs/radios then went on to PB Console Compiler but never liked their PBWIN windows version and moved on to IBasic which of course lead to Creative Basic and finally IWB with which I am very satisfied including this great forum and I write both true windows as well as console programs with it. Probably not the subject for this forum but having a lot of fun at the moment building the OZQRP MDT 40 metre DSB transceiver. Seems like a great little QRP kit. I also still love valves but the only thing I have at the moment is a little 2 valve superregen which glows nicely.

73,
Ian
DJ0HF/G3ULO