First school MFC (2)

zhaozj2021-02-16  51

After I finished the dialog, I want to put some controls on the dialog box. What is it? I seem to see, which control has not been done :), what should I do? Then just choose one!

Yes, use Combo Box to display the IP address of this unit. To do it, let's take a book, let's find the information, let's find the information of Combo Box, huh, I have a paid, and finally let me find it.

1: Place a Combo Box control on the dialog

2: Establish a message function for this control

3: Find the IP address with Winsock in this function

4: Display the IP address in the control with the following code

m_combox.addstring (ip);

Updatedata (FALSE);

Run, haha, displayed. I can't help but get it: I have to take the value of the Combo Box again. However, I didn't get it out at first, what is the reason? Oh, I am sorry, I am wrong, using the wrong function, mishering the GetItemData and getLbtext misunderstanding: (and this point I turned, but what? There is 9CBS, huh, huh After the adult pointing point, I know the following code after the mistake is:

Int ncount;

INT NINDEX;

CSTRING MyIP;

Ncount = m_combox.getcount ();

NINDEX = m_combox.getcursel ();

m_combox.getlbtext (nindex, myip);

Messagebox (MyIP);

Haha, made it. And there is an unexpected gain:

LPCTSTR

with

Cstring

Communication

转载请注明原文地址:https://www.9cbs.com/read-25251.html

New Post(0)