L_AnnHitTestExt
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_AnnHitTestExt(hContainer, pPoint, puResult, phObjectHit, pHitTestInfo, uStructSize)
HANNOBJECT hContainer; |
/* handle to the container object */ |
LPPOINT pPoint; |
/* pointer to a structure */ |
/* position on the object at the point */ | |
pHANNOBJECT phObjectHit; |
/* address of the variable to be updated */ |
pANNHITTESTINFO pHitTestInfo; |
/* pointer to a ANNHITTESTINFO structure that provides hit test information */ |
L_UINT uStructSize; |
/* size of the ANNHITTESTINFO structure */ |
This function encapsulates L_AnnHitTest(), which gets the handle to the annotation object that is located at a specified point. (If objects overlap, it gets the front object.) L_AnnHitTestExt gets additional information about the annotation object handle if the handle is a default or user-defined handle. This function is available in the Document/Medical Toolkits.
Parameter |
Description |
hContainer |
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. Possible values are: |
|
ANNHIT_NONE [0] |
|
ANNHIT_BODY [1] |
|
ANNHIT_HANDLE [2] |
|
ANNHIT_NAME [3] |
|
ANNHIT_USER_HANDLE [4] |
|
ANNHIT_ROTATE_HANDLE [5] |
|
ANNHIT_MULTISELECT_HANDLE[6] |
|
ANNHIT_MULTISELECT_ROTATE_HANDLE[7] |
|
ANNHIT_MULTISELECT_BODY[8] |
|
If (*puResult) is updated with ANNHIT_HANDLE or ANNHIT_USER_HANDLE, then pHitTestInfo contains additional information about the annotation object handle. For example, if (*puResult) is ANNHIT_ROTATE_HANDLE, pHitTestInfo->nHandleID will be either ROTATE_HANDLE_CENTER_ID[100] or ROTATE_HANDLE_GRIPPER_ID[101] to identify which rotate handle was hit. |
|
ANNHIT_NONE [0] |
phObjectHit |
Address of the variable to be updated with the handle to the annotation object that is found at the specified point. |
pHitTestInfo |
Pointer to a ANNHITTESTINFO structure that provides hit test information whenever (*puResult) is updated with ANNHIT_HANDLE or ANNHIT_USER_HANDLE. |
uStructSize |
Size in bytes, of the structure pointed to by pHitTestInfo, for versioning. Use sizeof(ANNHITTESTINFO). |
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 the Output window.
// If the result of the hit test is a user handle, additional information about the handle is displayed.
L_VOID ExampleAnnHitTestExt(HANNOBJECT hContainer, POINT ptPointToTest, pHANNOBJECT phAnnObject)
{
L_TCHAR szMsg[200];
L_TCHAR szHitTestInfo[200];
ANNHITTESTINFO HitTestInfo;
L_TCHAR *pszResult;
L_INT nRet;
// This function determines which annotation object you have clicked.
HANNOBJECT hObject; // Local variable for the annotation object
L_UINT uResult; // Result of the test
// Get the object at the specified point
memset(&HitTestInfo, 0, sizeof(ANNHITTESTINFO));
HitTestInfo.uStructSize = sizeof(ANNHITTESTINFO);
nRet = L_AnnHitTestExt(hContainer, &ptPointToTest, &uResult, &hObject, &HitTestInfo, sizeof(ANNHITTESTINFO));
if (nRet != SUCCESS)
return;
switch(uResult)
{
case ANNHIT_NONE:
pszResult = TEXT("ANNHIT_NONE");
break;
case ANNHIT_BODY:
pszResult = TEXT("ANNHIT_BODY");
break;
case ANNHIT_NAME:
pszResult = TEXT("ANNHIT_NAME");
break;
case ANNHIT_HANDLE:
wsprintf(szHitTestInfo, TEXT("ANNHIT_HANDLE nHandleIndex[%d], nHandleID[%d]"),
HitTestInfo.nHandleIndex, HitTestInfo.nHandleID);
pszResult = szHitTestInfo;
break;
case ANNHIT_USER_HANDLE:
wsprintf(szHitTestInfo, TEXT("ANNHIT_USER_HANDLE nHandleIndex[%d], nHandleID[%d]"),
HitTestInfo.nHandleIndex, HitTestInfo.nHandleID);
pszResult = szHitTestInfo;
break;
}
wsprintf(szMsg, TEXT("[%x] %s\n"), hObject, pszResult);
OutputDebugString(szMsg);
return;
}