www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/01/25/17:43:39

Date: Tue, 24 Jan 95 14:56:13 MST
From: deisher AT enws261 DOT eas DOT asu DOT edu (Michael E. Deisher)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Cc: deisher AT enws261 DOT eas DOT asu DOT edu
Subject: Re: what exactly is Windows support?

Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> wrote:
> DJGPP currently only supports program which run in DOS box under
> Windows.  This means, you cannot call any Windows DLLs from DJGPP
> program.  If your program does graphics, it won't currently work
> under Windows.
>
> > The software I am developing must run under MS Windows 3.1 without
> > flipping the display into text mode (i.e., it must run in the
> > "background").  Thanks in advance for any help anyone can give.
>
> I believe you can do this by defining a proper .PIF file for your
> program.  If your program only does text output, you can run it as
> ``windowed'' application as opposed to ``full-screen'' one.

Right, but I don't want any window to appear.

dj AT stealth DOT ctron DOT com (DJ Delorie) wrote:
> djgpp can produce programs that run in a Windows DOS box.  Whether
> it runs in the background or not is entirely up to Windows.

Thanks to all who responded for clearing up the term "Windows support"
for me.  If anyone is interested, code for my solution is below.  It
was compiled as a windows binary using MS C.  It allows programs
compiled with DJGPP to be launched from windows without flipping the
screen into text mode or popping up a window (an icon appears at the
bottom of the screen).  There must be a better way to do this.  If
anyone knows of one please e-mail me.  Thanks.

--Mike
deisher AT dspsun DOT eas DOT asu DOT edu

/* =========================================================================== */
/*
   File:    wlanch.c
   Date:    January 24, 1995
   Author:  Mike Deisher (deisher AT dspsun DOT eas DOT asu DOT edu)

   Description:  Launches a DOS application minimized.

   I wrote this because I wanted to launch a dos application (compiled with
   DJGPP) from a TCL/TK script without flipping the screen into text mode.
   There is probably a cleaner way to do this.  If you know of one, please
   e-mail me.
   
   Here's what worked for me.  1. Ran COFF2EXE on the DJGPP compiled program.
   2. Created a PIF file (using the MS-Windows PIF Editor), set the program
   name and path, chose "windowed", selected "background" execution, and set
   background priority to 100.  3. Called the PIF file from the TCL/TK script
   with "winexec wlaunch filename.pif".
*/
/* =========================================================================== */

#include<stdio.h>
#include<stdlib.h>
#include "windows.h"

/* =========================================================================== */

int PASCAL WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR args, int show)
{
  char msg[256];         /* message string */
  LPSTR filename;
  WORD  wReturn;
  
  if (args[0] != 0)
    filename = args;
  else
  {
    MessageBox((HWND)NULL,"No filename given","WLAUNCH",MB_ICONSTOP);
    return((int)1);
  } 
  
  wReturn = WinExec(filename, SW_SHOWMINNOACTIVE);
  
  if (wReturn < 32)
  {
    sprintf(msg, "WinExec failed:  error %d", wReturn);
    MessageBox((HWND)NULL, msg, "WLAUNCH", MB_ICONSTOP);
    return((int)wReturn);
  }
  
  return((int)wReturn);
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019