Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CAsyncSocket Assertion 1

Status
Not open for further replies.

stephd

Programmer
Nov 22, 2002
22
0
0
FR
Hi all,

I've got a problem using CAsyncSocket in an ATL control (dll generated with ATL Appwizard) : The Create() method asserts because AfxGetInstanceHandle returns NULL.

Is there any solution to solve this ?

thanks in advance

Stephd
 
You need to include MFC in your project settings. In VC 6 it is on the "General" tab in the project settings. In VC 7 the settings have a completely different UI but it is in there somewhere. Also you will have to manually #include the MFC headers since you did not chose the option in the App Wizard.

-pete
 
thanks for your answer, but MFC is supported : I check the Checkbow in appwizard. Moreover, i use a lot of other MFC classes without any pb...

S.
 
Ahhh, sorry read through your post to quickly. Are you calling AFX_MANAGE_STATE at the top of the function you are creating the socket in?

-pete

 
You're right ! I've just found it at the same time... this is the solution. I need to call AFX_MANAGE_STATE(AfxGetStaticModuleState()) before calling Create() member of CAsyncSocket !

thank you very much for your search

S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top