en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en nl en en en ru en en en en en en en en en de fr en en en en nl en en en en en en ilo en en en fr en en fr pt en en en en en en en nl en en en en en en en en en en en en en nl en en en en en en en en en en en en en en fr en en en en nl en en en en en en en fr en en fr pt en en en en en en en nl en en en en en en en en it en en en en nl vi en en en en en en en en it en en en en en en en en en en en nl en en en en en en en en en en en en en de en en en fr en en en en en en en en en pt en en en en en en
By logging into your account, you agree to our Privacy Policy, personal data processing and storage practices as described therein.
Forgot password or user name?
Search in titles only Search in PowerBASIC for Windows only
You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Can't get this code run under WinNT
All Time Today Last Week Last Month
All Discussions only Photos only Videos only Links only Polls only Events only
I've written a little PowerBASIC (I'm using PB5) Program for an Autostart Function on a CD with a Microsoft PowerPoint Presentation. Because of "relative Links" in this Presentation, I must start the PowerPoint Viewer with the full path in the command line.
My code works fine under Win9x/ME but I can't get it work under WinNT ?!?
Where's my mistake? (the Visual Basic Code works fine under NT, but not erveryone hast VB Runtime Files)
$compile exe "start.exe" FUNCTION WinMain (BYVAL hInstance AS LONG, BYVAL hPrevInstance AS LONG, lpCmdLine AS ASCIIZ PTR, BYVAL iCmdShow AS LONG) AS LONG if len(curdir$) = 3 then path$ = curdir$ else path$ = curdir$ + "\" end if x& = shell(path$ & "ppview32.exe " & Chr$(34) & path$ & "salestag 2000.ppt" & Chr$(34)) END FUNCTION 'This is the Visual BASIC Code: '------------------------------ 'Attribute VB_Name = "Module1" 'Sub Main() 'Dim apppath As String 'If Len(App.Path) = 3 Then 'apppath = App.Path 'Else 'apppath = App.Path & "\" 'End If 'Dim x As Long 'x = Shell(apppath & "ppview32.exe " & Chr(34) & apppath & "salestag 2000.ppt" & Chr(34)) 'End Sub
[This message has been edited by Sven Blumenstein (edited November 30, 2000).]
Join Date: Aug 1998
30 Nov 2000, 01:52 AM
Since you did not say what happens when you run this under NT, are you sure that the default (current) directory is where PPVIEW32.EXE the file exists?
ie, you may want to add a DIR$() test to confirm the path.
Add the following lines before the SHELL call, and see what is happening:
MSGBOX DIR$(path$ & "salestag 2000.ppt")
If this does not help, be sure to tell us *exactly* what fails.
One last point (and it is a long shot), but Windows itself provides a file called START.EXE so you *may* encounter a conflict caused by your AUTORUN.INF file launching the wrong START.EXE file...?!
Join Date: Jun 2002
30 Nov 2000, 02:00 AM
the Problem is that this Prog doesn't start the ppview32.exe. It runs until the shell statement and then -> ERROR. But without any error message. If I implemt an "on error goto errhand" then this catches the error.
And yes, the ppview32.exe and the ppt file are in the same directory. And, as I already sayed, with the Visual Basic Version it runs fine?!?
Join Date: Jun 2002
30 Nov 2000, 02:44 AM
I've found a solution
Here's my new code:
$compile exe "start.exe" $include "win32api.inc" FUNCTION WinMain (BYVAL hInstance AS LONG, BYVAL hPrevInstance AS LONG, lpCmdLine AS ASCIIZ PTR, BYVAL iCmdShow AS LONG) AS LONG if len(curdir$) = 3 then path$ = curdir$ else path$ = curdir$ + "\" end if 'old: 'x& = shell(chr$(34) + path$ + "ppview32.exe" + Chr$(34) + " " + chr$(34) + path$ + "salestag 2000.ppt" + Chr$(34)) '-------- 'new: retval& = ShellExecute(%null, "open", path$ + "ppview32.exe ", chr$(34) + path$ + "salestag 2000.ppt" + Chr$(34), "c:\", %SW_MAXIMIZE) END FUNCTION
The old code couldn't run under WinNT, 'cause the "SHELL" statement calls a DOS Function (I think) and this doesn't work under WinNT/2k.
With the ShellExecute API you can solve this Problem
Join Date: Aug 1998
30 Nov 2000, 03:57 AM
It cannot call a DOS function, since there is no DOS subsystem underneath a Win32 application.
Internally, SHELL uses ShellExecute()!
So, what was the actual error code you received? (You can test ERR after the SHELL statement, or use an ON ERROR GOTO trap)
The difference I see is that your call to ShellExecute() changes the path to a writable drive (default directory parameter is C:\ in your code), whereas your plain SHELL() code leaves the app running from in the CDROM directory. I don't know if this is contributary or not, but may be worth investigating. I don't have NT4 here to test with, sorry.
Join Date: Jun 2002
30 Nov 2000, 04:47 AM
I tested both codes on a local folder (c:\temp\autostart\) on a NT Computer. So you can't say, it depends on the "c:\".
I did some tests and find out, that the Shell() statement doesn't work on NT at all
You must always use ShellExecute "manually".
Join Date: Aug 1998
30 Nov 2000, 08:41 AM
I recall seeing that a long time ago too, hence I went to ShellExecute to do most of my shelling out...
I have two functions for doing shell, one waits until completion of the shell the other does shell execute:
Function WaitShell(ByVal CmdLine$, ByVal ShowWind&, ByVal TimeLimit&) Export As Long Local Si As STARTUPINFO Local Pi As PROCESS_INFORMATION Si.cb = SizeOf(Si) Si.dwFlags = %STARTF_USESHOWWINDOW Si.wShowWindow = ShowWind& If CreateProcess("", _ ByVal StrPtr(CmdLine$), _ ByVal %NULL, _ ByVal %NULL, _ 0, _ %NORMAL_PRIORITY_CLASS, _ ByVal %NULL, _ ByVal %NULL, _ Si, _ Pi) Then Call WaitForInputIdle(pi.hProcess, %INFINITE) If TimeLimit& Then Call WaitForSingleObject(pi.hProcess, TimeLimit&) Call CloseHandle(pi.hProcess) Call CloseHandle(pi.hThread) End If End If Function = 1 End Function '------------------------------------------------------------------------------------------ Function NoWaitShell(FileSpec As String,wWindowStyle As Long) Export As Long '%SW_SHOWNORMAL Function = ShellExecute(ByVal %NULL, "open", FileSpec + Chr$(0), ByVal %NULL, ByVal %NULL,wWindowStyle) End Function
True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
Join Date: Jun 1999
30 Nov 2000, 09:30 AM
SHELL works fine in tests under Windows 98, 2000, and NT4 SP6a, here,
with the obsolete PB/DLL 5.0 compiler as well as current versions.
If you can find a case where SHELL fails, please send a brief source
code example to [email protected]
Copyright © 1998-2022 PowerBASIC Tools, LLC - All Rights Reserved.
Powered by vBulletin® Version 5.7.0
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
All times are GMT-5. This page was generated at 09:47 PM.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.