If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > vc++ call ocx problem?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-29-03, 15:53
mmm mmm is offline
Registered User
 
Join Date: Sep 2003
Posts: 8
vc++ call ocx problem?

I wrote a vc++ code to call a method from an ActiveX Cotrol (an OCX file), no compile error, but when I run it , error message is

"Program: ...
Module:
File: i386\chkesp.c
Line: 42

The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

"

The problem occurs when I call Sum method which is come from the ActiveX control.

Can you help me, thanks.

----vcDraw.cpp-----
#include <iostream>
#include <comdef.h>
#include "vcDrawOCX.h"
using namespace std;

void main()
{
HRESULT hr;
_OCXControl *ItestDraw = NULL;

hr = CoInitialize(0);

if (SUCCEEDED(hr))
{
hr = CoCreateInstance(CLSID_OCXControl,
NULL,
CLSCTX_INPROC_SERVER,
IID__OCXControl,
(void**) &ItestDraw);

if (SUCCEEDED(hr))
{
hr = ItestDraw->Sum();
hr = ItestDraw->Release();
}
else
{
cout<<"CoCreateInstance Failed."<<endl;
}
}
CoUninitialize();
}


----ActiveX control written in VB------

Option Explicit

Private Sub UserControl_Initialize()
MsgBox "OCXControl initialized OK mmm"
End Sub

Public Sub Sum()
MsgBox "I am from sum"
End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On