oForm = CREATEOBJECT("desaparecer") oForm.show READ events ************************************************** *-- Class: desaparecer (c:\temp\vfp7\api translator\desaparecer.vcx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 10/18/02 03:42:00 PM * DEFINE CLASS desaparecer AS form Top = 0 Left = 0 Height = 198 Width = 193 DoCreate = .T. Caption = "Form1" Name = "Form1" FirstTime = .T. ADD OBJECT timer1 AS timer WITH ; Top = 12, ; Left = 144, ; Height = 23, ; Width = 23, ; Interval = 100, ; Name = "Timer1" ADD OBJECT txtpos AS textbox WITH ; Height = 25, ; Left = 24, ; Top = 36, ; Width = 145, ; Name = "txtPos" ADD OBJECT label1 AS label WITH ; AutoSize = .T., ; Caption = "Mouse Position", ; Height = 17, ; Left = 24, ; Top = 12, ; Width = 87, ; Name = "Label1" ADD OBJECT txtFormPos AS textbox WITH ; Height = 25, ; Left = 24, ; Top = 96, ; Width = 145, ; Name = "txtFormPos" Value = [0,0] ADD OBJECT label2 AS label WITH ; AutoSize = .T., ; Caption = "Form Position", ; Height = 17, ; Left = 24, ; Top = 76, ; Width = 117, ; Name = "Label2" ADD OBJECT command1 AS commandbutton WITH ; Top = 156, ; Left = 60, ; Height = 27, ; Width = 84, ; Caption = "Exit", ; Name = "Command1" PROCEDURE timer1.Timer *:retrieving the absolute positionof the window DECLARE SHORT GetWindowRect IN user32; INTEGER hwnd,; STRING @ lpRect lpRect = Repli(Chr(0), 16) =GetWindowRect(Thisform.HWnd, @ lpRect) cMember = SUBSTR(lpRect, 1,4) cLeft= Asc(SUBSTR(cMember, 1,1)) + ; Asc(SUBSTR(cMember, 2,1)) * 256 +; Asc(SUBSTR(cMember, 3,1)) * 65536 +; Asc(SUBSTR(cMember, 4,1)) * 16777216 cMember = SUBSTR(lpRect, 5,4) cTop =Asc(SUBSTR(cMember, 1,1)) + ; Asc(SUBSTR(cMember, 2,1)) * 256 +; Asc(SUBSTR(cMember, 3,1)) * 65536 +; Asc(SUBSTR(cMember, 4,1)) * 16777216 cMember = SUBSTR(lpRect, 9,4) cRight=Asc(SUBSTR(cMember, 1,1)) + ; Asc(SUBSTR(cMember, 2,1)) * 256 +; Asc(SUBSTR(cMember, 3,1)) * 65536 +; Asc(SUBSTR(cMember, 4,1)) * 16777216 cMember = SUBSTR(lpRect, 13,4) cBottom=Asc(SUBSTR(cMember, 1,1)) + ; Asc(SUBSTR(cMember, 2,1)) * 256 +; Asc(SUBSTR(cMember, 3,1)) * 65536 +; Asc(SUBSTR(cMember, 4,1)) * 16777216 *:locationg the mouse over the form for the first time to make it visible IF Thisform.FirstTime Then DECLARE SetCursorPos IN user32 ; INTEGER x,; INTEGER y =SetCursorPos(cLeft + 50 ,cTop + 50) Thisform.FirstTime = .F. ENDIF *:Function to get the mouse absolute position DECLARE SHORT GetCursorPos IN user32 STRING @ lpPoint cMember = "" cPoint = Repli(Chr(0), 8) =GetCursorPos(@cPoint) cMember = SUBSTR(cPoint, 1,4) cX = Asc(SUBSTR(cMember, 1,1)) + ; Asc(SUBSTR(cMember, 2,1)) * 256 +; Asc(SUBSTR(cMember, 3,1)) * 65536 +; Asc(SUBSTR(cMember, 4,1)) * 16777216 cMember = SUBSTR(cPoint, 5,4) cY = Asc(SUBSTR(cMember, 1,1)) + ; Asc(SUBSTR(cMember, 2,1)) * 256 +; Asc(SUBSTR(cMember, 3,1)) * 65536 +; Asc(SUBSTR(cMember, 4,1)) * 16777216 xX = cX cX = alltrim(str(cX)) xY = cY cY = alltrim(str(cY)) THISFORM.txtPos.Value = cX + ", " + cY * Thisform.Visible = (BETWEEN(xX,cLeft, cRight) AND BETWEEN(xY,cTop, cBottom)) * IF thisform.Visible then * thisform.txtPos.setfocus * ENDIF ENDPROC PROCEDURE command1.Click thisform.Release CLEAR EVENTS ENDPROC PROCEDURE queryunload thisform.command1.click ENDPROC PROCEDURE mousemove LPARAMETERS nButton, nShift, nXCoord, nYCoord Thisform.txtFormPos.Value = ALLTRIM(STR(nXCoord)) + [, ] + ALLTRIM(STR(nYCoord)) ENDPROC ENDDEFINE * *-- EndDefine: desaparecer **************************************************please help me out
DO WHILE .T. ME.Work() ENDDO