home *** CD-ROM | disk | FTP | other *** search
- @echo OFF
- REM ******************************************************************
- REM *** DoWinFax.cmd - Control WINFAX that is running in a Windows ***
- REM *** ver.2 session that is controlled by the CEnvi ***
- REM *** for Windows script WinSpawn.cmm that is ***
- REM *** running under the name: WINFAX: ***
- REM ******************************************************************
-
- CEnvi %0.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9
- GOTO CENVI_EXIT
-
- #include <WinSpawn.lib>
-
- FullPathName;
-
- main(argc,argv)
- {
- FullPathName = FullPath(argv[0]);
-
- success = True;
- if ( 2 == argc ) {
- if ( !stricmp("START",argv[1]) )
- SpawnCode(FullPathName,"START",True);
- else if ( !stricmp("END",argv[1]) )
- SpawnCode(FullPathName,"MENU",True,`SelectSystemMenuItem("Close");`);
- else if ( !stricmp("GOIDLE",argv[1]) )
- SpawnCode(FullPathName,"DDE",True,`Execute('["GoIdle"]');`);
- else if ( !stricmp("GOACTIVE",argv[1]) )
- SpawnCode(FullPathName,"DDE",True,`Execute('["GoActive"]');`);
- else
- success = False;
- } else if ( 3 == argc ) {
- if ( !stricmp("MENU",argv[1]) ) {
- sprintf(MenuCode,"SelectMenuItem(\"%s\");",argv[2]);
- SpawnCode(FullPathName,"MENU",True,MenuCode);
- } else if ( !stricmp("SYSMENU",argv[1]) ) {
- sprintf(MenuCode,"SelectSystemMenuItem(\"%s\");",argv[2]);
- SpawnCode(FullPathName,"MENU",True,MenuCode);
- } else
- success = False;
- } else {
- success = False;
- }
- if ( !success ) {
- printf("\aUnrecognized command.\n");
- Instructions();
- }
- }
-
-
- Instructions()
- {
- puts(``)
- puts(`DoWinFax - Control WINFAX through WinSpawn.cmm WINFAX session`)
- puts(``)
- puts(`SYNTAX: DoWinFax <command>`)
- puts(``)
- puts(`WHERE: command may be:`)
- puts(` START - Start winfax running minimized`)
- puts(` END - End winfax`)
- puts(` GOIDLE - Tell WINFAX to go idle via DDE`)
- puts(` GOACTIVE - Tell WINFAX to go active via DDE`)
- puts(` MENU <command> - Send WINFAX menu command`)
- puts(` SYSMENU <command> - Send WINFAX system menu command`)
- puts(``)
- puts(`NOTE: CEnvi for Windows WINSPAWN must be running WINFAX session, example:`)
- puts(` start /WIN F:\CENVIW\CEnvi.exe E:\CENVI2\WinSpawn.cmm WINFAX 1500`)
- puts(``)
- }
-
- SpawnCode(pSourceFile,pSourceKey,pWait,pCode)
- {
- sprintf(SpawnCmd,
- "CEnvi #include '%s,,,*** %s BEGIN ***,*** %s END ***'\n"
- "%s\n",
- pSourceFile,pSourceKey,pSourceKey,
- 3 < va_arg() ? pCode : "");
- WinSpawn("WINFAX",pWait ? WIN_SPAWN_WAIT : WIN_SPAWN,
- SpawnCmd);
- }
-
- :CENVI_EXIT
- GOTO DOWINFAX_EXIT
-
- *** START BEGIN ***
-
- #include "WinExec.lib"
- #define EXECUTE_NAME "FAXMNG"
- WinExec(EXECUTE_NAME,SW_MINIMIZE);
-
- *** START END ***
-
-
- *** MENU BEGIN ***
-
- #include "WinTools.lib"
- #include "MenuCtrl.lib"
-
- #define WINDOW_TITLE "WINFAX"
-
- SelectMenuItem(item)
- {
- if ( Hwnd = GetWindowHandle(WINDOW_TITLE) ) {
- MenuCommand(Hwnd,item);
- }
- }
-
- SelectSystemMenuItem(item)
- {
- if ( Hwnd = GetWindowHandle(WINDOW_TITLE) ) {
- SystemMenuCommand(Hwnd,item);
- }
- }
-
- *** MENU END ***
-
-
- *** DDE BEGIN ***
-
- #include "DDEcli.lib"
-
- #define APPLICATION "FAXMNG"
- #define TOPIC "CONTROL"
-
- Execute(command)
- {
- // initialize DDE connection
- dde.Application = APPLICATION;
- dde.Topic = TOPIC;
- if ( ConnectToServer(dde) ) {
- DdeExecute(dde,command);
- DisConnectFromServer(dde);
- }
- }
-
- *** DDE END ***
-
-
- :DOWINFAX_EXIT