Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 16 OCT 2001 02:41:24AM Paul Rule wrote:

I know this has come up before but I can't find the solution, so..

If using windows 95/98 you can access a word or excel document simply

val=UTILITY("RUNWIN","START DOCNAME.DOC")

But in Windows 2000 that doesn't work.

I'm currently using

word.path=C:\PROGRA~1\MICROS~2\OFFICE\WINWORD.EXE"

val=UTILITY("RUNWIN", word.path:" DOCNAME.DOC")

Which works fine except that you need to know the path for WINWORD.EXE or EXCEL etc and its not very dynamic.

I've tried various combinations of START, CALL, COMMAND /C and a few other stabs in the dark.

Does anyone know how to do this.

Cheers

Paul


At 16 OCT 2001 07:10AM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:

At 16 OCT 2001 06:42PM Paul Rule wrote:

Thanks. I'm hoping that that link contains the answer. Unforuntately (for me) its in the Works section which I'm not a member of. I'm having a really hard time convincing my management to pay for a works subscription.

You know how it goes, they expect miracles but when it comes to paying for you to learn how to perform them…..


At 17 OCT 2001 01:54AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

Paul,

Here's the lowdown on ShellExecute taken from our Knowledge Base.

This is a Windows API function that may be used in place of WinExec
and Utility("RUNWIN")

This is the ShellExecute function that is exported from SHELL.DLL, and
has the advantage that it recognises the association between document 
files and their associated executable files as defined in the Windows
Registry.

The function is defined in the Windows SDK as:

HINSTANCE ShellExecute(hwnd, lpszOp, lpszFile, lpszParams, lpszDir, fsShowCmd)

HWND hwnd;         /* handle of parent window	                       */
LPCSTR lpszOp;	   /* address of string for operation to perform       */
LPCSTR lpszFile;   /* address of string for filename	               */
LPCSTR lpszParams; /* address of string for executable-file parameters */
LPCSTR lpszDir;	   /* address of string for default directory	       */
int fsShowCmd;	   /* whether file is shown when opened	               */

The ShellExecute function opens or prints the specified file. 

Parameter	Description
=========	===========

hwnd		Identifies the parent window. This window receives any
		message boxes an application produces (for example, for 
		error reporting). 
lpszOp		Points to a null-terminated string specifying the operation 
		to perform. This string can be "open" or "print". If this 
		parameter is NULL, "open" is the default value. 
lpszFile	Points to a null-terminated string specifying the file to 
		open. 
lpszParams	Points to a null-terminated string specifying parameters 
		passed to the application when the lpszFile parameter 
		specifies an executable file. If lpszFile points to a 
		string specifying a document file, this parameter is NULL. 
lpszDir		Points to a null-terminated string specifying the default
		directory. 
fsShowCmd	Specifies whether the application window is to be shown 
		when the application is opened. This parameter can be one
		of the following values: 

		Value			Meaning
		=====			=======

		SW_HIDE (0)		Hides the window and passes activation
					to another window. 
		SW_MINIMIZE (6)		Minimizes the specified window and 
					activates the top-level window in 
					the system's list. 
		SW_RESTORE (9)		Activates and displays a window. If the
					window is minimized or maximized, 
					Windows restores it to its original 
					size and position (same as SW_SHOWNORMAL). 
		SW_SHOW(5)		Activates a window and displays it in its
					current size and position. 
		SW_SHOWMAXIMIZED(3)	Activates a window and displays it 
					as a maximized window. 
		SW_SHOWMINIMIZED(2)	Activates a window and displays it
					as an icon. 
		SW_SHOWMINNOACTIVE(4)	Displays a window as an icon. The 
					window that is currently active remains
					active. 
		SW_SHOWNA(8)		Displays a window in its current state.
					The window that is currently active
					remains active. 
		SW_SHOWNOACTIVATE(7)	Displays a window in its most recent
					size and position. The window that is
					currently active remains active. 
		SW_SHOWNORMAL(1)	Activates and displays a window. If 
					the window is minimized or maximized, 
					Windows restores it to its original size 
					and position (same as SW_RESTORE). 


Returns
=======

