TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: David Sparrman
from: Daniel Morgan
date: 1996-05-31 10:18:22
subject: Calling MSGAPI from Pascal

David Sparrman wrote in a message to All:
 DS> Is there anyone out there that can give me some help to get started
 DS> using MSGAPI32.DLL from Pascal?
You might want to try using one of the LIBraries, or compile MSGAPI
yourself.  Many libraries and source code is included with the Squish
Developers Kit.  I couldn't figure out how to use the MSGAPI.DLL  Then
again, I guess you can't use OS/2 DLLs in Windows and vice-versa.  :(
 DS> I have the archive SQDEV200.ZIP which has all necessary headers to
 DS> use MSGAPI32.DLL in C programs. The problem is that I am not
 DS> confident with C, and haven't used it since 1986.

 DS> To use this .DLL from Pascal, I suppose one will have to translate
 DS> some .h files (at least MSGAPI.H) - but that should be no problem.
Good Luck!  The headers for Squish are complex.  It is best to learn C
again to use the msgapi.  However, there is documentation that describes in
detail the structure layout of the Squish format and how to access it.  In
the SQDEV documenation, it says you may need to access it directly and not
through the MSGAPI since the API was intended for C.
 DS> The simplest possible program using MSGAPI would be something like:

 DS>   * Calling MsgOpenApi
 DS>   * Calling MsgCloseApi

#include "msgapi.h"

int InitMsgApi(int DefaultZone);
int TerminateMsgApi(void);

int main(void)
{
   int DefaultFidonetZone = 1;
   int MsgApiRes;
   
   MsgApiRes = InitMsgApi(DefaultFidonetZone);
   if(MsgApiRes != 0)
   {
      printf("MsgApiInit failure.\n");
      return 0; 
   }
   printf("MsgApiInit success.\n");
   (void) TerminateMsgapi();
   return 0;
}

int InitMsgApi(int DefaultZone)
{
  struct _minf minf;

  minf.req_version = 1; /* the required msgapi version for your program */
  minf.def_zone    = DefaultZone;
                /* default fidonet zone */
  /* minf.haveshare   = 1; You do not assign haveshare */

/*  These are function pointers to memory functions you care to use
 *  within msgapi, if the function pointer is NULL, then the msgapi will
 *  use its own internal memory functions. 
 */

  minf.palloc      = 0x0L;
  minf.pfree       = 0x0L;
  minf.repalloc    = 0x0L;
  minf.farpalloc   = 0x0L;
  minf.farpfree    = 0x0L;
  minf.farrepalloc = 0x0L;

  return MsgOpenApi(&minf);
}

int TerminateMsgApi(void)
{
  return MsgCloseApi();
}

 - Daniel Morgan 
--- timEd/2 1.10
* Origin: Silver Sun BBS (1:376/194)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1
@PATH: 376/194 178 3615/50 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.