没有拖放入口

我已经为PB编写的一些新的部件,这些部件具有标准的PowerBuilder部件的拖放特性。我想让这些新的部件具有标准的PB控件的拖放特性:当拖动它时,根据是否允许拖入而显示不同的图标(光标),但我不知道如何完成这种工作,SetPointer函数是不能完成的。因此我只好查找API参考手册,并找到如下的解决办法:

1.在窗口中说明以下API函数调用:

function long LoadCursorA( long al_happ, long al_hind ) library 'user32'
function long SetCursor( long al_hcur ) library 'user32'
function boolean DestroyCursor( long al_hcur ) library 'user32'

2.定义一个长整型的实例变量il_Image,然后中OPEN事件中加入以下代码

//32648 is the constant for the no entry cursor
Long IDC_NO = 32648 
il_Image = LoadCursorA( 0, IDC_NO )

3.在自定义的对象中的dragwithin事件中增加以下代码:当一个对象不允许拖动到该对象时,将显示没有入口的光标

IF source = dw_top THEN	
	// if the user drags from the tree, display the system
	// no entry symbol.
	SetCursor( il_Image )
END IF

4.最后一步是清除分配给光标的空间

DestroyCursor( il_Image )