|
-
Sep 20th, 2000, 03:27 AM
#1
Thread Starter
Lively Member
Hi. I am working in a VBA environment under Word97. Since I need a CallByName function for that environment(which is close to vba5) i made my own CallByName routine using the function SendMessageCallback.
SendMessageCallback(hwnd, 256&, 16&, 2752513, AddrOf("MyFunction"), DataToGive)
(AddrOf is a function that returns the address of a function, using API in the VBA332.dll, since AdressOf doesn't exist in VBA(97))
I can pass through the DataToGive parameter to "MyFunction" as a long parameter. That works well. When I try to pass a String to the function. The MyFunction only gets a number representing an address to a memory location where the string is. Do anyone know how I can create a pointer to get this string?
-
Sep 20th, 2000, 03:59 AM
#2
Thread Starter
Lively Member
Might have found a solution.
Code:
Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" _
(lpvDest As Any, _
lpvSource As Any, _
ByVal cbCopy As Long)
Function MyFunction(ByVal hwnd As Long, ByVal umsg As Long, ByVal DataToGive As Long, ByVal lresult As Long) As Long
Dim b(1 To 10) As Byte
CopyMemory b(1), ByVal DataToGive, 10
For i = 1 To 10
Debug.Print Chr(b(i));
Next
End Function
The Debug.Print writes out the string. If anyone else has anything they want to add, please do.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|