[ C WinApi ] Create an " information console" zone

Discussion in 'Mixed Languages' started by Pr3acher, Oct 22, 2012.

  1. Pr3acher

    Pr3acher MDL Member

    Aug 24, 2012
    142
    48
    10
    Hi all ,
    i just want to know how to create 'information console' zone ?
    Just like CODYQX4 has done in its M$ toolkit
    Is it just an edit control with text and bkg color ?
     
  2. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,457
    150
    Not sure how to do it in C++, but it is just a .NET Textbox with black background and greenish text.

    In C# I use AppendText to write to it, and the Process object lets you capture Standart Input/Output/Error, and you can dump that.

    I believe there is a way to make a Managed C++ app that uses .NET and can use those controls, but that wouldn't be Win32 API, and would require .NET FX.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Pr3acher

    Pr3acher MDL Member

    Aug 24, 2012
    142
    48
    10
    ( C not C++ but quite the same...:animatedwink:)
    Ok thanks CODYQX4, i succeded but i still have a little prob with that sh*t Api:
    how do i write text in it without removing the previous text ?
     
  4. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,457
    150
    What API? Anyway if you aren't using AppendText, can you read the current value as a string, concat the new stuff to it, and set that?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Pr3acher

    Pr3acher MDL Member

    Aug 24, 2012
    142
    48
    10
    This is the WinApi (native windows APi). C# seems nice to handle :rolleyes:... Well i'll try to concat with strcat(), but i wonder if i could use a pointer to the end of the edit with SetFilePointer() ?
     
  6. Pr3acher

    Pr3acher MDL Member

    Aug 24, 2012
    142
    48
    10
    Thank you so much CODYQX4. I succeded with strcat() to concat. I post if it can helps someone one day:
    -you retrieve edit text in a buffer
    -concat your text with the one in the buffer
    -send buffer to edit

    Here is an example:

    SendMessage(inform,WM_GETTEXT,sizeof(informBuff),informBuff);
    strcat(informBuff,"\r\nThanks CODYQX4 ;)");
    SendMessage(inform,WM_SETTEXT,0,informBuff);

    It aint difficult but must to think about such a way to do it...;)