Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Fully Kill Recursive Function


Hi all,

I have a bit of a problem with a recursive function. Basically what the function does is search for files, I used some code from an FAQ or post here on vbcity and it works very well. Below is the definition, you may know the funciton i mean from it.

Code:
Function GetAllFiles(ByVal path As String, ByVal filespec As String, _
    Optional RecurseDirs As Boolean) As Collection


Basically in my program you click a button on the main form and a dialog box pops up, with a listview and 2 buttons on it. You then choose to browse for a file (common dialog box etc...) or search for a file. The search for a file button opens another dialog box with a listview and search buttons and you type your search in and then the search begins. It prints any matching files into a listview. You then select which files you want and click another button, which adds the selected items to the first dialog box's listview. You can click OK and the dialog will close and you will see all the files you picked. This works fine.

The problem occurs when you dont wait for the search to end. There are DoEvents commands in parts of the recursive search function so the listview will show a file as it is found. This also means you can select it and add it whilst the search is still running (which is good, i want this). However you can also click ok and go back to see the files you've selected, but the search is still running. If you quit the program, it will still remain in task manager. I want the search to stop the minute OK is clicked (the only code for ok at the moment is unload me). Any ideas how you can do this, if at all?

One other thing, if I click ok whilst a search is running, and the dialog closes, and then I click search again to open the dialog back up, it will display any matches it finds as the previous search runs (ie ones that were not shown before, new ones that the halfway through search finds)

All help much appreciated

Dan




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
I Don't Fully Understand The SHFileOperation Function.
How can I use this function to rename directories inside a dirlist box? I tried this code, but nothing happens.


VB Code:
Option Explicit Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long Const FO_COPY = &H2Const FO_DELETE = &H3Const FO_MOVE = &H1Const FO_RENAME = &H4 Private Type SHFILEOPSTRUCT    hwnd As Long    wFunc As Long    pFrom As String    pTo As String    fFlags As Integer    fAnyOperationsAborted As Boolean    hNameMappings As Long    lpszProgressTitle As StringEnd Type Private Sub mnuRename_Click()    Dim lFileOp As Long    Dim lresult As Long    Dim lFlags As Long    Dim Response As String    Response = InputBox("Enter new name for directory", "Rename folder")    Dim SHFileOp As SHFILEOPSTRUCT    With SHFileOp        .wFunc = FO_RENAME        .pFrom = Dir1.Path        .pTo = Dir1.Path & "" & Response    End With    Dir1.RefreshEnd Sub

Ackerman Function - Recursive Function Help Needed
I recently had to write the following function in maple known as the Ackerman function. However I need to write a function in VBA to calculate it.

The function in maple was the following.

a:=proc(n,m)
if n=0 then RETURN(m+1) fi;
if m=0 then RETURN(a(n-1,1)) fi;
RETURN(a(n-1,a(n,m-1)));
end;


The problem I am having is getting the function to stop iterating. It wont calculate a result even for simple results like T(1,1).

The code I have written in VB is as follows.



Function T(n As Integer, m As Integer)

If m = 0 Then
T(n, m) = T(n - 1, 1)
End If

If n = 0 Then
T(n, m) = m + 1
End If

T(n, m) = T(n - 1, T(n, m - 1))
End Function



Any Ideas? Is it possible

Cheers

Rich

Recursive Function
ok i need to create a recursive fuction that goes through an aray of 25 and finds the highest vallue, help?

Recursive Function
I am trying to write a simple recursive function in Visual Studio Express 2005. Any help would be greatly appriciated:

I am receiving the following error when I try to execute the below code:

Error: 61837 - Unable to write read-only property.

VB Code:
Public Function RemoveUserFromUserClasses(ByRef objUserClass As Object, ByRef objUser As Object) As Boolean         On Error GoTo Err_RemoveUserFromUserClasses         'Counter        Dim I As Long        'Hold the current User Class        Dim objCurUserClass As Object          ' For each UserClass remove the user.        If objUserClass.Count > 0 Then            For I = 1 To objUserClass.Count                objCurUserClass = objUserClass.Item(I)                objCurUserClass.Users.Remove(objUser)                RemoveUserFromUserClasses(objCurUserClass.UserClasses, objUser)            Next I        End If  Exit_RemoveUserFromUserClasses:        Exit Function Err_RemoveUserFromUserClasses:        If fLogFileOpen Then            PrintLine(intLogFileNumber, Str(Now.ToOADate) & ": * * * RemoveUserFromUserClasses Error: " & Err.Number & " - " & Err.Description)        End If        Resume Exit_RemoveUserFromUserClasses     End Function










