Click here to Skip to main content
15,894,343 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: red squiggly line - misspelt words Pin
Hans Dietrich13-May-11 20:09
mentorHans Dietrich13-May-11 20:09 
AnswerRe: red squiggly line - misspelt words Pin
Chris Losinger14-May-11 5:32
professionalChris Losinger14-May-11 5:32 
Questiondetect memory leak by _CrtDumpMemoryLeaks(); Pin
includeh1013-May-11 2:57
includeh1013-May-11 2:57 
AnswerRe: detect memory leak by _CrtDumpMemoryLeaks(); Pin
Albert Holguin13-May-11 4:47
professionalAlbert Holguin13-May-11 4:47 
AnswerRe: detect memory leak by _CrtDumpMemoryLeaks(); Pin
Mark Salsbery13-May-11 5:09
Mark Salsbery13-May-11 5:09 
AnswerRe: detect memory leak by _CrtDumpMemoryLeaks(); Pin
Chris Losinger14-May-11 5:34
professionalChris Losinger14-May-11 5:34 
QuestionLine break in CRichEdit Control Pin
si_6913-May-11 0:34
si_6913-May-11 0:34 
AnswerRe: Line break in CRichEdit Control Pin
si_6913-May-11 0:43
si_6913-May-11 0:43 
Questionwindows media encoder screen capture Pin
Member 296547113-May-11 0:21
Member 296547113-May-11 0:21 
Questionhow to built popup and attach to listcontrol Pin
rjkg12-May-11 23:44
rjkg12-May-11 23:44 
AnswerRe: how to built popup and attach to listcontrol Pin
Richard MacCutchan13-May-11 0:13
mveRichard MacCutchan13-May-11 0:13 
Questionhow to merge cells using msFlexgrid.. Pin
spalanivel12-May-11 19:25
spalanivel12-May-11 19:25 
AnswerRe: how to merge cells using msFlexgrid.. Pin
«_Superman_»12-May-11 20:18
professional«_Superman_»12-May-11 20:18 
GeneralRe: how to merge cells using msFlexgrid.. Pin
spalanivel12-May-11 20:41
spalanivel12-May-11 20:41 
Questionhow to simulate the mspaint... Pin
dousao12-May-11 17:08
dousao12-May-11 17:08 
AnswerRe: how to simulate the mspaint... Pin
KingsGambit12-May-11 18:38
KingsGambit12-May-11 18:38 
AnswerRe: how to simulate the mspaint... Pin
«_Superman_»12-May-11 20:20
professional«_Superman_»12-May-11 20:20 
AnswerRe: how to simulate the mspaint... Pin
Amarnath S12-May-11 22:34
professionalAmarnath S12-May-11 22:34 
QuestionCPropertySheet/CPropertyPage Pin
Bram van Kampen12-May-11 15:29
Bram van Kampen12-May-11 15:29 
QuestionRe: CPropertySheet/CPropertyPage Pin
JohnCz14-May-11 11:37
JohnCz14-May-11 11:37 
QuestionProblem with ActiveX: 0x80020005 (DISP_E_TYPEMISMATCH) Pin
XIpsYloNZ12-May-11 3:43
XIpsYloNZ12-May-11 3:43 
Hi @ All,

I´ve created an ActiveX with vs2008 in c++ with simple methods. Now I`m gonna try to usw this activeX in a C# form-application, but i can´t use the methods. I got an exception called: Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH));
I hope someone could help me, I also understand germany Smile | :)
Thanks!

The ActiveX:

...ctrl.cpp
BEGIN_DISPATCH_MAP(CIND890MTActiveScaleLibCtrl, COleControl)
     DISP_FUNCTION_ID(CIND890MTActiveScaleLibCtrl, "Multiplikator", DISPID_MULTI, Multiplikator, VT_R8, VTS_PR8 VTS_PR8)
END_DISPATCH_MAP()
.......
double CIND890MTActiveScaleLibCtrl::Multiplikator(double zahlE, double zahlZ)
{
	return zahlE + zahlZ;
}


..ctrl.h
class CIND890MTActiveScaleLibCtrl : public COleControl
{

	static const int DISPID_MULTI = 1025555;
............
public:
	double Multiplikator(double zahlE, double zahlZ);
}


..idl
library IND890MTActiveScaleLibLib
{
static const int DISPID_MULTI = 1025555;

[ uuid(862E674E-512D-4DCC-AE6F-AEED5F078E59),
	  helpstring("Dispatchschnittstelle für IND890MTActiveScaleLib Control")] 	dispinterface _DIND890MTActiveScaleLib
	{
		properties:
		methods:
                   [id(DISPID_MULTI)] double Multiplikator(double zahlE, double zahlZ);
        }
.......
	[ uuid(8BEE0D1C-C726-4BD8-BEE0-4BD5E0027C9B),
	  helpstring("IND890MTActiveScaleLib Control"), control ]
	coclass IND890MTActiveScaleLib
	{
		[default] dispinterface _DIND890MTActiveScaleLib;
		[default, source] dispinterface _DIND890MTActiveScaleLibEvents;
	};
}


The Form-Application:

Form1.cs:
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        AxIND890MTActiveScaleLibLib.AxIND890MTActiveScaleLib test;

        public Form1()
        {
            InitializeComponent();
        }

        private void Speichern_Click(object sender, EventArgs e)
        {
            double erg = 0, zahl1 = 1234, zahl2 = 4321;
            test.IsAccessible = true;
            erg = test.Multiplikator(zahl1, zahl2);  //!!!Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH));!!!
        }
    }
}


Form1.Designer.cs
namespace WindowsFormsApplication1
{
    partial class Form1
    {
...............
        private void InitializeComponent()
        {
.......
            this.test = new AxIND890MTActiveScaleLibLib.AxIND890MTActiveScaleLib();
            ((System.ComponentModel.ISupportInitialize)(this.test)).BeginInit();
..........            
            // 
            // test
            // 
            this.test.Enabled = true;
            this.test.CreateControl();
            this.test.Name = "test";
            this.test.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("test.OcxState")));
            this.test.TabIndex = 0;
...........
        }
    }
}

QuestionMS Flex Grid using VC++ Merge Cells not working... Pin
spalanivel12-May-11 3:10
spalanivel12-May-11 3:10 
Questionhow to get the file icon if this file doesnot have type name[solved] Pin
yu-jian12-May-11 3:01
yu-jian12-May-11 3:01 
AnswerRe: how to get the file icon if this file doesnot have type name Pin
Richard MacCutchan12-May-11 3:35
mveRichard MacCutchan12-May-11 3:35 
QuestionOwner draw button's font problem. [modified] Pin
Malli_S12-May-11 2:33
Malli_S12-May-11 2:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.