home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / WINLBSRC.ZIP / SETARGV0.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  818 b   |  37 lines

  1. /*------------------------------------------------------------------------
  2.  * filename - setargv0.c
  3.  *
  4.  * function(s)
  5.  *        _setargv0 - set argv[0] to program name
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1991, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16. #include <windows.h>
  17. #include <alloc.h>
  18. #include <_win.h>
  19.  
  20. #pragma warn -use
  21.  
  22. #define MAXFNAMELEN 80
  23.  
  24. extern unsigned _hInstance;
  25.  
  26. char _FAR *_argv0 = NULL;
  27.  
  28. static void _setargv0(void)
  29. {
  30.     _argv0 = malloc(MAXFNAMELEN+1);
  31.     if (_argv0 == NULL)
  32.         _errorExitBox("Out of memory in _setargv0", 3);
  33.     GetModuleFileName(_hInstance, _argv0, MAXFNAMELEN);
  34. }
  35.  
  36. #pragma startup _setargv0 9
  37.