E
Eric
Hi all,
I have a C++ application that load C# applets. A method use an IntPtr
parameter because I want to be 32/64-bit compatible. The problem is in
the .tlh file generated. This parameter is a long and not an INT_PTR
and I don't know why ?
Here is some code that may help you.
In C# project.
public interface IDlgCriteresRecherche
{
IntPtr HandleEditeurParent { get; set;}
}
public class AScDlgCriteresRecherche : System.Windows.Forms.Form,
IDlgCriteresRecherche
{
#region IDlgCriteresRecherche Members
private IntPtr nHandleEditeurParent = (IntPtr)0;
public IntPtr HandleEditeurParent
{
get{ return nHandleEditeurParent; }
set{ nHandleEditeurParent = value; }
}
#endregion
}
In the .tlh generated
struct __declspec(uuid("a070cc19-98cf-4433-8351-e1fc2228260f"))
/* dual interface */ IDlgCriteresRecherche;
struct /* coclass */ AScDlgCriteresRecherche;
_COM_SMARTPTR_TYPEDEF(IDlgCriteresRecherche,
__uuidof(IDlgCriteresRecherche));
struct __declspec(uuid("a070cc19-98cf-4433-8351-e1fc2228260f"))
IDlgCriteresRecherche : IDispatch
{
virtual HRESULT __stdcall get_HandleEditeurParent (
/*[out,retval]*/ long * pRetVal ) = 0;
virtual HRESULT __stdcall put_HandleEditeurParent (
/*[in]*/ long pRetVal ) = 0;
}
in C++
#import "ASCommun.tlb" raw_interfaces_only
pIDlgCriteresRecherche->put_HandleEditeurParent((INT_PTR)poActiveView->m_hWnd);
Regards,
Eric
I have a C++ application that load C# applets. A method use an IntPtr
parameter because I want to be 32/64-bit compatible. The problem is in
the .tlh file generated. This parameter is a long and not an INT_PTR
and I don't know why ?
Here is some code that may help you.
In C# project.
public interface IDlgCriteresRecherche
{
IntPtr HandleEditeurParent { get; set;}
}
public class AScDlgCriteresRecherche : System.Windows.Forms.Form,
IDlgCriteresRecherche
{
#region IDlgCriteresRecherche Members
private IntPtr nHandleEditeurParent = (IntPtr)0;
public IntPtr HandleEditeurParent
{
get{ return nHandleEditeurParent; }
set{ nHandleEditeurParent = value; }
}
#endregion
}
In the .tlh generated
struct __declspec(uuid("a070cc19-98cf-4433-8351-e1fc2228260f"))
/* dual interface */ IDlgCriteresRecherche;
struct /* coclass */ AScDlgCriteresRecherche;
_COM_SMARTPTR_TYPEDEF(IDlgCriteresRecherche,
__uuidof(IDlgCriteresRecherche));
struct __declspec(uuid("a070cc19-98cf-4433-8351-e1fc2228260f"))
IDlgCriteresRecherche : IDispatch
{
virtual HRESULT __stdcall get_HandleEditeurParent (
/*[out,retval]*/ long * pRetVal ) = 0;
virtual HRESULT __stdcall put_HandleEditeurParent (
/*[in]*/ long pRetVal ) = 0;
}
in C++
#import "ASCommun.tlb" raw_interfaces_only
pIDlgCriteresRecherche->put_HandleEditeurParent((INT_PTR)poActiveView->m_hWnd);
Regards,
Eric