InvokeHelper
-
Hi All I am getting error error when i am useing InvokeHelper.Function
Declreation in Test Header file
VARIANT Get_List(int* SheetName);
And Define in Cpp file of Test
VARIANT Test::Get_List(int* SheetName)
{
VARIANT result;
static BYTE parms[] =
VTS_PI1;
InvokeHelper(0x60030002, DISPATCH_METHOD, VT_VARIANT, (void*)&result, parms,
SheetName);
return result;
}
use Get_List function in main Class FinalDlg like this
Test objXl;
int sCol=3;
objXl.Get_List(&sCol);Then i am getting
"Type misMatch"
in class wincore.cpp. Plz help me
-
Hi All I am getting error error when i am useing InvokeHelper.Function
Declreation in Test Header file
VARIANT Get_List(int* SheetName);
And Define in Cpp file of Test
VARIANT Test::Get_List(int* SheetName)
{
VARIANT result;
static BYTE parms[] =
VTS_PI1;
InvokeHelper(0x60030002, DISPATCH_METHOD, VT_VARIANT, (void*)&result, parms,
SheetName);
return result;
}
use Get_List function in main Class FinalDlg like this
Test objXl;
int sCol=3;
objXl.Get_List(&sCol);Then i am getting
"Type misMatch"
in class wincore.cpp. Plz help me
-
Thanks for reply. But result variable is initialize here
VARIANT result;
Sorry can you describe more.
-
No, this is uninitialized variable. But it doesn't help as I see the code of MFC. So, I think that VTS_PI1 is unapplicable here. Use VTS_PUI1 or VTS_PI4.
With best wishes, Vita
-
Ok i use
VTS_PUI1 or VTS_PI4.
both now error is same. If you need example code then i will give you.I need help.
-
What declaration of method 0x60030002 do you have? What is a "Test objXl"?
With best wishes, Vita
See i don't much about InvokeHelper.I had download a project from Codeproject and make new project with the help of downloaded project.I am sending you a project link which have example code and Dll. Link is here Automating Microsoft Excel and Word Together[^] I am creating a new dll and write a new function.
Public Function Get_List(SheetNumber As Long) As String
' Dim myExcel As Object
Dim Counter1 As Integer
Dim Returnstring As String
Dim myWorkBook As Excel.Workbook
Dim tworksheet As Excel.Worksheet' myExcel = CreateObject("Excel.Application")
' myWorkBook = myExcel.Workbook.Open("C:\sample.xls")For Each tworksheet In myWorkBook.Worksheets ' Me.ListBox1.Items.Add (tworksheet.Name) Returnstring = tworksheet.Name If iindex = Counter1 Then Get\_List = Returnstring End If Counter1 = Counter1 + 1 Next
End Function
And try to access in vc++.Then i am getting errorPlz help me
-
See i don't much about InvokeHelper.I had download a project from Codeproject and make new project with the help of downloaded project.I am sending you a project link which have example code and Dll. Link is here Automating Microsoft Excel and Word Together[^] I am creating a new dll and write a new function.
Public Function Get_List(SheetNumber As Long) As String
' Dim myExcel As Object
Dim Counter1 As Integer
Dim Returnstring As String
Dim myWorkBook As Excel.Workbook
Dim tworksheet As Excel.Worksheet' myExcel = CreateObject("Excel.Application")
' myWorkBook = myExcel.Workbook.Open("C:\sample.xls")For Each tworksheet In myWorkBook.Worksheets ' Me.ListBox1.Items.Add (tworksheet.Name) Returnstring = tworksheet.Name If iindex = Counter1 Then Get\_List = Returnstring End If Counter1 = Counter1 + 1 Next
End Function
And try to access in vc++.Then i am getting errorPlz help me
-
Sorry, it requires so much time which I don't have. Try to call the simpler function, for example,
Public Function Get_List(SheetNumber As Long) As String
Get_List = "aaa"
End FunctionWith best wishes, Vita
i am doing something wrong.See I add function in Dll
Public Function Get_List(SheetNumber As Long) As String
Get_List = "aaa"
End FunctionAnd Declaration in m2msofficecom.h file
VARIANT Get_List(long* number);
And Define in m2msofficecom.cpp
VARIANT _clsExcel::Get_List(long* number)
{
VARIANT result;
static BYTE parms[] =
VTS_PI4;
InvokeHelper(0x60030002, DISPATCH_METHOD, VT_VARIANT, (void*)&result, parms,
number);
return result;
}And Call in MainDlg Class
_clsExcel objXl;
long ty=1;
objXl.Get_List(&ty);but still i am getting same error. plz help me.
-
i am doing something wrong.See I add function in Dll
Public Function Get_List(SheetNumber As Long) As String
Get_List = "aaa"
End FunctionAnd Declaration in m2msofficecom.h file
VARIANT Get_List(long* number);
And Define in m2msofficecom.cpp
VARIANT _clsExcel::Get_List(long* number)
{
VARIANT result;
static BYTE parms[] =
VTS_PI4;
InvokeHelper(0x60030002, DISPATCH_METHOD, VT_VARIANT, (void*)&result, parms,
number);
return result;
}And Call in MainDlg Class
_clsExcel objXl;
long ty=1;
objXl.Get_List(&ty);but still i am getting same error. plz help me.
-
I can only propose that 0x60030002 is not Get_List function. You can look at DLL by "Ole/COM Viewer" and find the declaration of _clsExcel interface. Can you post the direct reference to your DLL?
With best wishes, Vita
-
please explain in detail.i am also think about 0x60030002 is not Get_List function.But how can i find it.
VB creates the DLL, which has a TLB inside. Run the "OLE/COM Viewer" and File -> View TypeLib.... Perhaps there is a MFC Wizard which also can import this TLB into code. But I don't know about it, because I use #import directive in C++ client code.
With best wishes, Vita
-
VB creates the DLL, which has a TLB inside. Run the "OLE/COM Viewer" and File -> View TypeLib.... Perhaps there is a MFC Wizard which also can import this TLB into code. But I don't know about it, because I use #import directive in C++ client code.
With best wishes, Vita
-
VB creates the DLL, which has a TLB inside. Run the "OLE/COM Viewer" and File -> View TypeLib.... Perhaps there is a MFC Wizard which also can import this TLB into code. But I don't know about it, because I use #import directive in C++ client code.
With best wishes, Vita
-
See i don't much about InvokeHelper.I had download a project from Codeproject and make new project with the help of downloaded project.I am sending you a project link which have example code and Dll. Link is here Automating Microsoft Excel and Word Together[^] I am creating a new dll and write a new function.
Public Function Get_List(SheetNumber As Long) As String
' Dim myExcel As Object
Dim Counter1 As Integer
Dim Returnstring As String
Dim myWorkBook As Excel.Workbook
Dim tworksheet As Excel.Worksheet' myExcel = CreateObject("Excel.Application")
' myWorkBook = myExcel.Workbook.Open("C:\sample.xls")For Each tworksheet In myWorkBook.Worksheets ' Me.ListBox1.Items.Add (tworksheet.Name) Returnstring = tworksheet.Name If iindex = Counter1 Then Get\_List = Returnstring End If Counter1 = Counter1 + 1 Next
End Function
And try to access in vc++.Then i am getting errorPlz help me