Thread: How to make "open with" work with my own texteditor (win32 API)

  1. #1
    Registered User
    Join Date
    Sep 2004

    How to make "open with" work with my own texteditor (win32 API)


    I'm making my own texteditor as a way to learn a bit about the win32 API. Most of it is working just fine, like opening and saving textfiles.
    It's also working fine to open files from the commandline by typing "myeditor path\to\file.txt" or using "drag and drop" from a textfile to myeditor.exe.
    The thing I cannot figure out is how to make it possible to open files with "myeditor" by right-clicking on a text file and choosing "Open With". When I try doing that the editor is launched but does not load the textfile.
    In an attampt to figure out what's happening I've added a messagebox that pops up when the editor is opened and displays the commandline arguments (which I use to open files). Those arguments look correct when using "Open With" but it doesn't load the file.

    Any help would be greatly appreciated


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    How are we supposed to know what "It looks OK to me" means when you don't show us what you see?

    When you try to open such a file, what error(s) do you get?

    Are there any surprise leading or trailing spaces for example?

    Or are you assuming that the current directory is set to something in particular in one method of opening a file, compared to another?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Thanks for your reply, I found the error. When opening a file by rightclicking and "open with" the path to the file was enclosed by double quotes and my code didn't handle that.

    Sorry for not being specific enough in my first post, will keep that in mind until next time

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  2. cant make it work
    By papous27 in forum Linux Programming
    Replies: 0
    Last Post: 03-05-2002, 09:49 PM
  3. Make quicksort work the other way?
    By Nutshell in forum C Programming
    Replies: 4
    Last Post: 01-24-2002, 12:16 PM
  4. DPMI and how to make it work
    By Sunny in forum A Brief History of
    Replies: 15
    Last Post: 12-10-2001, 05:16 PM
  5. how do you make the X Y thing work?
    By bluehead in forum C++ Programming
    Replies: 2
    Last Post: 11-05-2001, 04:19 PM