Thread: OpenFile API

  1. #1
    Registered User
    Join Date
    Apr 2002

    OpenFile API

    My question :

    Program 1 opens a file with the OpenFile API:
    OpenFile("c:\\test.txt",&TestOF, ... );

    Now i was wondering how i could (re)open the same file
    in another program with the OpenFile API:
    OpenFile("c:\\test.txt",&TestOF2,OF_REOPEN|OF_READ WRITE);
    (TestOF2 should be pointing to TestOF)

    If i use OF_REOPEN|OF_READWRITE attributes i have to know the address where
    program 1 stored the TestOF variable.
    Cause i need to use that if i want to reopen it.
    Somebody got a clue?
    thx in advance

  2. #2
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    If you wanted to tell the other program the address of the struct, you could make TestOF a global pointer, sending it as a WPARAM or LPARAM in a custom window message that would be sent to program two. FindWindow() would be used to fetch program two's window. I was originally going to suggest using pipes, but the same problem arises as you have to set up some way for the reading program to obtain the read-only handle, but that's a different challenge.
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Want to learn Windows API for Game Programming
    By George M. in forum Windows Programming
    Replies: 15
    Last Post: 09-28-2008, 10:26 AM
  2. OpenSSL and Win32 SSL API :: SSL/TLS
    By kuphryn in forum Networking/Device Communication
    Replies: 0
    Last Post: 03-10-2004, 07:46 PM
  3. FILES in WinAPI
    By Garfield in forum Windows Programming
    Replies: 46
    Last Post: 10-02-2003, 06:51 PM
  4. Is it foolish to program with Win32 API ?
    By Kelvin in forum Windows Programming
    Replies: 2
    Last Post: 07-09-2002, 02:03 PM
  5. pthread api vs win32 thread api
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 11-20-2001, 08:55 AM