Mitsules, Mark S. (Newport News)
Mark.Mitsules at ngc.com
Fri May 7 12:02:12 CDT 2004
This was to be my approach exactly, but, while beta-testing a form-launched deployment (as opposed to an AutoExec macro), users acknowledged that the feedback was welcome. It was suggested that the "silent install" might cause concern for users that noticed both processes activating without any kind of indication as to why. Mark -----Original Message----- From: Jürgen Welz [mailto:jwelz at hotmail.com] Sent: Friday, May 07, 2004 12:41 PM To: accessd at databaseadvisors.com Subject: RE: [AccessD] ShellExecute / Application.Quit I have not experienced this problem. Perhaps a call to Sleep API for 50 milliseconds? Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Perhaps a DoEvents before/after the call to Sleep? Ciao Jürgen Welz Edmonton, Alberta jwelz at hotmail.com >From: "Mitsules, Mark S. (Newport News)" <Mark.Mitsules at ngc.com> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: "'Access Developers discussion and problem >solving'"<accessd at databaseadvisors.com> >Subject: RE: [AccessD] ShellExecute / Application.Quit >Date: Fri, 7 May 2004 09:05:12 -0400 MIME-Version: 1.0 >Received: from mc12-f22.hotmail.com ([65.54.167.158]) by >mc12-s17.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Fri, 7 May 2004 >06:06:59 -0700 >Received: from databaseadvisors.com ([209.135.140.44]) by >mc12-f22.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Fri, 7 May 2004 >06:06:04 -0700 >Received: from databaseadvisors.com (databaseadvisors.com >[209.135.140.44])by databaseadvisors.com (8.11.6/8.11.6) with ESMTP id >i47D5iQ04616;Fri, 7 May 2004 08:05:44 -0500 >Received: from xcgmd812.northgrum.com >(xcgmd812.northgrum.com[155.104.240.108])by databaseadvisors.com >(8.11.6/8.11.6) with ESMTP id i47D5fQ04569for ><accessd at databaseadvisors.com>; Fri, 7 May 2004 08:05:41 -0500 >Received: by xcgmd812 with Internet Mail Service (5.5.2656.59)id ><KLQMV9DB>; Fri, 7 May 2004 06:05:22 -0700 >Received: from xcgmd805.northgrum.com ([155.104.117.53]) >byxcgmd805.northgrum.com with SMTP (Microsoft Exchange InternetMail Service >Version 5.5.2653.13)id K31986ZD; Fri, 7 May 2004 06:04:44 -0700 >Received: from xcgva080 ([172.30.18.153]) by 155.104.117.53 with >InterScanMessaging Security Suite; Fri, 07 May 2004 06:04:43 -0700 >Received: from npeimc02.nns.com ([172.30.18.167]) by xcgva080 with >InterScanMessaging Security Suite; Fri, 07 May 2004 09:05:14 -0400 >Received: by npeimc02.nns.com with Internet Mail Service (5.5.2657.72)id ><KLPPA405>; Fri, 7 May 2004 09:05:13 -0400 >X-Message-Info: NDMZeIBu+soD+00CmSqloiEfVNPHZPEbvx0NF0JIN1E= >Message-ID: <D3E2A213B8F45B4DAC92EB5FD98ED1EF010EBBF0 at nnse14.nns.com> >X-Mailer: Internet Mail Service (5.5.2657.72) >X-BeenThere: accessd at databaseadvisors.com >X-Mailman-Version: 2.1.4 >Precedence: list >List-Id: Access Developers discussion and problem >solving<accessd.databaseadvisors.com> >List-Help: <mailto:accessd-request at databaseadvisors.com?subject=help> >List-Post: <mailto:accessd at databaseadvisors.com> >List-Subscribe: ><http://databaseadvisors.com/mailman/listinfo/accessd>,<mailto:accessd-requ est at databaseadvisors.com?subject=subscribe> >List-Archive: <http://databaseadvisors.com/pipermail/accessd> >List-Unsubscribe: ><http://databaseadvisors.com/mailman/listinfo/accessd>,<mailto:accessd-requ est at databaseadvisors.com?subject=unsubscribe> >Errors-To: accessd-bounces at databaseadvisors.com >Return-Path: accessd-bounces at databaseadvisors.com >X-OriginalArrivalTime: 07 May 2004 13:06:04.0932 (UTC) >FILETIME=[0DE5BC40:01C43434] > >Maybe the problem is I'm trying to use the wrong method for my purposes? >This is not a situation where I need to shell out, perform a task, and >return. My problem is that I'm using a .mdb as a launcher app. I want to >shell out to launch another .mdb and immediately close the launcher app. >All of my code works...except if I try to run it from an AutoExec macro. >My >current work-around is to utilize a splash screen with a single OK >button...this works, but adds a few unnecessary seconds that I was trying >to >avoid. Ironically, it was because of this work-around that I found, in >testing, that 2-3% of the users drive mappings are not configured to >departmental standards....well actually they are, it's just that they are >technically in another department and on-loan to us. > > > >Mark > > > >-----Original Message----- >From: Gustav Brock [mailto:gustav at cactus.dk] >Sent: Friday, May 07, 2004 8:24 AM >To: Access Developers discussion and problem solving >Subject: Re: [AccessD] ShellExecute / Application.Quit > > >Hi Mark > > > The different versions of ShellWait utilize the API call CreateProcessA > > instead of ShellExecuteA. I can't seem to get CreateProcessA to open > > anything...yet no errors are returned. Is CreateProcessA like >ShellExecuteA > > in that as long as I pass a valid path/filename with a registered >extension, > > it will automagically do its thing? ...because it isn't:( > >It's hard to tell why it fails without knowing more. >But here's another approach - I can't remember where I got it: > ><code> > >Option Compare Database >Option Explicit > >Private Const SYNCHRONIZE = &H100000 > >' Wait forever. >Private Const INFINITE = &HFFFF >' The state of the specified object is signaled. >Private Const WAIT_OBJECT_0 = 0 >' The time-out interval elapsed and the object?s state is nonsignaled. >Private Const WAIT_TIMEOUT = &H102 > >Private Declare Function OpenProcess Lib "kernel32" ( _ > ByVal dwDesiredAccess As Long, _ > ByVal bInheritHandle As Long, _ > ByVal dwProcessId As Long) _ > As Long > >Private Declare Function WaitForSingleObject Lib "kernel32" ( _ > ByVal hHandle As Long, _ > ByVal dwMilliseconds As Long) _ > As Long > >Private Declare Function CloseHandle Lib "kernel32" ( _ > ByVal hObject As Long) _ > As Long > >' The WaitForSingleObject function returns when one of the following >occurs: >' - The specified object is in the signaled state. >' - The time-out interval elapses. >' >' The dwMilliseconds parameter specifies the time-out interval, in >milliseconds. >' The function returns if the interval elapses, even if the object?s state >is >' nonsignaled. If dwMilliseconds is zero, the function tests the object?s >state >' and returns immediately. If dwMilliseconds is INFINITE, the function?s >time-out >' interval never elapses. >' >' This example waits an INFINITE amount of time for the process to end. As >a >' result this process will be frozen until the shelled process terminates. >The >' down side is that if the shelled process hangs, so will this one. >' >' A better approach is to wait a specific amount of time. Once the time-out >' interval expires, test the return value. If it is WAIT_TIMEOUT, the >process >' is still not signaled. Then you can either wait again or continue with >your >' processing. >' >' DOS Applications: >' Waiting for a DOS application is tricky because the DOS window never goes >' away when the application is done. To get around this, prefix the app >that >' you are shelling to with "command.com /c". >' >' For example: lngPid = Shell("command.com /c " & strCommand.Text, >vbNormalFocus) > >Function ShellWait( _ > ByVal strCommand As String) _ > As Boolean > > Dim lngPid As Long > Dim lngHnd As Long > Dim lngReturn As Long > Dim booSuccess As Boolean > > If Len(Trim$(strCommand)) > 0 Then > lngPid = Shell(strCommand, vbNormalFocus) > If lngPid <> 0 Then > ' Get a handle to the shelled process. > lngHnd = OpenProcess(SYNCHRONIZE, 0, lngPid) > ' If successful, wait for the application to end and close the >handle. > If lngHnd <> 0 Then > lngReturn = WaitForSingleObject(lngHnd, INFINITE) > CloseHandle (lngHnd) > booSuccess = True > End If > MsgBox "Just terminated.", vbInformation, "Shelled Application" > End If > End If > > ShellWait = booSuccess > >End Function > ></code> > >Beware of line breaks. > >/gustav > >-- >_______________________________________________ >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com >-- >_______________________________________________ >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com _________________________________________________________________ http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=htt p://hotmail.com/enca&HL=Market_MSNIS_Taglines -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com