RE: Getting a complete file list from a removable disc into VFP

Author: Joe Yoder

Posted: 2011-02-18 at 20:37:05

Tracy and all,

I am trying to develop some competence with API calls so I setup a simple

bench mark and had the Performance tab on Task Manager up while I ran

several tests. Here is the test routine:

* Test DoAndWait performance

* Save the start time

m.StTm = VAL(SYS(2))

* Do the call - Uncomment the one being tested

?DoAndWait("c:\windows\system32\notepad.exe Contents.txt", "NOR")

*?DoAndWait("c:\windows\system32\cmd.exe /c dir c:\ /s", "HID")

*?DoAndWait("c:\windows\system32\cmd.exe /c dir c:\ /s>Contents.txt",

"HID")

* report the elapsed time

?ALLTRIM(STR(VAL(SYS(2)) - m.StTm)) + ' Seconds this run'

I tried the inkey(.1) both before and after the DO EVENTS line. I could

not tell any difference in the CPU utilization with or without the

inkey(.1) enabled in the code. The directory scan run durations were

also the same with or without the inkey(.1).

I was surprised to see that the directory redirected to a file ran in 5

or 6 seconds while the one going nowhere took 11 or 12 seconds.

I would be glad for an explanation of what is causing these results but a

grateful that I can at least achieve them now.

I stumbled across the "cmd.exe /c dir" syntax as a way to execute an

internal command but have never found any documentation about when this

is necessary. Where can I find this information?

It appears that one needs to convert long filenames to the 8.3 format

before passing them as parameters on a command line to the CreateProcess

routine. Is this something that applies to all API calls?

Thanks to all who helped me with this,

Joe

On Friday, February 18, 2011 6:08 PM, Tracy Pearson wrote:

>

>Date: Fri, 18 Feb 2011 18:08:05 -0500

>From: Tracy Pearson

>To: profoxtech@leafe.com

>cc:

>Subject: RE: Getting a complete file list from a removable disc into VFP

>

>Joe Yoder wrote on 2011-02-18:

>> Tracy,

>>

>> I believe every version of code I have looked at uses the routine

>> listed here. Can you be more specific about where the sleep or inkey

>> should be added?

>>

>> Thanks - Joe

>>

>

>Joe,

>

>With the DoEvents command, before or after.

>

>Tracy Pearson

>PowerChurch Software

>

>

>

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/4d5f1f01.c438e70a.7164.6a62@mx.google.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Joe Yoder