Re: del not working in .bat file



Have tried now both with WSH and with the API, without a .bat file, but I can't make it work.

This is the API code, taken from Randy Birch's site:

Private Sub RunShell(cmdline As String, Optional lWindowStyle As Long)

Dim hProcess As Long
Dim ProcessId As Long
Dim exitCode As Long

'vbHide 0 - Window is hidden and focus is passed to the hidden window.
'vbNormalFocus 1 - Window has focus and is restored to its original size and position.
'vbMinimizedFocus 2 - Window is displayed as an icon with focus.
'vbMaximizedFocus 3 - Window is maximized with focus.
'vbNormalNoFocus 4 - Window is restored to its most recent size and position.
'The currently active window remains active.
'vbMinimizedNoFocus 6 - Window is displayed as an icon.
'The currently active window remains active.
'-------------------------------------------------------------------------------------

ProcessId = Shell(cmdline, lWindowStyle)
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)

Do
GetExitCodeProcess hProcess, exitCode
DoEvents
Loop While exitCode = STATUS_PENDING

CloseHandle hProcess

End Sub


And have run it like this:

RunShell strSQLiteEXE & " " & _
strFolder & "ReadCode.db <" & _
strFolder & "ReadCodeForSQLite.sql", vbHide

Either no file ReadCode.db gets created or strangely I get this file, but with a timestamp a few hours ago.
No idea what is going on there.


Also tried with WSH:

Set oShell = CreateObject("WSCript.Shell")

oShell.Run strSQLiteEXE & " ReadCode.db <ReadCodeForSQLite.sql", 1, True

Set oShell = Nothing


Looks simpler and neater, but same unpredictable result.
Also tried WSH with early binding, but same result.

When I use the API with the .bat file it runs fine, so maybe I need the .bat file and hopefully the API will
sort the wait out.


RBS


"Bob Butler" <tiredofit@xxxxxxxxxxx> wrote in message news:ufixfcODHHA.4404@xxxxxxxxxxxxxxxxxxxxxxx
"RB Smissaert" <bartsmissaert@xxxxxxxxxxxxxxxx> wrote in message
news:O1qsKQODHHA.952@xxxxxxxxxxxxxxxxxxxx
try running the sqllite command with
start /wait c:\....

Tried that now, but it just brings up the console window and nil else
happens.
Maybe just repeating the del command say 10 times will work.
Doesn't look very nice code though.

your best option is probably to lose the BAT file and use one of the various
"shell and wait" routines to run the sqllite command line.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."


.



Relevant Pages

  • Re: Shortcut
    ... > Based on your first suggestion of using a local .bat file to launch ... > database, I have created one and am successfully launching it. ... > open until the Access appliation window is closed or the Cmd Window ...
    (microsoft.public.access.security)
  • Re: File browser
    ... However, since the API isn't doing what I want, it was my interpretation of the other posts that it was _possible_ that the failure of the API to do what I wanted was due to the improper initialization. ... messages for a specific window handle are delivered only to the message pump running in the same thread that created the window handle. ... And Windows strictly enforces the rule about calling the window procedure; granted, the code that implements the procedure could always call it directly, but if you go through the normal PostMessage/SendMessage API that you're supposed to use, Windows will always cause the execution of the window procedure needed for handling those calls to happen on the same thread that created the window handle. ...
    (comp.lang.java.programmer)
  • Re: Error on Exit Sub
    ... this problem just came to our attention a few days ago; ... out any errors from the API call, he wasn't ready for me to start learning ... > determined you need to lock the window, you can achieve the same effect ... The control/form won't disappear, but its internal ...
    (microsoft.public.vb.general.discussion)
  • Learning Quartz API? Am I on the right track here?
    ... The purpose of the API is pretty simple, it just wraps up the platform ... specific details of instancing a window, ... So I'm asking here, #1 is it worth my time to worry about Quartz, ...
    (comp.sys.mac.programmer.help)
  • Re: Drag-and-drop from Windows Explorer?
    ... >that is not a function of delphi but of the win32 api. ... >to register the form as a window that will accept the ... >free the memory via the handle that was given you. ...
    (comp.lang.pascal.delphi.misc)