帮助,请将prg编为可视表单,谢谢!
请将下列代码改为可视表单,VFP播放Flash的,谢谢!因我的电脑无法上传两个文件:vfp2c.h、vfp2c32.fll。
请给一个操作说明、或表单示例,特别是红色部分,非常感谢!
附代码:
PUBLIC goFlashForm
goFlashForm = CREATEOBJECT("FlashForm")
goFlashForm.Show()
DEFINE CLASS FlashForm AS Form
Width = 412
Height = 306
FlashCount = 0
DIMENSION FlashHandler[1]
Callback = NULL
ADD OBJECT oleFlash0 AS OleControl WITH OleClass = "ShockwaveFlash.ShockwaveFlash.9",;
Width = 335,;
Height =275,;
Left = 11,;
Top = 11
PROCEDURE Init
#DEFINE GW_CHILD 5
#DEFINE GWL_WNDPROC -4
PRIVATE loFlash, lcPath, lnHwnd, lnHandler, i
LOCAL loFlash, lcPath, lnHWnd, lnHandler, i
THIS.DeclareDlls()
lcPath = ADDBS(ALLTRIM(JUSTPATH(SUBSTR(SYS(16),AT("INIT", SYS(16)) + 5))))
FOR EACH loFlash AS OleControl IN THIS.Controls
loFlash.Movie = lcPath + "外婆的澎湖湾.swf"
loFlash.Play
ENDFOR
lnHandler = 0
THIS.FlashCount = 0
IF THIS.ShowWindow = 2
lnHWnd = GetWindow(THIS.HWnd, GW_CHILD)
ELSE
lnHWnd = THIS.HWnd
ENDIF
DO WHILE .T.
lnHandler = FindWindowEx(lnHWnd, lnHandler,"MacromediaFlashPlayerActiveX", NULL)
IF lnHandler = 0
EXIT
ENDIF
THIS.FlashCount = THIS.FlashCount + 1
DIMENSION THIS.FlashHandler[THIS.FlashCount]
THIS.FlashHandler[THIS.FlashCount] = lnHandler
ENDDO
IF THIS.FlashCount > 0
THIS.Callback = CREATEOBJECT("CallbackFunction")
DIMENSION THIS.Callback.PrevWndFunc[THIS.FlashCount, 2]
FOR i = 1 TO THIS.FlashCount
THIS.Callback.PrevWndFunc[i,1] = THIS.FlashHandler[i]
THIS.Callback.PrevWndFunc[i,2] = SetWindowLong(THIS.FlashHandler[i],GWL_WNDPROC,THIS.Callback.Address)
ENDFOR
ENDIF
ENDPROC
PROCEDURE DeclareDlls
DECLARE Integer GetWindow IN USER32 Integer,Integer
DECLARE Integer FindWindowEx IN USER32 Integer,Integer,String,String
DECLARE Integer SetWindowLong IN USER32 Integer,Integer,Integer
ENDPROC
PROCEDURE Unload
THIS.Callback = NULL
ENDPROC
ENDDEFINE
DEFINE CLASS CallbackFunction AS Custom
#INCLUDE "vfp2c.h"
Address = 0
DIMENSION PrevWndFunc[1,2]
PROCEDURE Init
LPARAMETERS tcPath
THIS.DeclareDlls()
SET LIBRARY TO IIF(EMPTY(tcPath) = .T., "vfp2c32.fll",ADDBS(tcPath) + "vfp2c32.fll") ADDITIVE
INITVFP2C32(VFP2C_INIT_CALLBACK)
THIS.Address = CreateCallbackFunc("CallbackFunction","LONG", "LONG,;
LONG, LONG, LONG", THIS)
ENDPROC
PROCEDURE DeclareDlls
DECLARE Integer CallWindowProc IN USER32 Integer,Integer,Integer,Integer,Integer
ENDPROC
PROCEDURE CallbackFunction
LPARAMETERS hwnd, Msg, wParam, lParam
PRIVATE lnIndex
LOCAL lnIndex
lnIndex = CEILING(ASCAN(THIS.PrevWndFunc, hwnd,1,ALEN(THIS.PrevWndFunc,1),1)/2)
IF Msg = WM_RBUTTONDOWN
RETURN 0
ENDIF
RETURN CallWindowProc(THIS.PrevWndFunc[lnIndex,2],hwnd, Msg, wParam, lParam)
ENDPROC
PROCEDURE Destroy
IF THIS.AddRess <> 0
DestroyCallbackFunc(THIS.Address)
ENDIF
ENDPROC
ENDDEFINE