Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Übersetzt einen Punkt aus Bildschirmpixelkoordinaten in Fensterpixelkoordinaten.
void _GlobalToLocalP(Point FAR *pt, WHANDLE wh)
Point FAR *pt; /* Point. */
WHANDLE wh; /* Window handle. */
Hinweise
Rufen Sie vor dem Aufrufen von _GlobalToLocalP( ) zunächst _FindWindow( ) auf, um zu ermitteln, in welchem Fenster sich der Punkt befindet.
Weitere Informationen zum Erstellen einer API-Bibliothek und ihrer Integration in Visual FoxPro finden Sie unter Zugreifen auf die Visual FoxPro-API.
Beispiel
Im folgenden Beispiel wird gewartet, bis mit der linken Maustaste geklickt wird. Dann wird mit _FindWindowP( ) das Fensterhandle für die Mausposition ermittelt. _GlobalToLocalP( ) übernimmt sowohl das Fensterhandle als auch die absolute Mausposition als Parameter und gibt die Mausposition als eine Position relativ zum Fenster zurück.
Visual FoxPro-Code
SET LIBRARY TO GLTOLOCP
C-Code
#include <pro_ext.h>
void putLong(long n, int width)
{
Value val;
val.ev_type = 'I';
val.ev_long = n;
val.ev_width = width;
_PutValue(&val);
}
FAR FindWindowEx(ParamBlk FAR *parm)
{
WHANDLE wh;
Point mousePos;
int where;
// Get mouse position when left button goes down
_Execute("WAIT WINDOW 'Click In A Window' NOWAIT" );
while (_InKey(0, MOUSEACTIVE | HIDECURSOR) != 151);
while (!_MousePosP(&mousePos));
switch (where = _FindWindowP(&wh, mousePos))
{
case inBorder:
_PutStr("\nMouse down inBorder"); break;
case inHelp:
_PutStr("\nMouse down inHelp"); break;
case inContent:
_PutStr("\nMouse down inContent"); break;
case inDrag:
_PutStr("\nMouse down inDrag"); break;
case inGrow:
_PutStr("\nMouse down inGrow"); break;
case inGoAway:
_PutStr("\nMouse down inGoAway"); break;
case inZoom:
_PutStr("\nMouse down inZoom"); break;
case inVUpArrow:
_PutStr("\nMouse down inVUpArrow"); break;
case inVDownArrow:
_PutStr("\nMouse down inVDownArrow"); break;
case inVPageUp:
_PutStr("\nMouse down inVPageUp"); break;
case inVPageDown:
_PutStr("\nMouse down inVPageDown"); break;
case inVThumb:
_PutStr("\nMouse down inVThumb"); break;
case inHUpArrow:
_PutStr("\nMouse down inHUpArrow"); break;
case inHDownArrow:
_PutStr("\nMouse down inHDownArrow"); break;
case inHPageUp:
_PutStr("\nMouse down inHPageUp"); break;
case inHPageDown:
_PutStr("\nMouse down inHPageDown"); break;
case inHThumb:
_PutStr("\nMouse down inHThumb"); break;
case inMenuBar:
_PutStr("\nMouse down inMenuBar"); break;
default:
_PutStr("\nMouse down someplace else"); break;
}
_GlobalToLocalP(&mousePos, wh);
_PutStr("\nPosition relative to window:");
putLong(mousePos.v, 5);
_PutChr(' ');
putLong(mousePos.h, 5);
}
FoxInfo myFoxInfo[] = {
{"ONLOAD", FindWindowEx, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};
Siehe auch
_FindWindow( ), API-Bibliotheksroutine | _MousePos( ), API-Bibliotheksroutine | _GlobalToLocal( ), API-Bibliotheksroutine | Zugreifen auf die Visual FoxPro-API