Re: Can I use Windows Sockets API in DllMain or CWinApp::InitInstance?
- From: "Alexander Nickolov" <agnickolov@xxxxxxxx>
- Date: Wed, 5 Jul 2006 22:24:33 -0700
The MFC documentaton clearly assumes you are using MFC
in an application and is thus wrong.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"happyjet" <happyjet@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:675027DA-44EC-40E9-901D-F0697D7A4CC5@xxxxxxxxxxxxxxxx
Can I use Windows Sockets API in DllMain or CWinApp::InitInstance? I think
the restriction about DllMain also applys to CWinApp::InitInstance.
All belowing are copied from MSDN Library. It is a contradiction!
On the topic of "DllMain",
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dllmain.asp
says:
Calling functions in DllMain that require DLLs other than Kernel32.dll
may result in problems that are difficult to diagnose. For example,
calling
User, Shell, and COM functions can cause access violation errors, because
some functions load other system components.
MSDN Library - October 2001 says:
Calling functions other than TLS, object-creation, and file functions
may result in problems that are difficult to diagnose. For example,
calling
User, Shell, COM, RPC, and Windows Sockets functions (or any functions
that
call these functions) can cause access violation errors, because their
DLLs
call LoadLibrary to load other system components.
On the topic of "AfxSocketInit",
http://msdn2.microsoft.com/en-us/library/x12941w5.aspx says:
Call this function in your CWinApp::InitInstance override to initialize
Windows Sockets.
Thanks in advance.
.
- Follow-Ups:
- Prev by Date: Re: Is this possible?
- Next by Date: Re: reading async from socket
- Previous by thread: Re: Can I use Windows Sockets API in DllMain or CWinApp::InitInstance?
- Next by thread: Re: Can I use Windows Sockets API in DllMain or CWinApp::InitInsta
- Index(es):