Thread: program/file association question.

  1. #1
    Registered User Dohojar's Avatar
    Join Date
    Feb 2002
    Posts
    115

    program/file association question.

    Can anyone tell me how a program like notepad knows when it has been opened to read a file. How does it tell weather you are running the program using notepad.exe or by double clicking on a *.txt file. Here's an example of what I mean.
    I want to open a readme.txt file so I double click on it and notepad pops open with the contents of the file. What I want to know is how does notepad know thats it is supposed to open this file and display the contents and not just display an empty file like it does when you click on the notepad.exe file?
    Any help is appreciated.
    Dohojar Moajbuj
    Time is the greatest teacher, too bad it kills all its students

  2. #2
    Registered User Dohojar's Avatar
    Join Date
    Feb 2002
    Posts
    115
    Thanks Salem.
    Dohojar Moajbuj
    Time is the greatest teacher, too bad it kills all its students

  3. #3
    Registered User Dohojar's Avatar
    Join Date
    Feb 2002
    Posts
    115
    I got a new question that is releated to program/file association question I already asked so that is why I am just using this thread again instead of starting a new one.

    I can get the file name that the user double clicked on(thanks to Salem) but the problem is that this file has been opened already by windows. I found this out only because when I tried to open the file using fstream, it failed. I checked the failbit and it was set so that is what is telling me the file is already open(well at least I think that is what it is telling me).

    How can I close this file so that I can read it, or at least get a HANDLE to to the file so I can atually do something with it.
    Dohojar Moajbuj
    Time is the greatest teacher, too bad it kills all its students

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  2. Anouther file association question
    By Dohojar in forum Windows Programming
    Replies: 2
    Last Post: 08-21-2003, 04:38 PM
  3. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. Template question
    By grscot in forum C++ Programming
    Replies: 1
    Last Post: 04-29-2003, 03:12 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM