Thread: I have a problem in an EDIT box

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001

    Question I have a problem in an EDIT box

    I am using an EDIT box. I have an INSERT -> *selection* menu, too. I want to insert the text "hi" plus the already-entered text in the EDIT box. When I declare: char newHTML, it says:

    293 starpage.cpp
    passing `char **' as argument 2 of `SetWindowTextA(HWND__ *, const CHAR *)'

    a bunch of times and i tried using a pointer like this:

    char *newHTML[600];

    case CM_INSERT_TR:
    GetWindowText(html, newHTML, 999999);

    newHTML = strcat(newHTML, "<tr>");

    SetWindowText(html, newHTML);

    But I get a "Performed Illegal Operation" error. What do I do?


    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    train spotter
    Join Date
    Aug 2001
    near a computer
    I believe that declaring

    char *sBuffer[64];

    gives you an array of 64 char pointers.
    Using sBuffer without an array refrence (sBuffer[12]) is a char * (pointer to the first element of the char array sBuffer). That is why the compiler is telling you you are sending in a char **.


    char sBuffer[64];

    with the same call to GetWindowText(). I would call GetWindowTextLength() first and use this as the max amount to copy into the string. (You can test/allocate mem to hold the string)

    ensure the HWND is of the control not of the dialog. Use GetDlgItem() if needed.

    I would also use sprintf() to 'join' the strings.
    Last edited by novacain; 10-19-2001 at 01:35 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. WS_HSCROLL in ES_READONLY edit box error
    By Homunculus in forum Windows Programming
    Replies: 4
    Last Post: 02-13-2006, 08:46 AM
  3. Multiline Edit Box Parser
    By The Brain in forum Windows Programming
    Replies: 6
    Last Post: 11-01-2005, 07:15 PM
  4. setting fixed floats in edit box
    By WaterNut in forum Windows Programming
    Replies: 4
    Last Post: 08-13-2004, 09:13 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM