跪求SetParent的解
Private Declare Function SetParent Lib "user32 " (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Function jjj(input1 As String) As Long
Dim sfile As String
sfile = "d:\myfile.doc "
xl = CreateObject(Word.Application)
xl.Documents.Open (sfile)
xl.Visible = True
l = SetParent(xl.hWnd, input1)
jjj = xl.hWnd
End Function
上面是我做一个类,用vb6.0 生成dll文件后,在vb.net中调用,传入一个form或者其他容器的handle,就可以将word文档放到自己的程序中.现在的问题是,我返回给vb.net的值是他的hwnd,在vb.net中如何利用这个值对word程序进行操作?我试着返回object(就是直接返回xl),结果是出错。有谁知道怎么办吗?或者有更好的办法将word作成自己程序的一部分?请指教。
[解决办法]
api:
FindWindow
SetParent