scrolling command line interface in a win32 window.

Hello All,
I'm new to windows programming and I am trying to make a simple command line type interface in a window with visual C (non console app). I have downloaded some keyboard input sample code from the msdn site but I have not had much luck finding alot of info on drawtext() and textout(). I was wondering if anybody could point me in the right direction for doing text output and input in a single window. Any help is greatly appreciated.

Regards, Texanlo

Comments

  • OK you probebly not using MFC and you created your window by your self
    so now you need to use the DC (Device context) you can get the device context of your window by using GetDC which will return to the HDC (handle to device context) to you. know all you have to do is using it
    with the TextOut function (first parameter).
    You can get more info in msdn by searching HDC or CDC (which is MFC class ) but will allow you to know which functuality the HDC can do


    : Hello All,
    : I'm new to windows programming and I am trying to make a simple command line type interface in a window with visual C (non console app). I have downloaded some keyboard input sample code from the msdn site but I have not had much luck finding alot of info on drawtext() and textout(). I was wondering if anybody could point me in the right direction for doing text output and input in a single window. Any help is greatly appreciated.
    :
    : Regards, Texanlo
    :



  • [b][red]This message was edited by AsmGuru62 at 2005-7-25 4:22:45[/red][/b][hr]
    [blue]And, of course, you need to simulate the console buffer. Make an array of strings of fixed length, say 400 lines of 128 characters each and write a function to store symbols in that console buffer. Then simply refresh your window client area with the typed (or outputted) text. Scroll the window as soon as you hit the bottom and then every line after that. A soon as you reach 400 lines in a buffer - begin removing older (first) line as soon as another line entered at the end of buffer.[/blue]

    : OK you probebly not using MFC and you created your window by your self
    : so now you need to use the DC (Device context) you can get the device context of your window by using GetDC which will return to the HDC (handle to device context) to you. know all you have to do is using it
    : with the TextOut function (first parameter).
    : You can get more info in msdn by searching HDC or CDC (which is MFC class ) but will allow you to know which functuality the HDC can do
    :
    :
    : : Hello All,
    : : I'm new to windows programming and I am trying to make a simple command line type interface in a window with visual C (non console app). I have downloaded some keyboard input sample code from the msdn site but I have not had much luck finding alot of info on drawtext() and textout(). I was wondering if anybody could point me in the right direction for doing text output and input in a single window. Any help is greatly appreciated.
    : :
    : : Regards, Texanlo
    : :



  • : [b][red]This message was edited by AsmGuru62 at 2005-7-25 4:22:45[/red][/b][hr]
    : [blue]And, of course, you need to simulate the console buffer. Make an array of strings of fixed length, say 400 lines of 128 characters each and write a function to store symbols in that console buffer. Then simply refresh your window client area with the typed (or outputted) text. Scroll the window as soon as you hit the bottom and then every line after that. A soon as you reach 400 lines in a buffer - begin removing older (first) line as soon as another line entered at the end of buffer.[/blue]
    :
    : : OK you probebly not using MFC and you created your window by your self
    : : so now you need to use the DC (Device context) you can get the device context of your window by using GetDC which will return to the HDC (handle to device context) to you. know all you have to do is using it
    : : with the TextOut function (first parameter).
    : : You can get more info in msdn by searching HDC or CDC (which is MFC class ) but will allow you to know which functuality the HDC can do
    : :
    : :
    : : : Hello All,
    : : : I'm new to windows programming and I am trying to make a simple command line type interface in a window with visual C (non console app). I have downloaded some keyboard input sample code from the msdn site but I have not had much luck finding alot of info on drawtext() and textout(). I was wondering if anybody could point me in the right direction for doing text output and input in a single window. Any help is greatly appreciated.
    : : :
    : : : Regards, Texanlo
    : : :
    :
    :
    :
    :One problem that I have been having is implementing the backspace. The thing I have tried is when the backspace is hit I move the caret back one character width and draw the blank character and then move the caret back again. The problem is that I am not completely drawing over some of the characters and I am getting partial letters displayed. I have used the DC to change to a fixed width font so I would think that I should not get this problem. If I can get the backspace code to work my next step is to get the scrolling working. Any help is greatly appreciated. Regards, Texanlo
  • [b][red]This message was edited by eran_tenenboim at 2005-7-26 7:49:38[/red][/b][hr]
    [b][red]This message was edited by eran_tenenboim at 2005-7-26 7:48:41[/red][/b][hr]
    If I were you I would save every line as string and save it in list, and when a key ,which is not letter such as backspace, is pressed , the whole line erased and redraw. List will also allow you to control scrolling all you have to do is save the first line which is printed and last line and draw the lines from the list, scrolling will change the last and the first. But it's only one way to do this task.
    good luck

    : : [b][red]This message was edited by AsmGuru62 at 2005-7-25 4:22:45[/red][/b][hr]
    : : [blue]And, of course, you need to simulate the console buffer. Make an array of strings of fixed length, say 400 lines of 128 characters each and write a function to store symbols in that console buffer. Then simply refresh your window client area with the typed (or outputted) text. Scroll the window as soon as you hit the bottom and then every line after that. A soon as you reach 400 lines in a buffer - begin removing older (first) line as soon as another line entered at the end of buffer.[/blue]
    : :
    : : : OK you probebly not using MFC and you created your window by your self
    : : : so now you need to use the DC (Device context) you can get the device context of your window by using GetDC which will return to the HDC (handle to device context) to you. know all you have to do is using it
    : : : with the TextOut function (first parameter).
    : : : You can get more info in msdn by searching HDC or CDC (which is MFC class ) but will allow you to know which functuality the HDC can do
    : : :
    : : :
    : : : : Hello All,
    : : : : I'm new to windows programming and I am trying to make a simple command line type interface in a window with visual C (non console app). I have downloaded some keyboard input sample code from the msdn site but I have not had much luck finding alot of info on drawtext() and textout(). I was wondering if anybody could point me in the right direction for doing text output and input in a single window. Any help is greatly appreciated.
    : : : :
    : : : : Regards, Texanlo
    : : : :
    : :
    : :
    : :
    : :One problem that I have been having is implementing the backspace. The thing I have tried is when the backspace is hit I move the caret back one character width and draw the blank character and then move the caret back again. The problem is that I am not completely drawing over some of the characters and I am getting partial letters displayed. I have used the DC to change to a fixed width font so I would think that I should not get this problem. If I can get the backspace code to work my next step is to get the scrolling working. Any help is greatly appreciated. Regards, Texanlo
    :





  • : [b][red]This message was edited by eran_tenenboim at 2005-7-26 7:49:38[/red][/b][hr]
    : [b][red]This message was edited by eran_tenenboim at 2005-7-26 7:48:41[/red][/b][hr]
    : If I were you I would save every line as string and save it in list, and when a key ,which is not letter such as backspace, is pressed , the whole line erased and redraw. List will also allow you to control scrolling all you have to do is save the first line which is printed and last line and draw the lines from the list, scrolling will change the last and the first. But it's only one way to do this task.
    : good luck
    :
    : : : [b][red]This message was edited by AsmGuru62 at 2005-7-25 4:22:45[/red][/b][hr]
    : : : [blue]And, of course, you need to simulate the console buffer. Make an array of strings of fixed length, say 400 lines of 128 characters each and write a function to store symbols in that console buffer. Then simply refresh your window client area with the typed (or outputted) text. Scroll the window as soon as you hit the bottom and then every line after that. A soon as you reach 400 lines in a buffer - begin removing older (first) line as soon as another line entered at the end of buffer.[/blue]
    : : :
    : : : : OK you probebly not using MFC and you created your window by your self
    : : : : so now you need to use the DC (Device context) you can get the device context of your window by using GetDC which will return to the HDC (handle to device context) to you. know all you have to do is using it
    : : : : with the TextOut function (first parameter).
    : : : : You can get more info in msdn by searching HDC or CDC (which is MFC class ) but will allow you to know which functuality the HDC can do
    : : : :
    : : : :
    : : : : : Hello All,
    : : : : : I'm new to windows programming and I am trying to make a simple command line type interface in a window with visual C (non console app). I have downloaded some keyboard input sample code from the msdn site but I have not had much luck finding alot of info on drawtext() and textout(). I was wondering if anybody could point me in the right direction for doing text output and input in a single window. Any help is greatly appreciated.
    : : : : :
    : : : : : Regards, Texanlo
    : : : : :
    : : :
    : : :
    : : :
    : : :One problem that I have been having is implementing the backspace. The thing I have tried is when the backspace is hit I move the caret back one character width and draw the blank character and then move the caret back again. The problem is that I am not completely drawing over some of the characters and I am getting partial letters displayed. I have used the DC to change to a fixed width font so I would think that I should not get this problem. If I can get the backspace code to work my next step is to get the scrolling working. Any help is greatly appreciated. Regards, Texanlo
    : :
    :
    :
    :
    :
    :
    :
    What is the best way to clear the window every time a key is pressed?
  • [blue]Why clear the window on a key press? You need to edit your last line in a buffer - remove the symbol where caret was pointing. And then redraw that last line - and to speed it up - do not redraw the whole line, but only the part, which changed, like so:
    [code]
    this string has a symbol removed by backspace
    ^ - caret is here

    this string has a symbol emoved by backspace
    ^ - caret is here
    [/code]
    as you can see, only the "emoved by backspace" is redrawn.[/blue]
  • : : [b][red]This message was edited by AsmGuru62 at 2005-7-25 4:22:45[/red][/b][hr]
    : : [blue]And, of course, you need to simulate the console buffer. Make an array of strings of fixed length, say 400 lines of 128 characters each and write a function to store symbols in that console buffer. Then simply refresh your window client area with the typed (or outputted) text. Scroll the window as soon as you hit the bottom and then every line after that. A soon as you reach 400 lines in a buffer - begin removing older (first) line as soon as another line entered at the end of buffer.[/blue]
    : :
    : : : OK you probebly not using MFC and you created your window by your self
    : : : so now you need to use the DC (Device context) you can get the device context of your window by using GetDC which will return to the HDC (handle to device context) to you. know all you have to do is using it
    : : : with the TextOut function (first parameter).
    : : : You can get more info in msdn by searching HDC or CDC (which is MFC class ) but will allow you to know which functuality the HDC can do
    : : :
    : : :
    : : : : Hello All,
    : : : : I'm new to windows programming and I am trying to make a simple command line type interface in a window with visual C (non console app). I have downloaded some keyboard input sample code from the msdn site but I have not had much luck finding alot of info on drawtext() and textout(). I was wondering if anybody could point me in the right direction for doing text output and input in a single window. Any help is greatly appreciated.
    : : : :
    : : : : Regards, Texanlo
    : : : :
    : :
    : :
    : :
    : :One problem that I have been having is implementing the backspace. The thing I have tried is when the backspace is hit I move the caret back one character width and draw the blank character and then move the caret back again. The problem is that I am not completely drawing over some of the characters and I am getting partial letters displayed. I have used the DC to change to a fixed width font so I would think that I should not get this problem. If I can get the backspace code to work my next step is to get the scrolling working. Any help is greatly appreciated. Regards, Texanlo
    :

    Regarding your backspace problem. Suggest you use the GetCharWidth()function before you blank out the character.This should solve your problem. I had the same headache and this worked for me.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories