Hello,
I am using Borland C++ 4.52 under Win95.
I'd like to call a 32bit DLL from a 16bit application.
I can create the DLL and the application. When I try to load
the 32bits DLL in the 16bit program with LoadLibrary(), the
function returns an error of code:
21 Application requires Microsoft Windows 32-bit extensions.
Why do I get this message? I am running Win95, do I need Win32s ???
Thanks for any help, Paul
|\ _,,,---,,_ Paul Weustink
ZZZzz /,`.-'`' -. ;-;;,_ phone: +31 53 4892806
|,4- ) )-,_. ,\ ( `'-' fax : +31 53 4892223
Control Laboratory, Dept. EE,
University of Twente, Netherlands
---------------------- THE 32BIT DLL -------------------------------
#define STRICT
#include <windows.h>
/* 32bit DLL entry point */
BOOL WINAPI DllEntryPoint (HINSTANCE hinstDll, DWORD fdwRreason, LPVOID
plvReserved)
{
return 1;
/* exit procedure */Quote:}
int FAR PASCAL WEP (int bSystemExit)
{
return 1;
/* The function I would like to call */Quote:}
void _export MyFunction (double *y)
{
int x = 1;
*y = *y + x;
------------------------------ THE 16BIT APPLICATION ------------------Quote:}
#include <windows.h>
#include <stdio.h>
/* the 16bit main program */
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow)
{
double y;
char msg[256];
HINSTANCE testDLL;
void (FAR *lpMyFunction)(double *);
/* try to load the 32bit DLL */
HINSTANCE testDLL = LoadLibrary ((LPCSTR) "test.dll");
if ((UINT) testDLL > HINSTANCE_ERROR)
{
/* try to load the function */
(FARPROC) lpMyFunction = GetProcAddress (testDLL, "MyFunction");
if (lpMyFunction)
{
y = 1.0;
/* call the 32bit function */
(*lpMyFunction)(&y);
sprintf (msg, "y = %g", y);
MessageBox (0, msg, "result", MB_OK);
}
else
MessageBox (0, "MyFunction not found", "error", MB_OK);
/* unload the library */
FreeLibrary (testDLL);
}
else
{
sprintf (msg, "test.dll not found, error = %d", (UINT) testDLL);
MessageBox (0, msg, "error", MB_OK);
}
return 0;
Quote:}