i have 3 combo boxes and get the selelected content via

example for combo2

;add the string (use of ctext macro)

invoke SendMessage,hCombo2,CB_ADDSTRING, 0, CTEXT("SOCK_STREAM")

;get selected string

invoke SendMessage, hCombo2, CB_GETCURSEL, 0, 0
mov currSelCB2,eax
invoke SendMessage, hCombo2, CB_GETLBTEXT, currSelCB2, offset myBuffer2

but now my Problem is that i only have a string that isn?t able to invoke ..

is there any "easy" way to convert my selected String in myBuffer2 to somethin that is able to invoke ?
Posted on 2002-11-24 10:50:08 by Allanon
If i understand you correctly, you want to use the retrieved text 'SOCK_STREAM' as a
param in your next winsock call?

This will only work if you add all of the socket constants in the following order. And
the combo-box cannot be sorted in another way then the default.

invoke SendMessage,hCombo2,CB_ADDSTRING, 0, CTEXT("SOCK_STREAM") ;\\ Constant value equ 1 // INDEX=0
invoke SendMessage,hCombo2,CB_ADDSTRING, 0, CTEXT("SOCK_DGRAM") ;\\ Constant value equ 2 // INDEX=1
invoke SendMessage,hCombo2,CB_ADDSTRING, 0, CTEXT("SOCK_RAW") ;\\ Constant value equ 3 // INDEX=2
invoke SendMessage,hCombo2,CB_ADDSTRING, 0, CTEXT("SOCK_RDM") ;\\ Constant value equ 4 // INDEX=3
invoke SendMessage,hCombo2,CB_ADDSTRING, 0, CTEXT("SOCK_SEQPACKET") ;\\ Constant value equ 5 // INDEX=4

invoke SendMessage, hCombo2, CB_GETCURSEL, 0, 0 ;\\ get the index of the selected item
mov currSelCB2,eax+1 ;\\ increase index value by 1 to equal the real constant value
invoke socket,AF_INET,currSelCB2,0 ;\\ 'currSelCB2' == the real value of the constant

Another approach:

You could add the string(s) with the real value infront of them.

and then just do something like this:
mov al,byte ptr [myBuffer2]
invoke socket,AF_INET,al,0 ;\\ 'al' == real contant value (1,2,3,4, or 5)

However you could also compare the string against another string and then set the correct
value in eax or in another variable. But I think it's more efficent the other way i mentioned.
Someone else probably have another idea. Good luck!
Posted on 2002-11-24 13:30:22 by natas
first thank u for ur answer natas
yes u?re right i want to use it for a winsock call
i have 3 combos with all possible ways
but the first solution works only sometimes not always :(
for example here here i ran into probs (3.rd combo box)

IPPROTO_IP equ 0 '/* dummy for IP */
IPPROTO_ICMP equ 1 '/* control message protocol */
IPPROTO_IGMP equ 2 '/* internet group management protocol */
IPPROTO_GGP equ 3 '/* gateway^2 (deprecated) */
IPPROTO_TCP equ 6 '/* tcp */
IPPROTO_PUP equ 12 '/* pup */
IPPROTO_UDP equ 17 '/* user datagram protocol */
IPPROTO_IDP equ 22 '/* xns idp */
IPPROTO_ND equ 77 '/* UNOFFICIAL net disk proto */
IPPROTO_RAW equ 255 '/* raw IP packet */

so i have to try somethin else than simply add an 1 to my index :~

and the second way was somethin i also had in mind but it kinda looks ugly
so i was hoping there was maybe a better solution
Posted on 2002-11-24 14:11:18 by Allanon