[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

findfirstchangenotification in windows 95/98

I coded and tested my program in Windows XP. I began testing it on Windows 95/98, but discovered that findfirstchangenotification sets a variable to -1 on 95/98. This seems like an error to me, especially when the folder change events are not occurring. Is there something I'm missing? I tried the same path (on local machine) on both computers.
0
extramayo
Asked:
extramayo
  • 4
1 Solution
 
extramayoAuthor Commented:
Okay, the handle is not created (-1 result) when the subfolders argument is set to true:

NotifyCreate = FindFirstChangeNotification(lpPathName, blnSubTree, FLAGS)

...where blnSubTree = True

It works fine, but without detecting folder changes of subfolders of the lpPathName folder. Any ideas?
0
 
extramayoAuthor Commented:
And, I've discovered the Subtree arguement is a long, not a boolean... what are the values for it though?
0
 
extramayoAuthor Commented:
One last followup. To clarify: findfirstchangenotifiction sets handle to -1 if subtree is true and returns normal value if set to false. This problem occurs only on a windows 98 machine.
0
 
anthonywjones66Commented:
-1 is the invalid handle value.  Err.LastDLLError will give you the true windows error number. The second parameter is more specifically define a C  BOOL type.  This has a value of 0 or 1.  VB's value for true is -1 which Win 95/98 may be taking objection to.  Try defining it as a long and pass 1 instead of a VB True.

Anthony.
0
 
extramayoAuthor Commented:
Thanks, that was it.

Public Function NotifyCreate(lpPathName As String, blnSubTree As Boolean, FLAGS As Long) As Long

Dim lngSubTree

' convert boolean to C boolean -1&0 -> 1&0
If blnSubTree = True Then
    lngSubTree = 1
Else
    lngSubTree = 0
End If

NotifyCreate = FindFirstChangeNotification(lpPathName, lngSubTree, FLAGS)

End Function
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now