flat assembler
Message board for the users of flat assembler.

Index > Windows > four questions

Author
Thread Post new topic Reply to topic
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav
1. i have listbox with LBS_MULTIPLESEL (multi-select), and i want to delete several lines from it:

listbox_array rd 400h

Code:
            lb:
                   push    ecx
                         push    ebx
                         mov     edi,dword [ecx*4+listbox_array]
                     invoke  SendMessage,esi,LB_GETTEXT,edi,szBuffer
                     stdcall _msgbox,[hDlg],szBuffer,szCaptionI,MB_OK
                    invoke  SendMessage,esi,LB_DELETESTRING,edi,NULL
                    pop     ebx
                         pop     ecx
                         inc     ecx
                         cmp     ebx,ecx
                     jnz     lb    


but my code deletes lines through one, where mistake? how to do it right?

2. i have simple flat form, without border and title, how i can simple draw an rectangle on a edge of a window with my color (i try LineTo, but is not very good way, i think)

3. after reading MSDN i trying to enumerate active dial-up connections with RasEnumConnections api-call (rasapi32.dll)

Quote:
lea eax,[ras_conn]
mov [eax+RASCONN.dwSize],sizeof.RASCONN

mov [lpcb],sizeof.RASCONN
mov [lpconn],NULL
invoke RasEnumConnections,ras_conn,[lpcb],[lpconn]
lea eax,[ras_conn]
mov eax,dword [eax+RASCONN.szEntryName]


eax returns NULL, but must return pointer to memory address with szEntryName (i have one active connection)

4. how to convert twips to pixels and vice versa (eg. i get window rect with GetWindowRect and i trying to draw line with LineTo api-call from left-upper corner to right-upper corner, but from the right line goes out of window edge)

ps. big thanks for any answers

_________________
[not enough memory]
Post 16 Sep 2004, 12:03
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
Vasilev Vjacheslav wrote:
but my code deletes lines through one, where mistake? how to do it right?


You have to delete items from the last to the first, because every delete changes indexes of the items next to deleted item. Simply use ebx as an index in the array and decrement it after every delete (until it becomes negative (jns lb). Also, API functions preserves ebx, so you have no need to push/pop it.

Quote:
2. i have simple flat form, without border and title, how i can simple draw an rectangle on a edge of a window with my color (i try LineTo, but is not very good way, i think)


Read about: Rectangle, FillRect, InvertRect, FrameRect, DrawFocusRect


Quote:
4. how to convert twips to pixels and vice versa (eg. i get window rect with GetWindowRect and i trying to draw line with LineTo api-call from left-upper corner to right-upper corner, but from the right line goes out of window edge)


Actually both: GetWindowRect and LineTo works with pixels. The problem is that GetWindowRect get screen coordinates (relative to the upper-left corner of the screen, but LineTo draws in client coordinates (relative to the upper-left corner of the window client area. Better try with GetClientRect. In some (particular) cases you can use ScreenToClient and ClientToScreen functions to convert coordinates.

Regards.
Post 16 Sep 2004, 14:48
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.