-
OpenFile API
My question :
Program 1 opens a file with the OpenFile API:
OFSTRUCT TestOF;
OpenFile("c:\\test.txt",&TestOF, ... );
Now i was wondering how i could (re)open the same file
in another program with the OpenFile API:
OFSTRUCT TestOF2;
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
-
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.