L_AnnHitTest
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_AnnHitTest(hObject, pPoint, puResult, phObjectHit)
HANNOBJECT hObject; |
/* handle to the container object */ |
LPPOINT pPoint; |
/* point to test */ |
/* position on the object at the point */ | |
pHANNOBJECT phObjectHit; |
/* address of the variable to be updated */ |
Gets the handle to the annotation object that is located at a specified point. If objects overlap, this function gets the front object. This function is available in the Document/Medical Toolkits.
Parameter |
Description |
hObject |
Handle to the container object that sets the scope of the search. |
pPoint |
Pointer to the POINT structure that specifies the point to test. Coordinates are relative to the associated window's client area. |
puResult |
The position on the annotation object that was found at the specified point. The following are possible values: |
|
ANNHIT_NONE [0] |
|
ANNHIT_BODY [1] |
|
ANNHIT_HANDLE [2] |
|
ANNHIT_NAME [3] |
phObjectHit |
Address of the variable to be updated with the handle to the annotation object that is found at the specified point. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
Before calling this function, you must declare a variable of data type HANNOBJECT. You can then pass the address of the variable in the phObjectHit parameter, which this function will update with the handle of the object located at the specified point.
Required DLLs and Libraries
LTANN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Windows 95 / 98 / Me, Windows 2000 / XP.
See Also
Example
// This example uses the caller’s mouse coordinates to get the handle
// to the annotation object at the specified coordinates
// The part of the clicked annotation is displayed in a MessageBox
void TestAnnHit(HANNOBJECT hContainer, int xFromWindow, int yFromWindow, pHANNOBJECT phAnnObject)
{
L_TCHAR szMsg[200];
L_TCHAR *pszResult;
// This function determines which annotation object you have clicked.
HANNOBJECT ThisObject; /* Local variable for the annotation object */
POINT PointToTest; /* The point in the window's client area to test */
L_UINT TestResult; /* Result of the test */
// Use incoming coordinates to specify the point to test
PointToTest.x = xFromWindow;
PointToTest.y = yFromWindow;
// Get the object at the specified point
L_AnnHitTest(hContainer, &PointToTest, &TestResult, &ThisObject);
switch(TestResult)
{
case ANNHIT_NONE:
pszResult = TEXT("ANNHIT_NONE");
*phAnnObject = 0;
break;
case ANNHIT_BODY:
pszResult = TEXT("ANNHIT_BODY");
*phAnnObject = ThisObject;
break;
case ANNHIT_HANDLE:
pszResult = TEXT("ANNHIT_HANDLE");
*phAnnObject = ThisObject;
break;
case ANNHIT_NAME:
pszResult = TEXT("ANNHIT_NAME");
*phAnnObject = ThisObject;
break;
}
wsprintf(szMsg, TEXT("[%x] %s"), ThisObject, pszResult);
MessageBox(NULL, szMsg, TEXT(""), MB_OK);
return;
}