findfirstchangenotification in windows 95/98

Posted on 2005-04-08
Last Modified: 2012-08-13
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.
Question by:extramayo

    Author Comment

    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?

    Author Comment

    And, I've discovered the Subtree arguement is a long, not a boolean... what are the values for it though?

    Author Comment

    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.
    LVL 8

    Accepted Solution

    -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.


    Author Comment

    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
        lngSubTree = 0
    End If

    NotifyCreate = FindFirstChangeNotification(lpPathName, lngSubTree, FLAGS)

    End Function

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now