Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


Win32, no MFC, and ListBoxes


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Enix   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 October 1999 - 06:11 AM

Im haveing trouble adding data to a list box, without using MFC. if use the following code with a dialog box named NAME_LIST and a list box with the id of PLAYERS and NameList is a HWND pointer to the dialog box and EX1 is of the char* type.

HWND List = GetDlgItem(*NameList, PLAYERS);
SendMessage(List,LB_ADDSTRING,0,(LPARAM)*EX1);

Does any one know why nothing will be added to the dialog box after going thought this code? Id apreciate the help! Thanks for reading-Enix


Sponsor:

#2 mordell   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 October 1999 - 05:40 AM

Enix,

Try stepping through the code with a debugger. Verify that List is != NULL and that SendMessage does not return LB_ERR.

However, my guess is that EX1 is a pointer to a character string. If so, you just need to pass EX1.

This indirection of EX1 returns the VALUE stored at the first element of the array character array, not the ADDRESS of the array which is what the function expects.

Anyways, I hope I was able to explain it correctly...hehe..

e.g.


char *test = "test";
//: point to the ADDRESS of "test".
char *t = test;
//: this is the same as
//: t = &test[0];

//: get the VALUE pointed to by test
char value = *test;
//: this is the same as
//: value = test[0]
//:

So, your SendMessage call becomes:

SendMessage(List, LB_ADDSTRING, 0, (LPARAM) EX1);

HTH,

-mordell


#3 Enix   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 October 1999 - 06:11 AM

Thanks for the help! Its starting to work now!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS