|
From: <qa...@ho...> - 2003-01-13 14:11:56
|
Hi.
First of all, you should remove the ';' after the line
if(WSAStartup(MAKEWORD(2,0),&wsaInfo)!=3D0);
That should do the trick :-)
If not, this has worked for my app
if(WSAStartup(0x0202, &wsaInfo)!=3D0)
/J
*********** REPLY SEPARATOR ***********
On 2003-01-13 at 14:43 Vlada Djurovic wrote:
>Hi.
>I'm trying to write an app using windows sockets, but I'm having problems
>at
>start. Here's piece of my code:
>
>#include <windows.h>
>#include <winsock2.h>
>#include "resource.h"
>
>HINSTANCE g_hInst;
>const char ClassName[]=3D"WndClass";
>LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
>
>int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR
>lpCmdLine,int nCmdShow)
>{
> WNDCLASSEX wc;
> MSG msg;
> HWND hWnd;
> WSADATA wsaInfo;
> g_hInst=3DhInstance;
>
> if(WSAStartup(MAKEWORD(2,0),&wsaInfo)!=3D0);
> MessageBox(NULL,"Could not initialize socket","Error",MB_OK);
>................................................/* rest of code*/
>When I start the program, I get the message box "Could not initialize
>socket", so I suppose WSAStartup failed. What could be the cause? I have
>Win2000 and Dev 4.9.5.0. In project options, under linker options, I
>have: -lwsock32 -lws2_32 and ws2_32.dll is installed. I tried with lower
>version of winsock in WSAStartup, but it didn't work either. Thanks for=
any
>help.
>P.S. Where can I find some tutorials about winsock on the web?
>------------
>Vlada
>
>
>
>-------------------------------------------------------
>This SF.NET email is sponsored by: FREE SSL Guide from Thawte
>are you planning your Web Server Security? Click here to get a FREE
>Thawte SSL guide and find the answers to all your SSL security issues.
>http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
r
|