15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Using CSocket in _USRDLL

Sean Stephens -- seans@anasazi.com
Wednesday, April 17, 1996


Environment: Win95, VC++ 4.1, VB 4.0

I have a USRDLL that maintains a socket connection on behalf of an 
application.  It calls the various MFC CSocket functions to get
started when the user calls DLLFuncConnect(...).  This works fine
when the DLL is called from a VC++ application.  However when the 
first DLL function is called from a VB application it ASSERTS.

The call stack ends up like this:

AfxGetInstanceHandle
AfxRegisterWndClass
CAsyncSocket::AttachHandle
CAsyncSocket::Socket
CAsyncSocket::Create

AfxGetInstanceHandle ASSERTS because the variable afxCurrentInstanceHandle
is NULL.

It would seem that the problem is trying to create the hidden window to
receive socket notification messages.

Does anyone know of a problem using the CSocket classes in a DLL that is going
to be called by VB?

Appreciate your help,

Sean Stephens
seans@anasazi.com 




Grant Shirreffs Great Elk -- Grant.S@greatelk.co.nz
Monday, April 22, 1996


Do you have a CWinApp object?  If not, under Win32 the DLL will load OK,   
but the MFC initialisation code will not get called so none of the global   
handles such as those returned by AfxGetInstanceHandle and   
AfxGetResourceHandle will be set.

 ----------
From:  owner-mfc-l[SMTP:owner-mfc-l@netcom.com]
Sent:  Wednesday, 17 April 1996 13:05
To:  mfc-l
Subject:  Using CSocket in _USRDLL


Environment: Win95, VC++ 4.1, VB 4.0

I have a USRDLL that maintains a socket connection on behalf of an
application.  It calls the various MFC CSocket functions to get
started when the user calls DLLFuncConnect(...).  This works fine
when the DLL is called from a VC++ application.  However when the
first DLL function is called from a VB application it ASSERTS.

The call stack ends up like this:

AfxGetInstanceHandle
AfxRegisterWndClass
CAsyncSocket::AttachHandle
CAsyncSocket::Socket
CAsyncSocket::Create

AfxGetInstanceHandle ASSERTS because the variable   
afxCurrentInstanceHandle
is NULL.

It would seem that the problem is trying to create the hidden window to
receive socket notification messages.

Does anyone know of a problem using the CSocket classes in a DLL that is   
going
to be called by VB?

Appreciate your help,

Sean Stephens
seans@anasazi.com






| Вернуться в корень Архива |