| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 559 人关注过本帖
标题:C++调用VB.NET编的dll中的类,出现编译错误,望各位大侠指点!
只看楼主 加入收藏
komawang
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-9-9
结帖率:0
收藏
 问题点数:0 回复次数:0 
C++调用VB.NET编的dll中的类,出现编译错误,望各位大侠指点!
下面是给出的VB编写的标准程序,我需要转为C++
Private Sub FormMain_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated

    End Sub

    Private Sub FormMain_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed

        ' Clean Up
        On Error Resume Next
        m_objPQView23.Disconnect()
        m_objPQView23 = Nothing

    End Sub

    Private Sub FormMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ' Create a new PQView23 class
        m_objPQView23 = New PQView.PQView23
        With m_objPQView23
            .Database = "F:\王鑫\pqview\电科院PQView讲座资料\二次开发培训资料\Databases\PQViewDemo2008.mdb"
            .Provider = "Jet"
            .Connect()
            If Not .Connected Then
                MsgBox(.ErrDesc, MsgBoxStyle.Critical, "Connection Error")
            End If
        End With

        ' Initialize the data range
        Me.DateTimePickerStart.Value = #2/10/2003#
        Me.DateTimePickerFinish.Value = #2/11/2003#

        ' Initialize the list of demonstration options
        With
            .Items.Add(demoGetConnectionAliasList)
            .Items.Add(demoGetInfo)
            .Items.Add(demoGetSites)
            .Items.Add(demoGetSitePropertyValuesPivot)
            .Items.Add(demoGetSteadyStateSamples)
            .Items.Add(demoGetSteadyStateSamplesPivot)
            .Items.Add(demoGetSteadyStateSamplesStat)
        End With

    End Sub
以上是编的程序,从动态库PQView.dll中调用类PQView23,动态库PQView.dll是用vb编写的。本人也是初学者,不是计算机出身,试着写了下面的程序,可惜编译不过。希望各位指点下!!
int main()
{
//typedef HRESULT (__stdcall * pPQView)(REFCLSID,REFIID,void**);
//pPQView PQView= NULL;
//HINSTANCE hdllInst = LoadLibrary("C:\Windows\System32\PQView.dll");
//PQView=(pPQView)GetProcAddress(hdllInst,"DllGetClassObject");
//if (PQView != 0)
//{
// IClassFactory* pcf = NULL;
// HRESULT hr=(PQView)(_PQView23,IID_IClassFactory,(void**)&pcf);
// if (SUCCEEDED(hr) && (pcf != NULL))
// {
// _PQView23* pPQView23 = NULL;
// hr = pcf->CreateInstance(NULL, __uuidof(PQView23), (void**)&_PQView23);
// if (SUCCEEDED(hr) )
// {
// //pPQView23->Database = "pqview-sample.mdb";
// //pPQView23->Provider = "Jet";
// pPQView23->Connect();
// if(pPQView23->Connected)
// {
// printf("数据库连接成功");
// }
// else
// {
// printf("数据库连接失败");
// }
// }
// pcf->Release();
// }
//}
//FreeLibrary(hdllInst);
vb的程序是标准程序,我要转为c++ 不知道怎么回事 编译不过,dll是用vb编写的,多谢各位指教了!!!!!! 程序目的就是调用动态库PQView.dll中的类PQView23

搜索更多相关主题的帖子: Object 
2012-11-04 19:37
快速回复:C++调用VB.NET编的dll中的类,出现编译错误,望各位大侠指点!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.054529 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved