Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] launching an application containing environment variables

Hello,
 
I'm trying to launch an application containig an environment variable:
 
comparison_tool=%TS_LOCAL%/xml/xmlcompare1.0/Compare_index.html
The program.launch(comparison); instruction can't work with local variables.
 
The solution is down.
 
        if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
         
         int hHeap = OS.GetProcessHeap ();
         TCHAR buffer = new TCHAR (0, fileName, true);
         int byteCount = buffer.length () * TCHAR.sizeof;
         int lpFile = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
         OS.MoveMemory (lpFile, buffer, byteCount);
         
         SHELLEXECUTEINFO info = new SHELLEXECUTEINFO ();
         info.cbSize = SHELLEXECUTEINFO.sizeof;
         info.lpFile = lpFile;
         info.nShow = OS.SW_SHOW;
 ----->        info.fMask = 0x200; //SEE_MASK_DOENVSUBST  <-----
         
         boolean result = OS.ShellExecuteEx (info);
          
         if (lpFile != 0) OS.HeapFree (hHeap, 0, lpFile);
           
           
adding this line in the launch() method could make it work and make me happy.
 Is this a missing feature ?
 
I wish a great new year 2005!
Laurentia

Back to the top