Click here to Skip to main content
15,867,308 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
AnswerRe: Owner draw button's font problem. Pin
Richard MacCutchan12-May-11 3:32
mveRichard MacCutchan12-May-11 3:32 
GeneralRe: Owner draw button's font problem. Pin
Malli_S13-May-11 3:22
Malli_S13-May-11 3:22 
GeneralRe: Owner draw button's font problem. Pin
Richard MacCutchan13-May-11 4:04
mveRichard MacCutchan13-May-11 4:04 
GeneralRe: Owner draw button's font problem. Pin
Richard MacCutchan13-May-11 4:46
mveRichard MacCutchan13-May-11 4:46 
Questionhow to move images in same list control Pin
rjkg12-May-11 0:52
rjkg12-May-11 0:52 
AnswerRe: how to move images in same list control Pin
Richard MacCutchan12-May-11 3:28
mveRichard MacCutchan12-May-11 3:28 
QuestionHow can I know which item was selected in TreeCtrl ? Pin
_Flaviu12-May-11 0:45
_Flaviu12-May-11 0:45 
AnswerRe: How can I know which item was selected in TreeCtrl ? Pin
Niklas L12-May-11 2:16
Niklas L12-May-11 2:16 
GeneralRe: How can I know which item was selected in TreeCtrl ? Pin
_Flaviu12-May-11 2:26
_Flaviu12-May-11 2:26 
QuestionRe: How can I know which item was selected in TreeCtrl ? Pin
David Crow12-May-11 3:06
David Crow12-May-11 3:06 
AnswerRe: How can I know which item was selected in TreeCtrl ? Pin
_Flaviu12-May-11 3:12
_Flaviu12-May-11 3:12 
GeneralRe: How can I know which item was selected in TreeCtrl ? Pin
Richard MacCutchan12-May-11 3:27
mveRichard MacCutchan12-May-11 3:27 
GeneralRe: How can I know which item was selected in TreeCtrl ? Pin
David Crow12-May-11 3:42
David Crow12-May-11 3:42 

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.