Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Глюк ATL 3.0 в С++ Builder 6.0

2 views
Skip to first unread message

Dmytry Ginzburg

unread,
Apr 26, 2009, 1:43:21 PM4/26/09
to
Здравствуйте, о моногоуважаемый(ая), All!
Вот.. Hабил письмецо.. А вот, что из этого вышло:
Создал простенький COM-сервер на базе RemoteDataModule. Зарегил его.
Просматриваю реестр: интерфейсы туда записались, а CLSID класса нет. Как
следствие, при попытке создания объекта выдаётся сообщение, что класс не
зарегистрирован. Это глюк или как? И есть ли лечение?


Желаю Вам всего наилучшего, All.Дмитрий

Vlad Foltz

unread,
May 4, 2009, 3:17:58 PM5/4/09
to
�p����, Dmytry !

�� A�� 26 2009 22:43 �� ����������y �p�����
Dmytry Ginzburg ������� � All:

DG> ����� �� ���������������. ��� ���� ��� ���? � ���� �� �������?

H� ����������� � �������� ��������������� ���� (MFC/ATL). �������� ����� :) ���
������� ��������� �� �������� (���� � ��������). ����������� VC.

H� ����, Dmytry.

vladisl...@mail.ru

Dmytry Ginzburg

unread,
May 5, 2009, 1:21:43 PM5/5/09
to
������������, � ���������������(��), Vlad!
���.. H���� ��������.. � ���, ��� �� ����� �����:

���-��, �������, ��� 05 2009, � 00:17, Vlad Foltz ������� � Dmytry Ginzburg ��
����� ��������, �� ��� ���ң� _"���� ATL 3.0 � �++ Builder 6.0"_

VF> �� A�� 26 2009 22:43 �� ����������y �p�����
VF> Dmytry Ginzburg ������� � All:

DG>> ����� �� ���������������. ��� ���� ��� ���? � ���� �� �������?

VF> H� ����������� � �������� ��������������� ���� (MFC/ATL). �������� �����
VF> :) ��� ������� ��������� �� �������� (���� � ��������). ����������� VC.

��� MFC ������� �� ����. � ��� COM-������ ��� ATL �� ������� �� �������. ��� �
������ ��� ��������� ������������, � �������, ������� ���������(�) ��������� ��
�����? ����� ���� �� ������� ����������, �� � �� ��̣� � ���, ��� ���� � ������
���������� ��� COM-�������, ����� ��� ��������� ������ �������. � � ������ ��
COM �� ���� ����� ����� �� �������.
����� ��� ����� ����������, Vlad.�������.

Vlad Foltz

unread,
May 5, 2009, 11:57:34 AM5/5/09
to
�p����, Dmytry !

�� Ma� 05 2009 22:21 �� ����������y �p�����
Dmytry Ginzburg ������� � Vlad Foltz:

DG> ��� MFC ������� �� ����. � ��� COM-������ ��� ATL �� ������� ��
DG> �������.

H� ����� - ������. ��� ���� ���������. ATL � ������� �� ������� ����������, ���
"���������" - �� ����� ��� ������������� �����. �������-�� ��� ����� � ����
����� ��� ��� � ������������. ��� �����-�� ������� ���� ���� CComBSTR �
������...

DG> ��� � ������ ��� ��������� ������������, � �������, �������
DG> ���������(�) ��������� �� �����? ����� ���� �� ������� ����������, ��
DG> � �� ��̣� � ���, ��� ���� � ������ ���������� ��� COM-�������, �����
DG> ��� ��������� ������ �������. � � ������ �� COM �� ���� ����� ����� ��
DG> �������.

MSDN. ��� ��� ����. ����������� ��� ����� ��������, ���� � COM ����������
��������.

H� ����, Dmytry.

vladisl...@mail.ru

Dmytry Ginzburg

unread,
May 7, 2009, 2:26:41 PM5/7/09
to
������������, � ���������������(��), Vlad!
���.. H���� ��������.. � ���, ��� �� ����� �����:

