T
Terry Olsen
I'm using the SciLexer.dll to write a code editor for an in-house scripting
language. I have the editor window up on a form but I need to use it's API.
I've used the following commands to load the dll:
Private scihWnd As Integer 'Scintilla's hWnd
Private SciFunc As Integer 'Scintilla's Main Function Call
Private sciptr As Integer 'Scintilla's Direct Pointer
Private scihmod As Integer 'Scintilla's hMod
scihmod = LoadLibrary("SciLexer.DLL")
If scihmod = 0 Then
Throw New Exception("Unable to load SciLexer.dll")
Exit Sub
End If
scihWnd = CreateWindowEx(...)
SciFunc = GetProcAddress(scihWnd, "Scintilla_DirectFunction")
sciptr = SendMessage(scihWnd, SCI_GETDIRECTPOINTER, 0, 0)
Now I need to call the the SciFunc that was returned from the GetProcAddress
call.
Is this the correct way to do it? I haven't had time to try it yet because
I'm on my way out the door, so I thought i'd ask the question ahead of time.
Here's my tentative code...
Private Function Scintilla(ByVal args() As Object) As Object
Dim t As Type = Nothing
Dim ret As Object = Nothing
ret = Marshal.GetDelegateForFunctionPointer(SciFunc,
t).DynamicInvoke(args)
Return ret
End Function
My next question, isn't there a way to pass an array on the fly without
declaring and filling an array first? Something like:
Scintilla({sciptr,"SCI_SETTEXT",0,"This is my text"})
Thanks!
language. I have the editor window up on a form but I need to use it's API.
I've used the following commands to load the dll:
Private scihWnd As Integer 'Scintilla's hWnd
Private SciFunc As Integer 'Scintilla's Main Function Call
Private sciptr As Integer 'Scintilla's Direct Pointer
Private scihmod As Integer 'Scintilla's hMod
scihmod = LoadLibrary("SciLexer.DLL")
If scihmod = 0 Then
Throw New Exception("Unable to load SciLexer.dll")
Exit Sub
End If
scihWnd = CreateWindowEx(...)
SciFunc = GetProcAddress(scihWnd, "Scintilla_DirectFunction")
sciptr = SendMessage(scihWnd, SCI_GETDIRECTPOINTER, 0, 0)
Now I need to call the the SciFunc that was returned from the GetProcAddress
call.
Is this the correct way to do it? I haven't had time to try it yet because
I'm on my way out the door, so I thought i'd ask the question ahead of time.
Here's my tentative code...
Private Function Scintilla(ByVal args() As Object) As Object
Dim t As Type = Nothing
Dim ret As Object = Nothing
ret = Marshal.GetDelegateForFunctionPointer(SciFunc,
t).DynamicInvoke(args)
Return ret
End Function
My next question, isn't there a way to pass an array on the fly without
declaring and filling an array first? Something like:
Scintilla({sciptr,"SCI_SETTEXT",0,"This is my text"})
Thanks!