Edit: Added [vbcode][/vbcode] tags for more clarity. - Hack

Recursive Function Help
Last night I spent forever trying to figure out how to do this. Could somebody tell me how to get started, maybe provide some example code?

Thanks

Recursive Function
Urgent!! I wrote a recursive function. This recursive function will start when I click on the 'Start' button. I need to stop this recursive function when I click on the 'Stop' button, but the 'Stop' button only responce after the recursive function finish, how can I always listen to the 'Stop' button event so I can terminate the recursive function any time as I want? Thanks.

Recursive Function
here is what am trying to do
let say i have a directory called
c:ARTISTS

thats the root
in that directory there is let say 30 different artits
and in those artists SOME can have more than one album
those that dont have more than one album
the songs are located in just the name of the artist

so if artst1 had one album
all the songs would be located in c:Artistsartist1

and if artist2 had 2 albums
it would be like
c:artistsartist2album1 (songs for this album go here)
c:artistsartist2album2 (songs for album2 go here)

so i would like someone to help me out with making a function that when given c:artist
it will go into every directory
and copy artist name(directory), album name( sub directory), and song names (filenames)
into a table..

thank you

Recursive VB Function?
Hi all,
I am looking for a recursive function to step through a tree like structure. What make this difficult is that each child node in the tree only knows if it has a child. It does not know about its parent. My problem is that I can recurse through the tree, moveing to each child nodes child, but I can not return to the previous levels. I do not know how many level deep I need to go, so it must be recursive.

Below is a typical tree structure I will need to recurse. I start at A, then I can get to ABC1. But how to I return to AB1 and continue the process? As you can see, the tree can be many levels deep and I only know if the node has a child and how to get to that child.

A
l
A1------->A1.1
l l
A2 AB1-------->AB1.1
l l l
A3 l ABC1
l AB2----------------------->AB2.1
A4 l l
l AB3 D1---------------->D1.1
A5 l l
l D2 F1
A6------->A6.1 l
                 l F2
               B1---------->B1.1----------->C1
                                      l l
                                    B2.1 C2
                                       l
                                     B3.1

Thanks



Edited by - skyodyssey on 7/30/2004 12:12:31 PM

Recursive Algorithm/Function
Does anyone know how create a Recursive Algrithm in VB? Any help would be greatly aprciated.
Thx

Problem With Recursive Function
Hi

I have a problem with the following code:


VB Code:
Private scanData() As String Private Sub Form_Load()List1.AddItem "c:My Documents"List1.AddItem "e:"End Sub Private Sub Command1_Click()scanfolders3End Sub Public Sub scanfolders3()Dim startTime, elapTime As DoubleDim startFolder As StringDim scanResult As BooleanscanResult = FalseForm1.MousePointer = vbHourglassstartTime = CDbl(Timer)ReDim scanData(4, 0)startFolder = List1.TextscanResult = scanFolders(startFolder)elapTime = CDbl(Timer) - startTimeForm1.MousePointer = vbNormalText1.Text = elapTimeEnd Sub Public Function scanFolders(fpath As String) As BooleanDim x As DoubleSet fso = CreateObject("Scripting.FileSystemObject")    For Each fl In fso.GetFolder(fpath).Files        x = UBound(scanData, 2) + 1        ReDim Preserve scanData(4, x)        scanData(0, x) = fl.Name        scanData(1, x) = fpath        scanData(2, x) = fl.Size        scanData(3, x) = fl.Type        DoEvents        x = x + 1    Next fl    For Each fldr In fso.GetFolder(fpath).SubFolders        scanFolders fldr.Path    Next fldrSet fso = NothingSet fldr = NothingSet fl = NothingscanFolders = TrueEnd Function


The main aim of the code is to populate an array with the details of files in a given directory. The form has been added to assess the performance for various drives/directories.

The problem is that subsequent runs of the code take relatively longer each time. Given that "e:" is a 512mb pendrive with about 300mb used and that "c:My Documents" contains about 4GB typical results with times in seconds are:

e: 4.56
e: 4.63
e: 4.45
c:My Documents 17.68
e: 18.11
c:My Documents 86.45
e: 77.5

I can't see where the resources are leaking or what is causing this build up after the larger directory is scanned.

Things I've tried are:

1. Not using Preserve - although this wouldn't work as needed anyway it was no quicker.
2. Commenting out DoEvents - Didn't help

Any ideas?

Thanks

Mouse

Making A Recursive Function
Hi, I need help making a recursive function for the code listed
below.
I posted here previously for solution to listing all subkeys
and values of a registry key. I got the code to do it, but
it only lists on level, so it needs to be put in a recursive
function in order to go through the entire branch.
I've tried to do this but I never worked with recursion before
and I can't get it to work.
I just need to add all the keys and values to a list in this
format:
Key
if it is a key or if it is a value:
Key,value=data

This code does that all but only one step. Can someone
help me with this, it is a one minute job for someone who
worked with recursion before. Thanks in advance.


VB Code:
Const ERROR_NO_MORE_ITEMS = 259&Const HKEY_CURRENT_CONFIG = &H80000005Const HKEY_LOCAL_MACHINE = &H80000002Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As LongPrivate Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As LongPrivate Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As LongPrivate Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As LongPrivate Sub Form_Load()    Dim hKey As Long, Cnt As Long, sName As String, sData As String, Ret As Long, RetData As Long    Const BUFFER_SIZE As Long = 255    'Set the forms graphics mode to persistent    Me.AutoRedraw = True    Me.Print "RegEnumKeyEx"    Ret = BUFFER_SIZE    'Open the registry key    If RegOpenKey(HKEY_LOCAL_MACHINE, "Hardware", hKey) = 0 Then        'Create a buffer        sName = Space(BUFFER_SIZE)        'Enumerate the keys        While RegEnumKeyEx(hKey, Cnt, sName, Ret, ByVal 0&, vbNullString, ByVal 0&, ByVal 0& ) <> ERROR_NO_MORE_ITEMS            'Show the enumerated key            Me.Print "  " + Left$(sName, Ret)            'prepare for the next key            Cnt = Cnt + 1            sName = Space(BUFFER_SIZE)            Ret = BUFFER_SIZE        Wend        'close the registry key        RegCloseKey hKey    Else        Me.Print "  Error while calling RegOpenKey"    End If     'This part below lists the values and their data of selected key    Me.Print vbCrLf + "RegEnumValue"    Cnt = 0    'Open a registry key    If RegOpenKey(HKEY_LOCAL_MACHINE, "SoftwareMicrosoftWindowsCurrentVersion", hKey) = 0 Then        'initialize        sName = Space(BUFFER_SIZE)        sData = Space(BUFFER_SIZE)        Ret = BUFFER_SIZE        RetData = BUFFER_SIZE        'enumerate the values        While RegEnumValue(hKey, Cnt, sName, Ret, 0, ByVal 0&, ByVal sData, RetData) <> ERROR_NO_MORE_ITEMS            'show data            If RetData > 0 Then Me.Print "  " + Left$(sName, Ret) + "=" + Left$(sData, RetData - 1)            'prepare for next value            Cnt = Cnt + 1            sName = Space(BUFFER_SIZE)            sData = Space(BUFFER_SIZE)            Ret = BUFFER_SIZE            RetData = BUFFER_SIZE        Wend        'Close the registry key        RegCloseKey hKey    Else        Me.Print "  Error while calling RegOpenKey"    End IfEnd Sub

How To Write A Recursive Function?
Hi,

I'm trying to write a recursive function but in vain... thus i sincerely hope you could help me... Actually my purpose of this recursive search is to search for all children, grandchildren, great grandchildren...etc of a particular record. Suppose in my table, I have two fields, Parent and Child.

For example,

Parent Child
===== ====

May - John
Jess - Mike
Jess - Nick
John - Peter
John - Jess
John - Watson
Peter - Carrie

........ etc

Suppose I start with a name John. My aim is to 1st search thru the parent field for all records with parent, John. In this case, the records will be those of children Peter, Jess, and Watson.