���-��, �������, ��� 05 2009, � 20:57, Vlad Foltz ������� � Dmytry Ginzburg ��


����� ��������, �� ��� ���ң� _"���� ATL 3.0 � �++ Builder 6.0"_

VF> �p����, Dmytry !

VF> �� Ma� 05 2009 22:21 �� ����������y �p�����
VF> Dmytry Ginzburg ������� � Vlad Foltz:

DG>> ��� MFC ������� �� ����. � ��� COM-������ ��� ATL �� ������� ��
DG>> �������.

VF> H� ����� - ������. ��� ���� ���������. ATL � ������� �� �������
VF> ����������, ��� "���������" - �� ����� ��� ������������� �����. �������-��
VF> ��� ����� � ���� ����� ��� ��� � ������������. ��� �����-�� ������� ����
VF> ���� CComBSTR � ������...

H�, ������ ������������ �������������, ����� ������������ ����� VARIANT. � ���
� ������������ ������������� ���������� �������� ����������. � �����, ��� �
����� � ���� ��� �����������. ���������, ��������� � ����� ������ ATL. ������ �
������ ���������� ������ � ���������� VCL. �������� � ���� RemoteDataModule.
����� ����� ��� ������ ������ ���������� �����, ��������������� h � cpp �����,
� ����� ���� � ����������� bpf. ���� ���� ����� ��������� ���������.
_!--==> � ���� Windows Clipboard ����������... <==--!_
#include <atl\atlmod.h>
#include "MyServerImpl.h"
USEFORM("MyServerImpl.cpp", MyServer); /* TCRemoteDataModule: File Type */ /*
MyServer: CoClass */
//---------------------------------------------------------------------------
This file is used by the project manager only and should be treated like the
project file
// NOTE: You may derive a class from TComModule and use it as your server's
// module object. (i.e. Assign an instance of that class to _Module).
// However, you must *NOT* change the name _Module.
//
TComModule _ProjectModule(0 /*InitATLServer*/);
TComModule &_Module = _ProjectModule;

// The ATL Object map holds an array of _ATL_OBJMAP_ENTRY structures that
// described the objects of your OLE server. The MAP is handed to your
// project's CComModule-derived _Module object via the Init method.
//
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_MyServer, TMyServerImpl)
END_OBJECT_MAP()
//---------------------------------------------------------------------------
_!--==> � ���� Windows Clipboard �������������... <==--!_
��� � �������, ���������� ����� ����� ����������� ����� ������ � �������
WinMain �������� ������ ���������. � � ��������� ������ ���� TComModule.
������� ����� ���������� ATL, � ������, ��� ��� ���� �����, �������
������������ ������ � �������, ���� ��� ����������, � ����� ������������
������� ������. ���� ����� ���������� �� Initproc, ������������� �� ������
������������� ����������� �ݣ �� ������ WinMain. � ��� ������ RemoteDataModule
��������� ��� ������ CreateInstance ������� ������. � ����� ����� ���������
������ tmFree. �����, ��� � �������, ��� ��������� � ����� ������� �������
���������� ������� COM ������� �����, � ������� � ���� ������. ��� ����������
���������� ������� �� ���� RemoteDataModule ��������� �� ������ ������ �
��������. ����� ��������� event.
_!--==> � ���� Windows Clipboard ����������... <==--!_
HANDLE hEvent=CreateEvent(0,true,false,0);
_!--==> � ���� Windows Clipboard �������������... <==--!_
� ����������� ����� ������� � ��� ������������
_!--==> � ���� Windows Clipboard ����������... <==--!_
void __fastcall TMyServer::CRemoteDataModuleDestroy(TObject *Sender)
{SetEvent(hEvent);

}
_!--==> � ���� Windows Clipboard �������������... <==--!_
� ����� � WinMain ��� �������� ������ ��������� ������� �������� ������������
�������
_!--==> � ���� Windows Clipboard ����������... <==--!_
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
{if(!strstr(lpCmdLine,"regserver")&&(!strstr(lpCmdLine,"unregserver")))WaitForS
ingleObject(hEvent,INFINITE);
return 0;
}
_!--==> � ���� Windows Clipboard �������������... <==--!_
������ ������ � ����������� �������. � ����� ����������� ������ ���������� ��
���� � ��������, ��� ���������� ������, ��� ������� ������� �� ������������ �
������. ��� ���� ������� ������ ����� �����, ������� ������ ���������� ���
�����������

