[SOLVED]Qt + COM (ActiveX)
-
Sorry for the rubbish, really want to attract the attention of people in the know!
Please, if someone has worked with QAxObject and understand this topic, please pay attention to the topic
http://qt-project.org/forums/viewthread/29235/ -
Maybe rewrite all in English...
-
There V82.COMConnector COM module is a module connected to the server COM 1C (the accounting system)
For example, you can connect via PowerShell
@$connector = New-Object -ComObject “V82.ComConnector”
$connection = $connector.Connect("Srvr=""server1C"";Ref=""DB"";Usr=""user"";Pwd=""password"";")
$users = Get-Property -comObj $connection -prName “UsersINdatabase1C”@Now, in the variable $users stored database users 1C
$Connector can be used to obtain other information from the database 1CHow to connect to a COM object through Qt?
If you write code
@#include <QApplication>
#include <QWidget>
#include <oleidl.h>
#include <ActiveQt/QAxObject>
#include <QAxWidget>
#include <iostream>
#include <QDebug>
#include <clocale>
#include <QTextCodec>int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
setlocale(LC_ALL, "rus");
HRESULT r = OleInitialize(0);
QAxObject * ax = new QAxObject("V82.COMConnector");
QAxObject * ac = ax->querySubObject("Connect("Srvr=172.0.0.100;Ref=jkh02;Usr=1C-Bot;Pwd=qaz;")");
return a.exec();
}@Will get an error
@ QAxBase: Error calling IDispatch member Connect: Exception thrown by serverCode : 16389 Source : V82.COMConnector.1 Description: {????????????????????????(36)}: ???????????? : 1C-Qt-B ot-vostok ?? ??? ?????? ? ??????????? ?????????????. ???????? ?????? ??? ??????? ??? ???????????? ? ??????????. {???????????.????????????????????????.??????(172)}: ?????? ??? ?????? ?????? ??? ?????? (????????): ?????? ??? ?????????? ??????????? - '????????????': {???????? ???.????_???????????.??????(186)}: ?????? ??? ????????? ???????? ???????? ?????? ??? (?????????????????????????????????????): ??????? ????????? ????????????????? ???? ???????? ????????? ?????? Help : Connect to the exception(int,QString,QString,QString) signal to catch this exception@
Question - why? Why error occurs when creating a variable *ac?
Sorry for the translation, it is to blame Google :)
-
Оказалось, что коннект я правильно делаю и соединение успешно, просто моего пользователя не было в справочнике пользователей в базе 1С, поэтому и не пускал :)
It turned out that I'm doing this right connection and the connection is successful, just my user was not in the directory of users in the 1C, and therefore would not allow him :)