Blue Posted June 21, 2011 Share Posted June 21, 2011 Hi all, I gotta stuck in an assembly project, I need to do two thing in it. First one is I am using a combo box in it, so I need to know that how to use combo box to add lists in it, and how to get that which one is selected ? Also I want to get the selected list value from Combo box in Digits like, I want to prepare combo box list like this : 1. XXXXX 2. YYYYY 3. ZZZZZ And want to take selected value back in Numeric form like 1,2 and 3. The second question is that, how to get the clipboard data in a temp buffer. I tried the following code, but it's giving me waste local ClipHwnd:DWORDInvoke OpenClipboard,NULL .If eax invoke GetClipboardData, CF_TEXT .If eax != 0 invoke GlobalLock, eax mov ClipHwnd, eax ; Do something with clipboard text here!; ClipHwnd == pointer to text invoke GlobalUnlock, ClipHwnd .endif invoke CloseClipboard .endif I taken this code from winasm forum, where xsp!der told that using edx instead of ClipHwnd solves the matter, but in my case. It is not working. Ref : http://www.winasm.net/forum/index.php?showtopic=3676 Please help in solving this problem. Link to comment
Killboy Posted June 21, 2011 Share Posted June 21, 2011 (edited) 1. CB_ADDSTRING + CB_GETCURSEL2. ClipHWnd will hold the address of the text, just strcpy it somewhere and thats itFor extra safety you might want to call IsClipboardFormatAvailable(CF_TEXT) before trying to get the text Edited June 21, 2011 by Killboy Link to comment
kao Posted June 21, 2011 Share Posted June 21, 2011 1) MASM32 example: http://members.a1.net/ranmasaotome/masm32/Combobox.zip2) Your clipboard code is buggy in several ways. Try this one: local ClipHwnd : DWORD local Buffer[4096] : BYTE Invoke OpenClipboard,NULL .If eax invoke GetClipboardData, CF_TEXT .If eax != 0 mov ClipHwnd, eax invoke GlobalLock, eax ; If you want to have the text to be available after calling ; GlobalUnlock and CloseClipboard, you MUST copy it to your own buffer invoke lstrcpy, ADDR Buffer, eax invoke MessageBox, 0, ADDR Buffer, 0, 0 invoke GlobalUnlock, ClipHwnd .endif invoke CloseClipboard .endifWarning - My code does not check for string length, so buffer overflow will happen, if there's more than 4096 characters in clipboard. Link to comment
Blue Posted June 21, 2011 Author Share Posted June 21, 2011 (edited) Thank you Kao and Killboy. Problem solved. But how to to take the value of selected list in number like 1,2,3 etc ? Edited June 22, 2011 by Blue Indian Link to comment
Killboy Posted June 22, 2011 Share Posted June 22, 2011 Thank you Kao and Killboy. Problem solved. But how to to take the value of selected list in number like 1,2,3 etc ? CB_GETCURSEL add 1 to the return value and you have your number 1, 2, or 3 Link to comment
Blue Posted June 22, 2011 Author Share Posted June 22, 2011 Thank you so much Killboy, now I can proceed with project. Thanks Link to comment
0xFF Posted June 24, 2011 Share Posted June 24, 2011 Next time state the prog lang in a tag [MASM] in the title so people (like me, i thought it was a Delphi Q) won't get confused. Link to comment
atom0s Posted June 25, 2011 Share Posted June 25, 2011 Next time state the prog lang in a tag [MASM] in the title so people (like me, i thought it was a Delphi Q) won't get confused.Given that his post contains an MASM example, its fairly easy to tell what language its in. You'd know that if you were a programmer and didn't just copy everyone elses work. 1 Link to comment
0xFF Posted June 25, 2011 Share Posted June 25, 2011 (edited) Given that his post contains an MASM example, its fairly easy to tell what language its in. You'd know that if you were a programmer and didn't just copy everyone elses work.If you don't have anything clever to say, don't reply at all Wiccaan. I doubt the only thing you can make is a trainer, can't wait for your next tutorial on how to use Debugging APIs.Oh, btw, i said in the Title of the thread, not in the content of it, saves time from getting inside here and see if it's something else, read before you reply, you're such a "programmer", i don't want to tell you how some of the CEF legends talk about you in the back. Edited June 25, 2011 by rotem156 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now