Hi Jaymie,
=20
I have tested your code with BC++ 5.02. To make it build at all, I had =
to
remove "#include <mapix.h>". The latter caused "multiple declaration" =
errors
for WCHAR and more. Removing it removed those errors without introducing =
any
problems, so it seems it wasn't needed. I built the project as a Win32 =
DLL
target, compiled with STRICT, _RTLDLL and _BIDSDLL defined, and linked =
with
the following files: "c0w32.obj", "bidsfi.lib", "import32.lib", =
"cw32i.lib"
and "owlwfi.lib". With those changes I tested with and without _OWLDLL
defined. Both cases ran successfully with no crash.
=20
I also tried to build it with VC++ 6.0 SP5 and OWL Next 6.10, and the =
test
built and ran successfully with or without _OWLDLL defined. In this case =
I
used your source as is, except I had to define __MIN_MAX_DEFINED before
_OWLPCH.
=20
Are you sure the MAPI call is correct? No unitialized data somewhere =
causing
random errors? Does LoadLibrary return a valid handle? Does =
GetProcAddress
return a valid function pointer? Could it be a w_char/Unicode problem?
=20
Hope that helps,
---
Vidar Hasfjord
=20
-----Original Message-----
From: owlnext-users-admin@...
[mailto:owlnext-users-admin@...] On Behalf Of Jaymie
Blanchard
Sent: Monday, June 06, 2005 8:48 PM
To: owlnext-users@...
Subject: [OwlNExt-users] RE: Strange problem with MAPI running in an =
OWLNExt
App.
Does anyone have any insight on this issue? I'm thinking it might be
something to do with the TLS mechanism that OWLNExt uses. Could someone =
run
this test on a Borland platform and see if it exhibits the same problem, =
so
I can rule out Microsoft's CRT?
=20
_____ =20
From: Jaymie Blanchard
Sent: Tue 5/31/2005 4:56 PM
To: owlnext-users@...
Subject: Strange problem with MAPI running in an OWLNExt App.
For some reason, MAPI crashes on me when simply running from OwlMain. I =
get
a BAADF00D pointer in EBX at some point during a call to MAPISendMail =
and I
can't figure out what the problem is. Simply changing OwlMain to =
WinMain
and removing the defs.h include the problem goes away.
I've put together some sample code that illustrates the problem. The
following code is for MSVC++ 7. To switch between the Owl version and =
the
normal Win32 version, simply comment/uncomment the _OWLDLL define.
/////////////////////////////////////////////////////////////////////////=
///
///////////////////=20
#include <windows.h>=20
#include <mapi.h>=20
#include <mapix.h>=20
// Comment this line out to switch between OWL and Win32=20
#define _OWLDLL=20
#if defined(_OWLDLL)=20
#define _OWLPCH=20
#include <owl/defs.h>=20
#endif=20
HINSTANCE hMapiLib;=20
ULONG ExecuteMapi( )=20
{=20
MapiRecipDesc recv;=20
ZeroMemory( &recv, sizeof(recv) );=20
recv.ulReserved =3D 0;=20
recv.ulRecipClass =3D MAPI_TO;=20
recv.lpszName =3D "Test Recipient";=20
recv.lpszAddress =3D "Test.Recipient@...
recv.ulEIDSize =3D 0L;=20
recv.lpEntryID =3D NULL;=20
MapiMessage msg;=20
ZeroMemory( &msg, sizeof(msg) );=20
msg.ulReserved =3D 0;=20
msg.lpszSubject =3D "Test email for MAPI bug\r\n";=20
msg.lpszNoteText =3D "This is a test email for the MAPI =
bug.\r\n";=20
msg.lpszMessageType =3D NULL;=20
msg.lpszDateReceived =3D NULL;=20
msg.lpszConversationID =3D NULL;=20
msg.flFlags =3D 0;=20
msg.lpOriginator =3D NULL;=20
msg.nRecipCount =3D 1;=20
msg.lpRecips =3D &recv;=20
msg.nFileCount =3D 0;=20
msg.lpFiles =3D NULL;=20
LPMAPISENDMAIL SendProc =3D =
(LPMAPISENDMAIL)GetProcAddress(hMapiLib,
"MAPISendMail");=20
return SendProc( NULL, 0, &msg, MAPI_LOGON_UI | MAPI_DIALOG, 0L =
);=20
}=20
#if defined(_OWLDLL)=20
int OwlMain( int, char*[] )=20
#else=20
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )=20
#endif=20
{=20
hMapiLib =3D LoadLibrary( "MAPI32.DLL" );=20
ULONG uRet =3D ExecuteMapi( );=20
FreeLibrary( hMapiLib );=20
return 0;=20
}=20
/////////////////////////////////////////////////////////////////////////=
///
///////////////////=20
Any help would be much appreciated,=20
Thanks=20
Jay B=20
________________________
Visit <http://www.aderant.com> http://www.aderant.com for information =
on
products and services.
Visit <http://support.aderant.com> http://support.aderant.com for
information on support.=20
|