Click here to Skip to main content
15,918,742 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: windows+d Pin
Hamid_RT30-Apr-08 4:47
Hamid_RT30-Apr-08 4:47 
QuestionI cant well dont no how to connect to a Mysql database. Pin
bradmasterx29-Apr-08 20:54
bradmasterx29-Apr-08 20:54 
AnswerRe: I cant well dont no how to connect to a Mysql database. Pin
_AnsHUMAN_ 29-Apr-08 20:57
_AnsHUMAN_ 29-Apr-08 20:57 
AnswerRe: I cant well dont no how to connect to a Mysql database. Pin
ShilpiP29-Apr-08 21:06
ShilpiP29-Apr-08 21:06 
AnswerRe: I cant well dont no how to connect to a Mysql database. Pin
David Crow30-Apr-08 3:47
David Crow30-Apr-08 3:47 
AnswerRe: I cant well dont no how to connect to a Mysql database. Pin
Hamid_RT30-Apr-08 4:45
Hamid_RT30-Apr-08 4:45 
QuestionAdding a drop down menu to an IE Toolbar button Pin
Arnon A29-Apr-08 20:51
Arnon A29-Apr-08 20:51 
QuestionVC++ - AciveXDLL -Sockets Pin
lgatcodeproject29-Apr-08 20:41
lgatcodeproject29-Apr-08 20:41 
Hi EveryOne,

In ActivexDLL I have written a method called Connect(..)inside a class. The method exposes the functionality of connecting to another system using sockets.

The problem here is when I compile my project I am getting link errors(unresolved external symbol). These errors are thrown when winsocks methods are called like htos(),inet_addr(),connect() are called.

Unresolved symbol (upto my knowledge) are thrown when the function definition is unknown or its different from the one that is implemented. since I am using an inbuild function (used the header file winsock2.h) what might be the cause to the problem? How would I Overcome it. Please find the code below.

STDMETHODIMP CRAPClientX::Connect(BSTR serverIP, BSTR serverPort,BSTR *output)<br />
{<br />
	// TODO: Add your implementation code here	<br />
	/**output=SysAllocString(L"Connected");<br />
	return S_OK;*/<br />
	  //----------------------<br />
  // Initialize Winsock<br />
<br />
  WSADATA wsaData;<br />
  char returnString[150];<br />
<br />
  int iResult = WSAStartup(MAKEWORD(2,2), &wsaData);<br />
  if (iResult != NO_ERROR)<br />
    printf("Error at WSAStartup()\n");<br />
<br />
  //----------------------<br />
  // Create a SOCKET for connecting to server<br />
<br />
  SOCKET ConnectSocket;<br />
<br />
  ConnectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);<br />
<br />
  if (ConnectSocket == INVALID_SOCKET) <br />
  {<br />
  	sprintf(returnString,"Error at socket(): %ld\n", WSAGetLastError());    <br />
	*output=SysAllocString(_bstr_t(returnString));	<br />
	WSACleanup();<br />
	return S_OK;<br />
  }<br />
<br />
  //----------------------<br />
  // The sockaddr_in structure specifies the address family,<br />
  // IP address, and port of the server to be connected to.<br />
<br />
  sockaddr_in clientService; <br />
<br />
  clientService.sin_family = AF_INET;<br />
<br />
  clientService.sin_addr.s_addr = inet_addr("127.0.0.1" );<br />
<br />
  clientService.sin_port = htons( 27015 );<br />
<br />
  //----------------------<br />
  // Connect to server.<br />
<br />
  if ( connect(ConnectSocket, (SOCKADDR*) &clientService, sizeof(clientService) ) == SOCKET_ERROR) <br />
  {<br />
  	sprintf( returnString,"Failed to connect.\n" );<br />
	*output=SysAllocString(_bstr_t(returnString));<br />
	WSACleanup();<br />
	return S_OK;<br />
  }<br />
<br />
  sprintf(returnString,"Connected to server.\n");<br />
  *output=SysAllocString(_bstr_t(returnString)); <br />
  WSACleanup();<br />
  return S_OK;<br />
}<br />


kinldy reply.

Regards,
LG.Confused | :confused:

lgatcodeproject

AnswerRe: VC++ - AciveXDLL -Sockets Pin
Cedric Moonen29-Apr-08 20:50
Cedric Moonen29-Apr-08 20:50 
GeneralRe: VC++ - AciveXDLL -Sockets Pin
lgatcodeproject29-Apr-08 20:59
lgatcodeproject29-Apr-08 20:59 
JokeRe: VC++ - AciveXDLL -Sockets Pin
_AnsHUMAN_ 29-Apr-08 21:01
_AnsHUMAN_ 29-Apr-08 21:01 
GeneralRe: VC++ - AciveXDLL -Sockets Pin
Cedric Moonen29-Apr-08 21:07
Cedric Moonen29-Apr-08 21:07 
GeneralRe: VC++ - AciveXDLL -Sockets Pin
lgatcodeproject29-Apr-08 22:33
lgatcodeproject29-Apr-08 22:33 
QuestionHow to create dll in Visual Studio 2008 editor in Visual C++? Pin
Nikesh Jagtap29-Apr-08 19:49
Nikesh Jagtap29-Apr-08 19:49 
AnswerRe: How to create dll in Visual Studio 2008 editor in Visual C++? Pin
_AnsHUMAN_ 29-Apr-08 20:44
_AnsHUMAN_ 29-Apr-08 20:44 
AnswerRe: How to create dll in Visual Studio 2008 editor in Visual C++? Pin
Hamid_RT30-Apr-08 4:43
Hamid_RT30-Apr-08 4:43 
AnswerRe: How to create dll in Visual Studio 2008 editor in Visual C++? Pin
Mark Salsbery30-Apr-08 5:40
Mark Salsbery30-Apr-08 5:40 
Questioncan hdc be passed between processes? Pin
namaskaaram29-Apr-08 19:34
namaskaaram29-Apr-08 19:34 
AnswerRe: can hdc be passed between processes? Pin
Stephen Hewitt29-Apr-08 20:18
Stephen Hewitt29-Apr-08 20:18 
QuestionHow Can Set Back Image in ListCtrl ReportView? Pin
Le@rner29-Apr-08 19:34
Le@rner29-Apr-08 19:34 
QuestionRe: How Can Set Back Image in ListCtrl ReportView? Pin
_AnsHUMAN_ 29-Apr-08 19:46
_AnsHUMAN_ 29-Apr-08 19:46 
QuestionLoad *.ico onto Toolbar Pin
bagavathikumar29-Apr-08 19:32
bagavathikumar29-Apr-08 19:32 
AnswerRe: Load *.ico onto Toolbar Pin
Saurabh.Garg29-Apr-08 19:47
Saurabh.Garg29-Apr-08 19:47 
AnswerRe: Load *.ico onto Toolbar Pin
thuchv8714-Apr-10 19:44
thuchv8714-Apr-10 19:44 
Questionhow to create log file in Visual C++ ??? Pin
cb0206129-Apr-08 17:13
cb0206129-Apr-08 17:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.