_!--==> � ���� Windows Clipboard ����������... <==--!_
static HRESULT WINAPI UpdateRegistry(BOOL bRegister)
{
TRemoteDataModuleRegistrar regObj(GetObjectCLSID(), GetProgID(),
GetDescription());
// Disable these flags in order to disable use by socket or web
connections.
// Also set other flags to configure the behavior of your application
server.
// For more information, see atlmod.h and atlvcl.cpp.
regObj.Singleton = true;
regObj.EnableWeb = true;
regObj.EnableSocket = true;
return regObj.UpdateRegistry(bRegister);
}
_!--==> � ���� Windows Clipboard �������������... <==--!_
� ��������� ��������� ���������� �� ���� ������, � ����� �� ������������� ����
�������, �� ��� ������� � ������ /regserver �� ����� ��� ���������� ������-��
����������. ������������ �������� ��������� - ��� ��������� �� ������� WinMain.
� ��� ��� ���� ������� ��������, �.�. � �������� ����������� ����. ��� �����
�ϣ ��������� ������ ������ ATL ������ ���������� � ���, ��� ��� �
���������������� �������� ��� ������ ��������. � ��� ��������� ������, ���
����� �� ������ ������ ���� ����������, ���� ���� ����� � ��� �������� ��
Visual Studio, ���� ����� ������� ������ ����������� VCL, ������� ������ �����
���� �� ��������� � ������������� ATL, ���� �� �ӣ �������� ���, ��� ����.

DG>> ��� � ������ ��� ��������� ������������, � �������, �������
DG>> ���������(�) ��������� �� �����? ����� ���� �� ������� ����������, ��
DG>> � �� ��̣� � ���, ��� ���� � ������ ���������� ��� COM-�������, �����
DG>> ��� ��������� ������ �������. � � ������ �� COM �� ���� ����� ����� ��
DG>> �������.

VF> MSDN. ��� ��� ����. ����������� ��� ����� ��������, ���� � COM ����������
VF> ��������.

� ���������, �� ����� ���������� ATL ��� ����� ��� ����������, � ���� ���������
���������� ������� ��������.
����� ��� ����� ����������, Vlad.�������.

Vlad Foltz

unread,
May 8, 2009, 3:05:46 PM5/8/09
to
�p����, Dmytry !

�� Ma� 07 2009 23:26 �� ����������y �p�����
Dmytry Ginzburg ������� � Vlad Foltz:

VF>> �����-�� ������� ���� ���� CComBSTR � ������...
DG> H�, ������ ������������ �������������, ����� ������������ �����
DG> VARIANT.

����� ����� ����. ������ ��� ���� ���� ������� � ���, ��� � "����" ��� "Borland
ATL" ����� �� �����. ������� ��� �������. �� ������ ������� �� ����? ���� �
���� :) ������ ��� �� ������� ���� �� �� �������� ������ COM �� �� ��������
ATL.

[-=���-���=-]
DG> � ���������, �� ����� ���������� ATL ��� ����� ��� ����������,

��� ��� ���� :) � ��� ����� � ��� ����������� COM-�����������. ������ �� ������
�������. ������ ����� ������ �� � MSDN, � � �����-������ ������, ���� "������
COM".

P.S. � ����� ���������� ������ ����� �� ���� ������. ����� ��� �� ��������� ��
� ��������, �� � ATL. ���� ��� �������� � ����������� � ���� ������ �������
"���� ���-��", �� ������� ��� ����������� ������� � ������.

H� ����, Dmytry.

vladisl...@mail.ru

0 new messages