delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/01/20:15:55

From: "A. Sinan Unur" <sinan DOT unur AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Setting DOS box title under Win95
Date: Thu, 01 Jan 1998 19:28:57 -0500
Organization: Cornell University (http://www.cornell.edu/)
Lines: 79
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <34AC34C8.5169384F@cornell.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 971229101217 DOT 27720D-100000 AT is> <EM4Ets DOT IrD AT fsa DOT bris DOT ac DOT uk>
NNTP-Posting-Host: cu-dialup-0046.cit.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Rich Dawe wrote:
> 
> : >     /* Allocate some DOS memory */
> : >     alloc_seg = __dpmi_allocate_dos_memory(APP_TITLE_BUFFER_PARA,
> : > &alloc_desc);
> : >     if (alloc_seg == -1) return(-1);
> :
> Eli Zaretskii (eliz AT is DOT elta DOT co DOT il) wrote:
> : You might have saved some work here by using the DJGPP transfer
> : buffer.  It is already allocated for you and is at least 2KB-long,
> : (usually 16KB) which should be more than enough for getting the title.

Rich Dawe wrote:
> I tried this but it didn't seem to work. This did work, so I went
> with it. I might try using the transfer buffer again. Thank you.

here's the code i posted for the original request. using the transfer
buffer works fine:

/*
 * apptitle.c
 * routine to demonstrate how to change the title bar of the ms-dos
window
 * in windows 95
 * info taken from Ralph Brown's Interrupt List
 * INT 2F 168E - Windows95 - TITLE - SET APPLICATION TITLE
 *
 * by A. Sinan Unur
 * 12/10/97
 * note that this code comes with absolutely no warranties of any kind
 * try it at your own risk.
 */
 
#include <dos.h>
#include <dpmi.h>
#include <go32.h>
#include <string.h>
#include <sys/movedata.h>

#define RM_SEG(x) ( (unsigned short) ((x) >> 4) )
#define RM_OFF(x) ( (unsigned short) ((x) & 0xF) )

int set_app_title(const char *p, int len)
{
  __dpmi_regs r;

  memset(&r, 0, sizeof(r));

  movedata(_my_ds(), (unsigned) p, _dos_ds, __tb, len);
	
  r.x.ax = 0x168e;
  r.x.dx = 0x0000;
  r.x.di = RM_OFF(__tb);
  r.x.es = RM_SEG(__tb);

  return __dpmi_int(0x2f, &r);
}

int main(int argc, char* argv[])
{
  int i;

  delay(5);
  for(i=0; argv[i] != NULL; i++)
  {
    set_app_title(argv[i], strlen(argv[i])+1);
    delay(2000);
  }

  return 0;
}
-- 
----------------------------------------------------------------------
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA

mailto:sinan DOT unur AT cornell DOT edu
http://www.people.cornell.edu/pages/asu1/

- Raw text -


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