PDA

View Full Version : Qt function call in vb.net



abghosh
2nd March 2010, 17:27
Hi

I am building a program in VB.net and almost done with it. but I have some problem with getting http response.
Getting http response in qt is much much faster. If I want to use the http request function of qt4 in a vb.net then how to proceed?

I dont know whether this is possible or just an absurd idea.

Please give your response and the possible way of combining it..

Thanks in advance.

schnitzel
2nd March 2010, 18:17
just google 'c++ dll from vb.net' - that will give you plenty of ideas :)

abghosh
2nd March 2010, 18:55
just google 'c++ dll from vb.net' - that will give you plenty of ideas :)

schnitzel Thanks for your reply.

Say I have a Qt C++ code which will return a string variable say. Now I want to use this string variable in my vb.net code for further processing. Can you help me on that pls.

Thanks in advance.

schnitzel
2nd March 2010, 19:14
schnitzel Thanks for your reply.

Say I have a Qt C++ code which will return a string variable say. Now I want to use this string variable in my vb.net code for further processing. Can you help me on that pls.

Thanks in advance.

see if this helps: http://www.codeproject.com/KB/dotnet/c_dll_in_vb.aspx

abghosh
3rd March 2010, 17:49
see if this helps: http://www.codeproject.com/KB/dotnet/c_dll_in_vb.aspx

Hi schnitzel

A lot thanks for your help.
Now I would like to ask you one more question. May be silly...

How can I make DLL file from a qt project?

schnitzel
3rd March 2010, 19:07
Hi schnitzel

A lot thanks for your help.
Now I would like to ask you one more question. May be silly...

How can I make DLL file from a qt project?

It isn't a silly question but it doesn't belong here.
Btw: you should learn how to read Qt Documentation.

You should make a big bookmark to this: http://doc.qt.nokia.com/4.6/

specific to your question:
http://doc.qt.nokia.com/4.6/sharedlibrary.html

abghosh
6th March 2010, 03:15
Hi

I have taken the following code from a webpage and tried to test the call.

Global header file:

#ifndef QTENGINEDLL_GLOBAL_H
#define QTENGINEDLL_GLOBAL_H

#include <QtCore/QtGlobal>

#if defined(QTENGINEDLL_LIBRARY)
# define QTENGINEDLLSHARED_EXPORT Q_DECL_EXPORT
#else
# define QTENGINEDLLSHARED_EXPORT Q_DECL_IMPORT
#endif

#endif // QTENGINEDLL_GLOBAL_H


QtEngineDll.h


#ifndef QTENGINEDLL_H
#define QTENGINEDLL_H

#include "qtenginedll_global.h"

class QTENGINEDLLSHARED_EXPORT QtEngineDll {
public:
QtEngineDll();
int randInt();

};

#endif // QTENGINEDLL_H


QtEngineDll.cpp


#include <QTime>
#include "qtenginedll.h"


QtEngineDll::QtEngineDll()
{
//Create random number seed
QTime time = QTime::currentTime();
qsrand((uint)time.msec());
}

int QtEngineDll::randInt()
{
// Random number between low and high
//return qrand() % ((aHigh + 1) - aLow) + aLow;
return 0;
}




Now while calling from Vb .net I am using the following command:


<DllImport("G:\Varen_CS\02_Projects\01_Softwares\highFreqTrad\ QtDLLImport\test\test\debug\test.dll", _
CallingConvention:=CallingConvention.StdCall)> _
Private Shared Function QtEngineDll() As Integer
End Function


It is giving me the error: Unable to find an entry point named 'QtEngineDll' in DLL

Can you pls tell me what the wrong I am do'g and what is the entry point to be used from the code?
Also how should I define a different entry point in a dll?
Is it possible to define multiple entry points in a single dll?


Thanks in advance.

abghosh
6th March 2010, 18:00
Ok I got it.

But now I am facing a new problem. I am passing a string value as an argument. But It is reading its ascii value.