on 04-04-2011 1:56 PM
Dear All,
I have a requirment in my implementation to use a custom DLL functions in my ABAP program? Could anyone tell me how i can use that DLL in my ABAP program?
Thanks
TYPE-POOLS ole2.
DATA: mydll type ole2_object,
str type string VALUE 'Empty'.
CREATE OBJECT mydll 'MYAPP.LAUNCH'.
IF mydll-handle > 0.
CALL METHOD OF mydll 'GetText' = str.
ENDIF.
WRITE str.
Email me if you'd like a copy of the .NET code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hai case, i've problem when register and use custome .NET dll, i've followed the instructions you gave but still no hope, sy-subrc = 2 when call method.
Can u give me copy of the .NET code? and where i can get CLSID when register the object in SAP in transaction SOLE? i already install the library on my local machine.
Thanks before.
Regards,
Kemal
You can generate your own ID using Tools --> Create GUID. It resides in the implementation object in the .NET project.
Here is what my interface object looks like (VB.NET):
Imports System
Imports System.Text
Imports System.Runtime.InteropServices
Namespace HESwipeAx
<ComVisible(True)> <InterfaceType(ComInterfaceType.InterfaceIsDual)> <Guid("BD8D4391-DBF4-4633-938B-F94281DC8D9D")> _
Public Interface ILaunch
Function GetText() As String
End Interface
End Namespace
And my implementation looks like this. I've highlighted the CLSID.
Imports System.Runtime.InteropServices
Namespace HESwipeAx
<ComVisible(True)> _
<ClassInterface(ClassInterfaceType.None)> _
<Guid("014320CD-0448-4161-9629-1E3DCA3C6452")> _
<ProgId("HESwipeAx.Launch")> _
<ComDefaultInterface(GetType(ILaunch))> _
Public Class Launch
Inherits UserControl
Implements ILaunch, IObjectSafety
Public Function GetText() As String Implements ILaunch.GetText
Dim prompt As New MainForm
If prompt.ShowDialog = DialogResult.OK Then
Return prompt.textReturnVal.Text
Else
Return String.Empty
End If
HERE IS THE MAIN METHOD -- return what you want in this function.
End Function
Public Function GetInterfaceSafetyOptions(ByRef riid As System.Guid, ByRef pdwSupportedOptions As Integer, ByRef pdwEnabledOptions As Integer) As Integer Implements IObjectSafety.GetInterfaceSafetyOptions
Dim m_options As ObjectSafetyOptions = ObjectSafetyOptions.INTERFACESAFE_FOR_UNTRUSTED_CALLER Or ObjectSafetyOptions.INTERFACESAFE_FOR_UNTRUSTED_DATA
pdwSupportedOptions = CInt(m_options)
pdwEnabledOptions = CInt(m_options)
Return 0
End Function
Public Function SetInterfaceSafetyOptions(ByRef riid As System.Guid, dwOptionSetMask As Integer, dwEnabledOptions As Integer) As Integer Implements IObjectSafety.SetInterfaceSafetyOptions
Return 0
End Function
Public Enum ObjectSafetyOptions
INTERFACESAFE_FOR_UNTRUSTED_CALLER = &H1
INTERFACESAFE_FOR_UNTRUSTED_DATA = &H2
INTERFACE_USES_DISPEX = &H4
INTERFACE_USES_SECURITY_MANAGER = &H8
End Enum
End Class
End Namespace
Hope that helps.
Hi, Case.
I've tried to implement your code but got the same issue in trace file "|HESwipeAx.Launch.HESwipeAx.Launch |CREATEOBJECT |Creation of control "" denied! |4.0.40305.0 |7300.2.4.1083 |mscoree.dll |"
Could you please share your SOLE settings and VB.NET project code? Or just mail it to me m.drozdoff (at) gmail.com
Thanx in advance,
Michael.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.