|
From: Abhinav_Arora <Abh...@sa...> - 2002-06-20 04:33:38
|
unsubscribe
-----Original Message-----
From: Christian Wallukat [mailto:Chr...@vo...]
Sent: Monday, June 17, 2002 3:18 PM
To: CPP-Maillinglist (E-Mail)
Subject: [Dev-C++] LoadLib
Hi List,
I try to learn the handling with DLLs and the Project I've wrote doesnt
work...
Has anyone some Ideas what I've made wrong ???
Kind Regards
CHW
Here the code:
#include <windows.h>
#include <TCHAR.h>
#include <stdio.h>
static HINSTANCE hLibrary ;
int main(int argc, char* argv[])
{
bool bT;
LPCSTR test;
typedef bool (*lpTest)(void);
typedef LPCSTR (*lpTest2)(void);
typedef char* (*lpTest3) (char*);
lpTest fnTest;
lpTest2 fnTest2;
lpTest3 fnTest3;
//DLL einbinden
if ((hLibrary = LoadLibrary (TEXT("DLL.DLL"))) == NULL)
{
MessageBox (NULL, TEXT ("Can't load DLL.DLL."), "hjjhkj", 0)
;
return -1 ;
};
fnTest = (lpTest) GetProcAddress(hLibrary, _T("_Test1@0"));
if (fnTest != NULL)
{
printf("juhu\n");
bT = fnTest();
};
FreeLibrary(hLibrary); // Unload DLL from memory
if ((hLibrary = LoadLibrary (TEXT("DLL.DLL"))) == NULL)
{
MessageBox (NULL, TEXT ("Can't load DLL.DLL."), "hjjhkj", 0)
;
return -1 ;
};
fnTest2 = (lpTest2) GetProcAddress(hLibrary, _T("Test2"));
if (fnTest != NULL)
{
printf("juhu2\n");
test = fnTest2();
};
FreeLibrary(hLibrary); // Unload DLL from memory
if ((hLibrary = LoadLibrary (TEXT("DLL.DLL"))) == NULL)
{
MessageBox (NULL, TEXT ("Can't load DLL.DLL."), "hjjhkj", 0)
;
return -1 ;
};
fnTest3 = (lpTest3) GetProcAddress(hLibrary, _T("_Test3@4"));
if (fnTest3 != NULL)
{
char szTest[400];
*szTest = 0;
printf("juhu3");
strcpy (szTest, fnTest3("hallo welt\0"));
printf("%s", szTest);
};
FreeLibrary(hLibrary); // Unload DLL from memory
getchar();
return 0;
}
Here the DLL:
#include <windows.h>
#include <string.h>
#ifdef __cplusplus
#define EXPORT extern "C" __declspec (dllexport)
#else
#define EXPORT __declspec (dllexport)
#endif
EXPORT BOOL CALLBACK TestA();
#define TestA Test1
EXPORT LPCSTR CALLBACK TestB();
#define TestB Test2
EXPORT char* CALLBACK TestC(char*);
#define TestC Test3
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
EXPORT BOOL CALLBACK TestA(void)
{
return TRUE;
};
EXPORT LPCSTR TestB(void)
{
return "Test\0";
};
EXPORT char* CALLBACK TestC(char *lpcStr)
{
MessageBox(NULL, lpcStr, "test", MB_OK);
return lpcStr;
};
_______________________________________________________________
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
***********************************************************************
This e-mail (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipeint,please contact
the sender by e-mail and delete all copies; your co-operation in this regard
is appreciated.
|
|
From: Abhinav_Arora <Abh...@sa...> - 2002-06-20 12:29:06
|
Yeah Ioannis I dint get any url -----Original Message----- From: Ioannis Vranos [mailto:no...@ho...] Sent: Thursday, June 20, 2002 5:49 PM To: Dev-C++ Mailing List Subject: RE: [Dev-C++] LoadLib > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Hongli Lai > Sent: Thursday, June 20, 2002 11:14 AM > To: Abhinav_Arora > Cc: CPP-Maillinglist (E-Mail) > Subject: Re: [Dev-C++] LoadLib > > > Abhinav_Arora wrote: > > >unsubscribe > > > > > > > > Didn't you read the unsubscription instructions? I've highlighted the > text with red, made it bold and made it blinking! Did you provide him with any url? Also, i suggest make that text to not blink. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys ------------------------------------------------------- Bringing you mounds of caffeinated joy >>> http://thinkgeek.com/sf <<< _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users *********************************************************************** This e-mail (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipeint,please contact the sender by e-mail and delete all copies; your co-operation in this regard is appreciated. |
|
From: Hongli L. <h....@ch...> - 2002-06-20 08:09:13
|
Abhinav_Arora wrote: >unsubscribe > > > Didn't you read the unsubscription instructions? I've highlighted the text with red, made it bold and made it blinking! |
|
From: Ioannis V. <no...@ho...> - 2002-06-20 12:20:36
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Hongli Lai > Sent: Thursday, June 20, 2002 11:14 AM > To: Abhinav_Arora > Cc: CPP-Maillinglist (E-Mail) > Subject: Re: [Dev-C++] LoadLib > > > Abhinav_Arora wrote: > > >unsubscribe > > > > > > > > Didn't you read the unsubscription instructions? I've highlighted the > text with red, made it bold and made it blinking! Did you provide him with any url? Also, i suggest make that text to not blink. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |
|
From: Ioannis V. <no...@ho...> - 2002-06-20 12:16:52
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Abhinav_Arora > Sent: Thursday, June 20, 2002 7:26 AM > To: Christian Wallukat; CPP-Maillinglist (E-Mail) > Subject: RE: [Dev-C++] LoadLib > > > unsubscribe http://www.noicys.cjb.net/devcpp/ub.htm Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |