WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
What is FASM G
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
Forum Rules Snippets forum rules

In this forum all the registered users may post their snippets of code they whish to share with the WinAsm Studio community following these basic rules:
* Only snippets of code are accepted in the topics of this forum.
* Discussions, suggestions, requests etc. must be posted in the "Discussions" topic.
* Do not post copyrighted material.
Administrators/moderators may edit, move or delete the entries that do not follow the preceding rules.

 

GetControlRect - Get the rect of a child control, this code snippet allows you get the co-ordinates of a child control within its parent window.

shantanu_gadgil
Quote Post


New Member
*

Group: Members
Posts: 13
Member No.: 37
Joined: 26-May 04


GetControlRect

CODE
GetControlRect proc hWinParent:HWND, hWinControl:HWND, lprcRectangle:DWORD

;Get the left-top and the width-height of a child control.
;The co-ordinates are with respect to the specified parent window.
;Rationale: After a "GetControlrect" you would be needing to "MoveWindow" it somewhere.

LOCAL ptLocalControl:POINT
LOCAL rcLocalControl:RECT

push eax
push ebx

invoke GetWindowRect,hWinControl,addr rcLocalControl
mov eax,rcLocalControl.right
sub eax,rcLocalControl.left
mov ebx,lprcRectangle
mov (RECT ptr [ebx]).right, eax;WIDTH

mov eax,rcLocalControl.bottom
sub eax,rcLocalControl.top
mov ebx,lprcRectangle
mov (RECT ptr [ebx]).bottom, eax;HEIGHT

push rcLocalControl.left
pop ptLocalControl.x
push rcLocalControl.top
pop ptLocalControl.y

invoke ScreenToClient,hWinParent,addr ptLocalControl

mov ebx,lprcRectangle
mov eax,ptLocalControl.x
mov (RECT ptr [ebx]).left, eax

mov eax,ptLocalControl.y
mov ebx,lprcRectangle
mov (RECT ptr [ebx]).top, eax

pop ebx
pop eax
ret
GetControlRect endp

Sponsored Links
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topic

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google