GSwin.dll gswin32.dll 
Author Message
 GSwin.dll gswin32.dll

I having a few problems trying to use gswin2.dll, probably because I am a vb
programmer :-)I have edited it slightly below for brevity. This is a console
application and I am using Visual C++ from interdev running win98. This code
I kind of hacked together from dwmainc and the notes in dll.txt.

My problem is when I execute

code=pgsdll_init(m_lpfncallback, NULL, argc, argv);

It returns an error of 514.

Can anyone tell me what I have done wrong.

#include <stdio.h>
#include <string.h>
#include <windows.h>
#include "gsdll.h"

PFN_gsdll_init pgsdll_init;
PFN_gsdll_execute_begin pgsdll_execute_begin;
PFN_gsdll_execute_cont pgsdll_execute_cont;
PFN_gsdll_execute_end pgsdll_execute_end;
PFN_gsdll_exit pgsdll_exit;
PFN_gsdll_revision pgsdll_revision;

int FAR _export gsdll_callback(int message, char FAR *str, unsigned long
count){
    int retval = 0;
 switch (message)

   case GSDLL_STDIN:
                        /* Read more postscript from the buffer */
                        //buf += (retval = sprintf (str,
"%.*s",sizeof(str) - 1, buf));
    break;
   case GSDLL_STDOUT:
                        //printf ("%.*s", count, str);
                        return (int)count;
   case GSDLL_DEVICE:
   case GSDLL_SYNC:
   case GSDLL_PAGE:
   case GSDLL_SIZE:
   case GSDLL_POLL:                /* Do nothing for all other events */
            default:
    break;        }
 return retval;

Quote:
}

main()
{    
 int code=0;
 char buf[256];
 char *argv[5];
 int argc=0;
 HMODULE hmodule_gsdll;    
 GSDLL_CALLBACK      m_lpfncallback;
    long        version, versionDate;    
 char        *product, *copyright;  

 argv[0]="gswin32.exe";
 argv[1]="-Ic:\\gs5.10;C:\\gs5.10\\fonts";
 argv[2]=NULL;
 argc=2;
 /* Load DLL and retrieve the functions */

    if ((hmodule_gsdll = LoadLibrary("C:\\gs5.10\\gsdll32.dll")))    {
        pgsdll_init =(PFN_gsdll_init)GetProcAddress(hm
odule_gsdll,"gsdll_init");
  pgsdll_execute_begin =
(PFN_gsdll_execute_begin)GetProcAddress(hmodule_gsdll,"gsdll_execute_begin")
;
        pgsdll_execute_cont =
(PFN_gsdll_execute_cont)GetProcAddress(hmodule_gsdll,"gsdll_execute_cont");
        pgsdll_execute_end =
(PFN_gsdll_execute_end)GetProcAddress(hmodule_gsdll,"gsdll_execute_end");
        pgsdll_exit =
(PFN_gsdll_exit)GetProcAddress(hmodule_gsdll,"gsdll_exit");
        pgsdll_revision =
(PFN_gsdll_revision)GetProcAddress(hmodule_gsdll,"gsdll_revision");    }
   else {
        return -1;
   }    // check DLL version
    pgsdll_revision(&product, &copyright, &version, &versionDate);
 printf("Product=%s",product);
    m_lpfncallback
=(GSDLL_CALLBACK)MakeProcInstance((FARPROC)gsdll_callback, hInstance);

 code=pgsdll_init(m_lpfncallback, NULL, argc, argv);
 printf("gs_dll_init returns %i\n",code);

 switch (code){
   case  GSDLL_INIT_IN_USE:
    printf("DLL is in use");
    break;
   case 0:
    break; //OK
   default:
    printf("Another error has ocurred %d\n",code);
    break;
 }

  printf("gs_dll_init returns %02X\n",code);
  if (code==0){
 code=pgsdll_execute_begin();
 if(code==0){
  while (fgets(buf,sizeof(buf),stdin)){

   code=pgsdll_execute_cont(buf,strlen(buf));
   printf("gs_dll_cont returns %d\n",code);
                  if (code<0) break;
  }

 }
 if(!code){
  code=pgsdll_exit();
  printf("gs_dll returns %d\n",code);
 }

Quote:
}

    FreeLibrary(hmodule_gsdll);
return 0;
Quote:
}



Mon, 11 Sep 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. gswin32.dll from vb5

2. GSWin DLL

3. GSWin DLL

4. HELP, gswin, gswin32 (ghostscript3.33)

5. Problem printing in gswin32 vs gswin

6. running dll as http://server/dll?parameter

7. DLL as http://server/dll?parameter

8. API, DLL, AX-DLL

9. VB & DLL impmail.dll for outlook

10. VB & DLL impmail.dll in outlook

11. How to create object from .dll file? (more specific = WTSAPI32.DLL)

12. Compile DLL with VB, use in ASP - HOWTO avoid system reboot when modifying the DLL?

 

 
Powered by phpBB® Forum Software