Click here to Skip to main content
16,012,316 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralHooking CoCreateInstance / CoGetClassObject Pin
peterchen29-Mar-05 5:06
peterchen29-Mar-05 5:06 
GeneralRe: Hooking CoCreateInstance / CoGetClassObject Pin
Michael Dunn29-Mar-05 5:35
sitebuilderMichael Dunn29-Mar-05 5:35 
GeneralRe: Hooking CoCreateInstance / CoGetClassObject Pin
Joel Lucsy29-Mar-05 13:03
Joel Lucsy29-Mar-05 13:03 
QuestionHow to compare two images using cximage Pin
Madhurya29-Mar-05 4:54
Madhurya29-Mar-05 4:54 
AnswerRe: How to compare two images using cximage Pin
Ted Ferenc29-Mar-05 5:23
Ted Ferenc29-Mar-05 5:23 
AnswerRe: How to compare two images using cximage Pin
Chris Losinger29-Mar-05 10:01
professionalChris Losinger29-Mar-05 10:01 
AnswerRe: How to compare two images using cximage Pin
John R. Shaw30-Mar-05 9:09
John R. Shaw30-Mar-05 9:09 
Generalproblem with MFC DLL Pin
eli1502197929-Mar-05 3:47
eli1502197929-Mar-05 3:47 
Hi,
I've wrote MFC dll using MFC DLL wizard(regular dll using shared MFC dll).
in my dll there is the declaration:
#define TCPDLL_API __declspec(dllexport)
TCPDLL_API int FLRInitializeIP(IPStruct *Server,int num_of_radars);


in my dll.def there is the declaration:

FLRInitializeIP       @1


and the implementation is as follow:

TCPDLL_API int FLRInitializeIP(IPStruct *Server , int num_of_radars)
{
	struct hostent *Host;
	SIZE_T t=100;
	char *host_name = new char[100];

	gethostname(host_name,t);
	Host = gethostbyname(host_name);
	Server->HostIP = inet_ntoa(*((struct in_addr*)Host->h_addr));
	delete []host_name;

	//Server->ClientsArray = new FLR_COMMUNICATION_DEVICE[num_of_radars];
	//for(int i = 0 ; i < num_of_radars ; i++)
	//{
	//	Server->ClientsArray[i].socket = INVALID_SOCKET;
	//	Server->ClientsArray[i].IP_Address.Empty();
	//}

	Server->Num_Of_Connected_Clients = 0;
	Server->ListeningSocket = INVALID_SOCKET;
	Server->Num_Of_Radars = num_of_radars;
	if(CreateTCPServerSocket(Server) != LISTEN_SUCCESS)
		return 0;//LISTEN_FAILED;
	return 1;//LISTEN_SUCCESS;
}



now,in my application i'm using the dll like this:

typedef int (CALLBACK* FLRInitializeIP_PROCCESS)(IPStruct* ,int);
void CDLLTestDlg::OnListenButton() 
{
    HINSTANCE hLib;
    FLRInitializeIP_PROCCESS FLRInitializeIP;
    IPStruct Server;
    int result;


    hLib = LoadLibrary("TCP_DLL.dll");
    FLRInitializeIP = (FLRInitializeIP_PROCCESS)GetProcAddress(hLib,"FLRInitializeIP");

	//(FLRInitializeIP)(&Server , 1);
	result = FLRInitializeIP(&Server , 1);

	m_List.AddString(Server.HostIP);

    FreeLibrary(hLib);
}



if,in my application 'the return type is "void" so there is no problem.
But,if the ruturn value is anything else than void,i gets an error.

what i'm doing wrong?

Helpppppppppppppppppppp Confused | :confused:

Regards,
Eli
GeneralRe: problem with MFC DLL Pin
Blake Miller29-Mar-05 5:27
Blake Miller29-Mar-05 5:27 
GeneralRe: problem with MFC DLL Pin
eli150219791-Apr-05 0:05
eli150219791-Apr-05 0:05 
GeneralRe: problem with MFC DLL Pin
Blake Miller1-Apr-05 4:09
Blake Miller1-Apr-05 4:09 
GeneralHELP!!! Pin
shulflem29-Mar-05 3:46
shulflem29-Mar-05 3:46 
GeneralRe: HELP!!! Pin
Alexander M.,29-Mar-05 5:37
Alexander M.,29-Mar-05 5:37 
GeneralRe: HELP!!! Pin
ThatsAlok29-Mar-05 17:59
ThatsAlok29-Mar-05 17:59 
GeneralRe: HELP!!! Pin
ThatsAlok29-Mar-05 18:04
ThatsAlok29-Mar-05 18:04 
GeneralHELP!!! Pin
Anonymous29-Mar-05 3:45
Anonymous29-Mar-05 3:45 
GeneralCMSHFlexGrid How Move .... Pin
ivax29-Mar-05 2:28
ivax29-Mar-05 2:28 
GeneralUser Password Pin
Anonymous29-Mar-05 1:44
Anonymous29-Mar-05 1:44 
GeneralRe: User Password Pin
bosfan29-Mar-05 1:49
bosfan29-Mar-05 1:49 
GeneralRe: User Password Pin
Blake Miller29-Mar-05 5:30
Blake Miller29-Mar-05 5:30 
GeneralRe: User Password Pin
Michael Dunn29-Mar-05 5:40
sitebuilderMichael Dunn29-Mar-05 5:40 
GeneralRe: User Password Pin
bosfan29-Mar-05 20:06
bosfan29-Mar-05 20:06 
GeneralRe: User Password Pin
deldeep29-Mar-05 20:41
deldeep29-Mar-05 20:41 
GeneralRe: User Password Pin
bosfan30-Mar-05 1:05
bosfan30-Mar-05 1:05 
GeneralCompatabilty between windows 95 &amp;windows 98 device drivers Pin
Neha.marwaha29-Mar-05 1:18
Neha.marwaha29-Mar-05 1:18 

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.