Hello, my Problem is that i like to set the Port from a Editfield and i dont know whats wrong with my routine. i think it must work ,but all i get is : cant connect if i write only this : push port call htons; mov,ax all works fine ,but this takes the Port i wrote in database. i like to use the port from an editfield. so i try this: push offset Port push 16 push WM_Gettext push_IDE_PORTFIELD <--- the editfield push HWND call senddialogmessagea push offset Port call htons mov,ax in database i change : Port dd 1234 to Port db 16 dup(0) but i cant connect and dont know whats wrong. i use asm since 4 weeks and i dont want to give up. when i use try and error for this ,i get mosttime a blue screen and need to restart the system. so its frustrating. i use the SAME function to get the IP and it works ,so i dont understand whats wrong. Thanks for help cu
Posted on 2001-01-24 08:43:00 by WH¥
Hi, this is quite easy to explain - WM_GETTEXT gets the ascii text, so you will get 31h 32h 33h 34h instead of 1234. try GetDlgItemInt ...
Posted on 2001-01-24 09:32:00 by beaster
First case is equal to: push 1234 ;in decimal call htons Second case is equal to: push (address of first byte of "Port") call htons I assume this isn't what you meant to do! You probably meant to convert the text in "Port" to a DWORD! There are several functions provided in the MASM32 lib, see a2dw etc. So your code should be more like: (I use invoke) invoke SendDialogMessageA, HWND, IDE_PORTFIELD, WM_Gettext, 16, offset Port invoke a2dw offset Port ;Probably wrong proto, but no docs with me! invoke htons, eax ;Use result of a2dw as htons argument! mov,ax Not sure if I explained it that well, or if it solves your problem, but I think its the answer! Mirno
Posted on 2001-01-24 09:36:00 by Mirno
Beaster's "GetDlgItemInt" is better! But remember to push eax (the result of the "GetDlgItemInt") instead of "offset Port"! The reason for "push offset Port" still stands, you were trying to open port number -where_Port_resides_in_memory- rather than using the contents of "Port"! Mirno
Posted on 2001-01-24 09:44:00 by Mirno
Hello, thanks to you two for taking the time to help me ;) now i understand more about the routine and where my problem is. so lets say : cool and thx for the quick and helpfull answer. have a nice day ;)
Posted on 2001-01-25 15:51:00 by WH¥