Can CSocket be used in non-MFC frame programs?
Zhong zehui -- jeffzhong@nenpub.szptt.net.cn
Tuesday, February 11, 1997
Environment: VC++4.2-flat, Win95
I know that the notification to CSocket object is distributed through MFC's
message map. So, in order to use CSocket to simplify network programming in
non-MFC program is something not so easy to do.
I wonder if we can use CSocket as we use CString in a non-MFC frame
program.
Thanks to anyone who can give me advice.
Zhong zehui
Huawei Co. Ltd.
email
Phone: +86 755 6633828 - 3612
stas -- stas@goldnet.net.il
Wednesday, February 12, 1997
[Mini-digest: 2 responses]
Hi
I'd created a MFC communication dll which is used in a Delphi application.
I'm connecting MFC program with Delphi program by CAsyncSocket.
This is how DllMain looks
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ulReasonRorCall,
LPVOID lpReserved )
{
BOOL fRet;
switch(ulReasonRorCall)
{
case DLL_PROCESS_ATTACH:
fRet = AfxSocketInit();
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
default:
return FALSE;
}
return TRUE;
}
Then you just do what you have to & it will work.
The only wierd thing I got was assertion on init dll which I ignored & everything went good.
-----From: "George Pavlou"
You can use CString because it hasn't a base class. On the other hand,
CSocket has a base and it's the CObject. I wouldn't advice you to try use
the CSocket without MFC.
You can use the Windows Sockets API almost as easy. Look at the WIN32s
Samples, at the WSOCK sample- It demonstates this API.
George
|-------------------------------------------------------------------------|
George Pavlou Tantalus, Inc.
PC Software Specialist Key West, FL
georgep@tansoft.com www.mpgn.com
|-------------------------------------------------------------------------|
----------
> From: Zhong zehui
> To: mfc-l@netcom.com
> Subject: Can CSocket be used in non-MFC frame programs?
> Date: Monday, February 10, 1997 10:52 PM
>
> Environment: VC++4.2-flat, Win95
>
> I know that the notification to CSocket object is distributed through
MFC's
> message map. So, in order to use CSocket to simplify network programming
in
> non-MFC program is something not so easy to do.
> I wonder if we can use CSocket as we use CString in a non-MFC frame
> program.
>
> Thanks to anyone who can give me advice.
>
> Zhong zehui
> Huawei Co. Ltd.
> email
> Phone: +86 755 6633828 - 3612
Gerry Sweeney -- gerry@hornbill.com
Thursday, February 13, 1997
Zhong,
CSocket needs the AFX to work in asynchronous mode. If you are doing non-MFC
applications we find we get best results programming the Winsock library
directly. In Win32 apps you can use blocking network calls and multiple
threads of execution.
Hope this helps
Gerry Sweeney
gerry@hornbill.com
----------
>From: owner-mfc-l
>To: mfc-l
>Subject: Can CSocket be used in non-MFC frame programs?
>Date: 11 February 1997 11:52
>
>Environment: VC++4.2-flat, Win95
>
>I know that the notification to CSocket object is distributed through MFC's
>message map. So, in order to use CSocket to simplify network programming in
>non-MFC program is something not so easy to do.
>I wonder if we can use CSocket as we use CString in a non-MFC frame
>program.
>
>Thanks to anyone who can give me advice.
>
>Zhong zehui
>Huawei Co. Ltd.
>email
>Phone: +86 755 6633828 - 3612
David Elliott - dce@netcom.com
Visit The Land of the Squishy - http://www.btw.com/dce
Become an MFC-L member
| Вернуться в корень Архива
|