Creating Custom Component using a Native dll (c++)

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi,

I am having extreme difficulty with creating components. I have
created a dll in Embedded c++ 4.0. I have created a wrapper for it
and am able to expose all the COM objects in managed code.

Although this is the problem I am having:

Trying to create a custom control to which I can drag and drop into my
form. I tried to create a run time and design time dll but was
unsuccessful. I have 3 books and nothing describes how to create
custom controls for native code.

Can someone help me?????

Thanks in advance.
 
Let me make sure I understand. You're trying to do a COM control with a UI
and have designer support in the CF? If this is the case it's a totally
unsupported situation. COM interop is not in the CF, nor is designer
support for controls. I can't even think of how you could marshal drawing
events and methods between a COM object and the designer requirements.
 
Ok this is the scenario. I have ActiveX controls that
were once used in VS 6.0. Now I want to use these same
ActiveX controls in .Net Compact Framework. I understand
that ActiveX controls are not supported in Compact
Framework. So I made a wrapper to be able to expose these
components to .Net. Which works fine if I import the dll
and call the methods which looks like this:

Imports System.Runtime.InteropServices
Imports System.Text

Public Class Form1
Inherits System.Windows.Forms.Form
Friend WithEvents unit As System.Windows.Forms.Button
Friend WithEvents Version_button As
System.Windows.Forms.Button


<DllImport("PrintCF.dll")> _
Public Shared Sub UnInitialize()
End Sub
<DllImport("PrintCF.dll")> _
Public Shared Function Initialize() As Integer
End Function
<DllImport("PrintCF.dll")> _
Public Shared Sub Version()
End Sub

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form
Designer.
InitializeComponent()

'Add any initialization after the
InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal
disposing As Boolean)
MyBase.Dispose(disposing)
End Sub

Private Sub Version_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Version_button.Click
Dim CRNL As String
Dim mcr_data As New StringBuilder(999)

CRNL = Chr(13) + Chr(10)

Version()


End Sub

Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Initialize()
End Sub

Private Sub unit_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles unit.Click
UnInitialize()
Me.Close()

End Sub

But instead of manually keying in these methods like
Version I would like to create a component that I could
drag and drop (like a timer component) that declares the
method and the appropriate arguements.

Thanks.
 
Back
Top