Page 1 of 1

Possible, to hide a DOS-Box running a BAT- or SCRIPT-file ?

Posted: Thu Nov 20, 2008 4:06 pm
by ukoenig
Hello,

When running a batch- or script-file, you will see a DOS-window on screen.
Is it possible to hide this ?

Regards
Uwe :lol:

Posted: Thu Nov 20, 2008 5:05 pm
by James Bott
Uwe,

Maybe this will help.

James

Code: Select all

#include "Fivewin.ch"


#define SW_HIDE		    0
#define SW_SHOWNORMAL	    1
#define SW_NORMAL	    1
#define SW_SHOWMINIMIZED    2
#define SW_SHOWMAXIMIZED    3
#define SW_MAXIMIZE	    3
#define SW_SHOWNOACTIVATE   4
#define SW_SHOW		    5
#define SW_MINIMIZE	    6
#define SW_SHOWMINNOACTIVE  7
#define SW_SHOWNA	    8
#define SW_RESTORE          9


FUNCTION MAIN()

  SHELLEXECUTE( 0, "open", "http://www.mysite.com", 0, 0, SW_NORMAL )

RETURN NIL

Posted: Thu Nov 20, 2008 7:21 pm
by Antonio Linares
Uwe,

You can also use:

WinExec( "mybat.bat", SW_HIDE )

Hide DOS-window

Posted: Thu Nov 20, 2008 7:41 pm
by ukoenig
Thank You very much Antonio, James

I changed the source this way :

Save a JPG-file to BMP with new size :
(2)->EXTENSION) is the desired destination-format.
The format of the original file is automatic detected.

Code: Select all

newFORMAT := c_Path +"\image\" + cIMAGE 

cCONVERT := "NCONVERT -quiet -out " + ALLTRIM( (2)->EXTENSION) + " -resize " + ;
ALLTRIM(str(nWidth)) + " " + ALLTRIM(str(nHeight)) + " &newFORMAT "

WINEXEC ( "&cCONVERT", 0 )
It works great. The DOS-box is hidden !

The next step will be a script-editor, because i don't know,
what the user wants to do with the selected image.

1. select the image from the project-database.
2. open the convert-dialog and choose the export-format and size.
3. open the script-browser to choose what to do with the image.

To convert and resize is just a small selection of the things
are possible. Adjust Brightness, flip and rotate, changing colors ...
everything is possible.

All what we need to do is : WINEXEC ( "&cCONVERT", 0 )
cCONVERT will be the script we choose from the database.

Regards
Uwe :lol:

Posted: Fri Nov 21, 2008 1:48 pm
by Rochinha
Friend,

Use my solution:

Code: Select all

/*
 *
 * TOLEAuto and Activex
 * Jose Carlos da Rocha
 *
 */
#include "FiveWin.ch"

function Main()

   local fn := Array(5)
   oCopyImage := TOleAuto():New( "CopyImage.CopyImage.1" )

   ep := cFilePath( GetModuleFileName( GetInstance() ) )
   
   fn[1] = "wmf"
   fn[2] = "bmp"
   fn[3] = "png"
   fn[4] = "jpeg"
   fn[5] = "wbmp"
   
   For i = 1 To 5
      oCopyImage:Type := i
      oCopyImage:CopyFile(ep + "coins.gif" , ep + "coins75." + fn[i], 50, 50)
      oCopyImage:CopyFile(ep + "eckler.bmp", ep + "eckler120." + fn[i], 120, 120)
   Next

   return nil
http://www.5volution.com/forum/CopyImage.zip