Thread: FileSystemWatcher static functions

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    32

    FileSystemWatcher static functions

    hello there,
    I have run into a problem, i have set up a FileSystemWatcher to monitor if a file is deleted. All is good up to there. But because the handlers for the event have to be static functions i am unable to make function calls which belong to my class from with in the handler , any suggestions to get around this?
    br

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    This is not C++.
    Incidentally, I suppose this should be posted in Tech Board.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Quote Originally Posted by Elysia View Post
    This is not C++.
    Incidentally, I suppose this should be posted in Tech Board.
    Or to the C# board.
    Quote Originally Posted by ashaikh432 View Post
    But because the handlers for the event have to be static functions i am unable to make function calls which belong to my class from with in the handler , any suggestions to get around this?
    Show some code. It's not obvious why the handlers for the event "have to be" static functions.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    In C++ there is no other way than having static versions of those functions. The first parameter should hold a reference to your filesystemwatcher object so you can have a static lookup table to connect the filesystem watcher object to another class or subclass the watcher class so you can call one of it's new methods.

    Please note that those difficulties are due to your use of C++/CLI. If you need .NET use a native .NET Language like C# and you won't have those problems.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting a swf file in a windows application
    By face_master in forum Windows Programming
    Replies: 12
    Last Post: 05-03-2009, 11:29 AM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  3. Linking errors with static var
    By Elysia in forum C++ Programming
    Replies: 8
    Last Post: 10-27-2007, 05:24 PM
  4. Replies: 23
    Last Post: 07-09-2007, 04:49 AM
  5. Static functions.... why?
    By patricio2626 in forum C++ Programming
    Replies: 4
    Last Post: 04-02-2007, 08:06 PM