The return value is the instance handle of the application that was opened 
or printed, if the function is successful. (This handle could also be the 
handle of a DDE server application.) A return value less than or equal to 
32 specifies an error. The possible error values are listed in the 
following Comments section. 

Errors

The ShellExecute function returns the value 31 if there is no association
for the specified file type or if there is no association for the specified
action within the file type. The other possible error values are as follows: 

Value	Meaning
=====	=======

0	System was out of memory, executable file was corrupt, or 
	relocations were invalid. 
2	File was not found. 
3	Path was not found. 
5	Attempt was made to dynamically link to a task, or there 
	was a sharing or network-protection error. 
6	Library required separate data segments for each task. 
8	There was insufficient memory to start the application. 
10	Windows version was incorrect. 
11	Executable file was invalid. Either it was not a Windows
	application or there was an error in the .EXE image. 
12	Application was designed for a different operating system. 
13	Application was designed for MS-DOS 4.0. 
14	Type of executable file was unknown. 
15	Attempt was made to load a real-mode application (developed
	for an earlier version of Windows). 
16	Attempt was made to load a second instance of an executable
	file containing multiple data segments that were not marked
	read-only. 
19	Attempt was made to load a compressed executable file. The
	file must be decompressed before it can be loaded. 
20	Dynamic-link library (DLL) file was invalid. One of the DLLs
	required to run this application was corrupt. 
21	Application requires Microsoft Windows 32-bit extensions. 

Comments
========

The file specified by the lpszFile parameter can be a document file 
or an executable file. If it is a document file, this function opens
or prints it, depending on the value of the lpszOp parameter. If it
is an executable file, this function opens it, even if the string
"print" is pointed to by lpszOp. 

Prototyping for use in OpenInsight
==================================

To prototype this function the following lines needs addign to a
DLL_SHELL record in SYSPROCS

USHORT PASCAL ShellExecute( USHORT, LPCHAR, LPCHAR, LPCHAR, LPCHAR, SHORT )

Example
=======

hWnd		=	0
lpOperation	=	'print' : \00\
lpFileName	=	''MYDOC.RTF' : \00\	; * //	Your file name here.....
lpParams	=	\00\	
lpDir		=	\00\
iShow		=	2			; * //	Minimised...

RetVal		=	ShellExecute( hWnd, lpOperation, lpFileName, lpParams, lpDir, iShow )

or,

lpFileName	=	"WINWORD.EXE" : \00\
lpParams	=	"MYDOC.RTF" : \00\
lpDir		=	"MSOFFICE\WINWORD" : \00\	;  * //	Or your word directory where WINWORD lives

The Sprezzatura Group

World leaders in all things RevSoft

www.sprezzatura.com_zz.jpg


At 17 OCT 2001 09:46PM Paul Rule wrote:

Thanks for the info. It looks just like what I'm after.

I'm having a bit of a problem getting it to work though.

I created a short test program using your example (with my file names)

When I run it I get Non Numeric data when numeric required on the line that says retval=shellexecute(hwnd,op,file,params,dir,show)

I created a record in SYSPROCS called SHELL_DLL with the following contents.

SHELL

USHORT PASCAL ShellExecute( USHORT, LPCHAR, LPCHAR, LPCHAR, LPCHAR, SHORT)

Is this correct? Is this all that needs to be done. Is there any compilation required or repository entries needed etc.

Cheers

Paul


At 18 OCT 2001 02:08AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

Paul,

In the example hwnd should be 0 not "".

Regards

The Sprezzatura Group

World leaders in all things RevSoft

www.sprezzatura.com_zz.jpg


At 18 OCT 2001 03:38AM Oystein Reigem wrote:

Paul,

You must do

run Declare_Fcns "SHELL_DLL"

And log in again, I think.

Btw - prototype records are usually named DLL_something and not something_DLL, but that's probably not important.

- Oystein -


At 18 OCT 2001 06:39PM Paul Rule wrote:

Thanks Oystein & Sprezz. That did the trick. My test program now works. Now to try it on a few different operating systems, 95/98/2000.

Regards

Paul

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/33785990a7639a9385256ae70024c023.txt
  • Last modified: 2024/01/04 21:00
  • by 127.0.0.1