For each of these children, I will search thru the table again, for their children (aka John's grandchildren)..

Thus I need a recursive method to traverse thru the records.

Can anyone help?

Thank you very very much.

Recursive Function Calls
In order to generate a unique number I wrote the following simple Function.  It fails to do the job because there is no recursive Function call. However, using an analogous Subroutine works because the desired recursive call to the Sub _does_ happen.

Is this a VB feature, and, if so, why?

Public gcollUniqNum as New Collection
Public glUniqNum as Long

Public Function UniqueNum() As Long
    Dim lNum As Long    
    lNum = GenRan(1)
    If InColl(gcollUniqNum, CStr(lNum)) = True Then

        'NO recursive call to UniqueKey.  
        'Function exited with UniqueKey = 0
        lNum = UniqueKey

    Else
        gcollUniqNum.Add lNum, CStr(lNum)
        UniqueNum = lNum
    End If
End Function

Public Sub GenerateUniqueNumber()
    Dim lNum As Long
    lNum = GenRan(1)
    If InColl(gcollUniqNum, CStr(lNum)) = True Then

        'DOES result in recursive call
        GenerateUniqueNumber
   
     Else
        gcollUniqNum.Add lNum, CStr(lNum)
        glUniqNum = lNum
    End If
End Sub



Public Function InCollection(collDesignated As Collection, Key As String) As Boolean
    On Error GoTo NotThere
    'VB generates a run-time error if Key is not in collDesignated
    If collDesignated.Item(Key) <> "" Then
        InCollection = True
        Exit Function
    End If    
NotThere:
End Function


 

Need Help With Treeview Vb6 Recursive Function
Hi ,
What I am trying to achieve is the ability to limit the checked nodes to 1 only.
Within the London's node there are 2 children (show1,show2) only one perfomance can be checked
In my attempt I set all to false and then the selected one to true.But i m failing to recursely loop.
Can you help?

Scenario

 Country
   City
       London
          show 1
             Cinderella 20/06/06 performance
             Cinderella 21/06/06     performance
          show 2
             Phantom 20/06/06    performance    
             Phantom 21/06/06    performance

My failed attempt
Code:

 Private Sub ValidateNodes(ByVal ndParent As MSComctlLib.Node)
                         
dim oChild as MSComctlLib.Node


        Set oChild = ndParent .Child
        For iIndex = 0 To ndParent .Children - 1
           oChild.Checked =false
           Set oChild = oChild.Next
        Next
        tvw.SelectedItem.Checked=true

End Sub


Thanks in advance

Recursive Function In Formula Not Working?
I am trying to use a recursive function to return the number of levels for a specific parent but once I put the function in an equation it doesn't work. I receive a "ByRef Argument type mismatch error" for Level(Temp) which is fine when on a stand alone line.
Code:
Function Level(Parent As String) As Integer
Dim Temp As Variant

Temp = DLookup("[Component]", "TestData", "[ItemNo] = '" & Parent & "'")
If IsNull(Temp) Then
MsgBox ("Found NULL")
Level = 1
Debug.Print "ItemNo Component", "Level"
Debug.Print Parent; " "; Temp; " "; Level; Chr$(13)
'Done
Else
MsgBox ("Found ItemNo")
Debug.Print "ItemNo Component", "Level"
Debug.Print Parent; " "; Temp; " "; Level; Chr$(13)

'**** This Works Fine
Level (Temp)

'**** This Doesn't Work, Why?
'Level = Level + Level(Temp)

End If

End Function
Any help would be appreciated. Thanks.

Recursive File List Function
I have a function that will return any files in a given folder. But in order to make it also return files in subfolders, i was told i would have to make it recursive. Recursive functions are something ive never had to use yet...and quite frankly i dont understand them. Could someone tell me what modifications i would have to make to this function to make it return subfolder files as well?

VB Code:
Function DirList(strDir As String) As String()    'returns a 0 based array with the files in strDir    'Can contain a pattern such as "*.*"    Dim Count As Integer    Dim sFiles() As String    Dim sFile As String        sFile = Dir$(strDir)    Count = -1    Do        Count = Count + 1        ReDim Preserve sFiles(Count)        sFiles(Count) = sFile        sFile = Dir$    Loop    DirList = sFilesEnd Function

thanks,
Nishant

Calling A Recursive Function/sub From Itself Sends Nothing
first :thank you delcom5 for your reply.

i built a recursive function (tried calling it a sub as well - same problem)
that should builds nodes from DB to be added to a treeview.
and when i call the function from itself the node is sent as nothing (i do add byval of course).
don't have a clue why this shold happen, other parameters are sent just fine.

Recursive Function Fails To Return The Correct Value
Hi,
I'm fairly new to VB. Just tried to implement a recursive function with Tree Class. The function is as follow:

Code:
Private Function bTreeSearch(ByRef tmpx As Node, _
ByVal result As Integer, _
ByVal expr As String) As Boolean
Dim isFound As Boolean
If (tmpx Is Nothing) Then
isFound = False
Else
isFound = (tmpx.result = result)
If Not isFound Then
If result < tmpx.result Then
bTreeSearch tmpx.Left, result, expr
Else
bTreeSearch tmpx.Right, result, expr
End If
End If
End If
bTreeSearch = isFound
End Function
When I ran through debug mode, I found out that when the function found the node with the same result and set isFound = True, on the way returning to the stack, ie. back to its previous copy, where isFound is False, it returns FALSE as the value of the first copy of the function rather then TRUE value of the second copy - I hope you understand what I am talking about.

My question is, how to make this recursive function to return the TRUE value (from the second copy of the function) as the function rolls back on the stack?

(still N00b) Recursive Function Doesn't Work
Hi,

For some obscure reason an recursive function I build doesn't work:


Code:
Public Function D()
Dim TD As Integer
Dim XD As Integer

XD = 0
TD = D10
If TD = 10 Then
XD = TD + D
Else
XD = TD
End If
D = XD
End Function


D10 is a function that gives a random number between 1 and 10
What it must do is:
When D10 results in 10, then another D10 must be added:
If TD = 10 Then XD = TD + D
but for some reason VB doesn't 'step into' D and just gives the result '0'
At first I used If TD = 10 Then D = TD + D, which is shorter, but same result.

Any clue anyone?

Problem With Recursive Function To Build XML Dom Tree
I have the following recursive function

Private xmldoc As DOMDocument30

Private Sub BuildTree(ByRef parentElement As IXMLDOMElement)

Dim aElement as IXMLDOMElement

...
Set aElement = xmldoc.createElement("something")
parentElement.appendChild aElement
...
BuildTree aElement
...

End Sub

Running the code results in: "Compile error: ByRef argument type mismatch"

Could anybody help identify the problem and suggest a solution for it?

Kill Function API
What's a way to delete a file using only API?

I tried

VB Code:
Kill("c:file.bmp")

But it doesn't work using API (.DLL).

Kill Function
I just want to know if we can use the kill ( MYprogam ) in the unload for exemple. I want the user to be able to open the exe 1 time and after I want my program deleted of the computer. Is that possible ?

Kill Function Error
I'm using the kill function as kill(path & filename) in a recursive function. It's deleting most of the files needed, but giving me an error on some. I can't find a pattern with the files that aren't deleting. What could the problem be???

Kill Function Problem!!
Im working on a program that deletes all the files from the WindowsTemp directory but when i use the
Kill function i use it like this:


Kill "c:DirDir2*.*" and it works perfectly

But now i used the function like this: Kill "c:WindowsTemp*.*" and it gave me a path/file access error


Does anyone know why?, does it have anything to do with file attributes?


Please help me

Kill Function/Command
Hi VB people. I am trying to write a program that cleans up my hard drive a little.
Unfortunately I am have trouble with my Kill function. For example: I want to delete all my .tmp files on my computer. I used the following command:

Kill("c:*.tmp /s") but when the program runs, it says Run-time error 53 : File not found.

What am I doing wrong?

Thank you,

Dave

Difference Between DeleteFile API And Kill Function?
Is There a Difference Between the DeleteFile API and the Kill Function?

Runtime Error 70 On Kill Function
I keep getting a runtime error of 70 on a kill function. I am using VB6 SP5, the app connects to multiple foxpro tables. I have closed all connections prior to executing the kill function. I am also using CLOSE before executing the Kill function to make certain that all files are closed.

Example:

CLOSE
Kill "C:MyPath*.*"


I use the same code to delete files in four other directories with no problem. How do I correct this?

Using The Kill Function To Delete On Vista Machine
I'm updaing a program so it's MS Vista compatabile.

My application can check for updates over the internet. If an update is available, the application renames itself from appname.exe to appname2.exe and then downloads the new version. On the computer reboot, the new version runs and it SHOULD automatically delete the appname2.exe using:
kill & app.path & "myappname.exe"

This process ran fine in XP.

In vista, under the admin account, the software renames and downloads without any problems and no vista prompts. However, when the computer is rebooted to the admin account, the appname2.exe is not deleted at that time. I've got permissions as it's the admin account...

ideas?




Edited by - joemerchant2 on 2/9/2007 7:30:34 AM

How To Force Program To Kill Or Exit Itself After It Finished A Function.
Here is my code. I made Screenshot program but it stuck in my task manger and it should exit automaticly by itself. I been looking for info on this. I guess I will ask here


Code:

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const VK_SNAPSHOT = &H2C
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long

Private Function SaveScreen(ByVal theFile As String) As Boolean

On Error Resume Next
'To get the Entire Screen
Call keybd_event(vbKeySnapshot, 0, 0, 0)
'To get the Active Window
'Call keybd_event(vbKeySnapshot, 1, 0, 0)

SavePicture Clipboard.GetData(vbCFBitmap), theFile
SaveScreen = True
Exit Function
End Function

Private Sub Form_Load()
Form1.Visible = False
Visible = False
SaveScreen "c:screenshot.bmp"
End Sub

Search File In Folder An Recursive Folder With Dir Function
Hi,

I want to search ActiveX .dll in a expecific folder and in all his recursive folders.

I´ve made a recursive function using dir statement. But dir returns error when it finish in one folder and I want that dir function search in the recursive folders too.

This is my code:


Private Sub search(sFolder As String)
Dim sName As String

sName = Dir(sFolder & "", vbDirectory) ' Retrieve the first entry.
Do While sName <> "" ' Start the loop.
' Ignore the current directory and the encompassing directory.
If sName <> "." And sName <> ".." Then
' Use bitwise comparison to make sure sName is a directory.
If (GetAttr(sFolder & "" & sName) And vbDirectory) = vbDirectory Then
' sName is a directory.
Debug.Print sFolder & "" & sName ' Display entry only if it
search sFolder & "" & sName
ElseIf LCase$(Right$(sName, 3)) = "dll" Then
' sNAme is a ActiveX.dll
Debug.Print sFolder & "" & sName

End If
End If
sName = Dir ' Get next entry. <= Here happens an error when the function end searching in 1 recursive folder

Debug.Print sName
Loop

End Sub



What can I do????


Thanks and regards

Tel

Recursive Function "out Of Bounds Error"
I got that function from here but I get ann error "subscript out of range" what`s up with that ??

'recursive folder adding
Public Sub ProcessFiles(d As String)
Playlist.files.AddItem Playlist.files.ListCount + 1 & ". " & d
End Sub


Public Sub ProcessDir(strDir As String)
Dim i
Dim iCount As Integer
Dim Result As String
Dim FileList() As String
iCount = 0
Result = Dir(strDir & "*.*", vbDirectory)
Do While Result <> "" ' Start the loop.
If Result <> "." And Result <> ".." Then
iCount = iCount + 1
ReDim Preserve FileList(1 To iCount)
FileList(iCount) = strDir & "" & Result
End If
Result = Dir
Loop

For i = 1 To UBound(FileList)
If (GetAttr(FileList(i)) And vbDirectory) = vbDirectory Then
ProcessDir (FileList(i))
Else
ProcessFiles (FileList(i))
End If ' it represents a directory.
Next
End Sub

Is "kill" Synchronous Or Assynchronous Function
Is "kill" synchronous or asynchronous function?

Kill, Kill Mwahaha [hardish]
How can I FORCE a kill of an app please - bit like windows shutting down kills even apps that the not responding option doesn't work

Will Not Fully Quit!!
I have developed a COM AddIn in VB.NET that adds a commandbar in Outlook. A button is added to this commandbar and when pushed, Excel is started. The problem is that when I close Excel it still remains in the memory. If I click the button again a new Excel app is started and also this one stays in the memory. Big problems when each app takes up 20MB.. The code is:

Private Sub myControl_Click _
(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean) _
Handles myControl.Click

Dim myXLApp As Excel.ApplicationClass
myXLApp = CreateObject("Excel.Application")
myXLApp.Visible = True
MsgBox("Nu är Excel igång")
myXLApp.Quit()
myXLApp = Nothing

End Sub

If I make the button open Word instead everyting works fine..??.. Can anybody please help me with this..

/Billy

ADO Not Fully Connecting
Ok, I'm making an ADO Database From Scratch in VB6. It works great when loading the titles, but when it trys to load the data (Which is the same function of the title loading) it gives me an error...Here is the code for it...

http://www.freewebs.com/vbcontrols/code.htm

Thanx,
£¥~Jaywalker~¥£

VB App Not Closing Fully
Is there a way of telling what is keeping my VB app open? I try closing it by calling the Unload on the main form like I always do and the form goes away but the app is still as a process.

I have done this by just opening it and right then trying to close where it does nothing with no other forms. And still happens. No timers or anything.

Is there any way of forcing it to close? Any way to see whats holding it open?

Thanks!

Let Fully Load
Working in VB.

I need to make it wait until the page called in IE loads before going to the next command. I have just been using a pause but page keeps loading at different times and program keeps messing up.

Anyone know a code to make it wait for IE to fully load before continuing?

Any help is appreciated.

Fully Justify
I am trying to get the code that will fully justify text within a RTF.

Does anyone have any ideas?

I also need to know if i need my own icons for toolbar items.

Thanx in advance

Mozilla Fully Distributable?
Does anyone know if the Mozilla browser control is fully distributable with any commercial application?

Thanks!

Why Won't My Program Fully Exit?
For some reason, my program won't exit fully. I've compiled it and when it's ran, it seems that I can exit it fine, but when you open up the Control + Alt + Delete tab on XP, you can still see the program running. I'm pretty sure it has to do with the Inet control (I'm using it to get and post the source code of websites in my program) While it's connecting and retrieving data, is when I can't seem to exit the program.

Fully Skinable Program
How would I do this? How would I skin everything? The whole form including the Minimize,X buttons?

Deleting A File Fully!
when u delete a file it dosent erase it contens
but just delete from the file manager its space!
how can totaly destroy the file contents when i delete a file?
thnaks in advance
peleg

Need Fully Expanded Treeview
Hello
I have a form in vb 6 having treeview. Now i want to have this treeview fully expanded on form load itself.

Can anyone help me out. plz.

Manifest Not Fully Functional
hey all,

im just wondering how come the manifest doesnt coverthings like the properties menu (look at attached pic) and stuff liek progress bars.

is there anyway to make them look more like xp istead of the old type?


this is what i was talking about on the properties tabs, how can u get it to look like this..

Is Word Fully Running?
I am launching word from my vb app. When word launches, it will run a set of macros that load menu items in word for a different app, similar to the menu items that get added for acrobat. When I launch my document from vb, if the macros are not fully completed and word isn't completely open, certain menu items don't work. I'm told that if I wait for these macros to run and word to completely and fully open, and then launch the document, everything will work fine. If Is there a way to tell when word is fully running? I don't know how to tell programatically whether the menu items are ready.

DO NOT SHOW, Until FULLY Loaded
I have an MDI child form that has a lot of controls on it and resizing that has to be done and I do not want it to appear until all loading/resizing routines are done. Currently, I am calling Load MyForm, setting the visibility to false, then calling LockWindowUpdate and then setting the visibility of the form at the end of the resize event, and then unlocking the window update, BUT there I still see the form appear and do some resizing/flickering...PLEASE HELP!!

My Program Never Fully Closes
The most likely reason that your program keeps on running is that you are not closing it properly. The way to do that is to have a routine that loops through the Forms collection and unloads all forms. That routine should be run from the QueryUnload event of any form that the user can close. You should also never use End.

VB Code:
Public Sub UnloadAllForms()     Dim frm As Form        For Each frm In Forms        Unload frm        Set frm = Nothing    Next    End Sub

How To Tell When Web Page Has Fully Loaded/painted ?
Probably obvious !!

Within my App I check to see if a Netscape window is open and pointing to the a particular web page - If not, then Netscape is opened and directed to the chosen web page using the Shell function.

Once the web page has loaded I fill in an online form and click on a Submit button.

All fairly simple stuff - but please, I need a little help......how do I confirm that the web page/form has fully loaded/painted prior to my attempt to complete it ?


__________________

Well ? That almost never happens !!

Stop VB From Next Instruction Until The Previous Is FULLY Done
is it possible in VB to tell it to stop running (in the exe file, when compiled or in the code of the program) until the instruction has been fully completed?

for example:


Code:
shell "format A:"
msgbox ("done!")
ok this aint' the real code but it uses shell, so when the format has been completed or whatever the shell command was, how can I tell it to proceed with the next command after the previous command has been fully completed?

Copyright © 2005-08 www.BigResource.com, All rights reserved