Quote:
#include <iostream>
#include <Windows.h>
#include <conio.h>

using namespace std;

typedef int (*MsgFunction)(int);
typedef int (*BROKER_OPEN)(char* Name,FARPROC fpError,FARPROC fpProgress);

HINSTANCE hinstDLL ;

int main()
{
MsgFunction MsgBox(0) ;
hinstDLL = LoadLibraryA("FXCM.dll") ;

if(hinstDLL != 0)
{
MsgBox = (MsgFunction)GetProcAddress(hinstDLL, "MsgBox");
}

if(MsgBox == 0)
{
cout << "MsgBox is NULL \n";
}

int x = MsgBox(5);

BROKER_OPEN BrokerOpen = (BROKER_OPEN)GetProcAddress(hinstDLL,"BrokerOpen");
if(BrokerOpen)
{
char brokername[50] = "";
long version = (*BrokerOpen)(brokername,NULL,NULL);
}

if(x == 5)
{
cout << "Message Displayed! \n" ;
}

FreeLibrary(hinstDLL) ;
return 0 ;
getch() ;
}


I got problem with higlighted part, you wrote h but it didn't work, I have tried to put it into as a variable-didn't work, so I put hinstDLL and when I try to run it with FXCM.dll it gives me: "Message box is NULL".

EDIT:

When I keep it this way
Quote:
#include <iostream>
#include <Windows.h>
#include <conio.h>

using namespace std;

typedef int (*MsgFunction)(int);
typedef int (*BROKER_OPEN)(char* Name,FARPROC fpError,FARPROC fpProgress);

HINSTANCE hinstDLL ;

int main()
{
MsgFunction MsgBox(0) ;
hinstDLL = LoadLibraryA("FXCM.dll") ;

if(hinstDLL != 0)
{
MsgBox = (MsgFunction)GetProcAddress(hinstDLL, "MsgBox");
}

if(MsgBox == 0)
{
cout << "MsgBox is NULL \n";
}

int x = MsgBox(5);

if(x == 5)
{
cout << "Message Displayed! \n" ;
}

BROKER_OPEN BrokerOpen = (BROKER_OPEN)GetProcAddress(h,"BrokerOpen");
if(BrokerOpen)
{
char brokername[50] = "";
long version = (*BrokerOpen)(brokername,NULL,NULL);
}

FreeLibrary(hinstDLL) ;
return 0 ;
getch() ;
}


I get this:
Quote:
1>------ Build started: Project: DLLtutApp, Configuration: Debug Win32 ------
1> main.cpp
1>c:\users\master roshi\documents\visual studio 2010\projects\dlltutapp\dlltutapp\main.cpp(34): error C2065: 'h' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Last edited by DejaVu; 01/18/13 18:32.

A name means nothing on the battlefield.
After a week no one has a name.