|
From: Vlada D. <dj...@im...> - 2003-01-13 13:44:00
|
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[]="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=hInstance;
if(WSAStartup(MAKEWORD(2,0),&wsaInfo)!=0);
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
|