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

This is a discussion on How to make "open with" work with my own texteditor (win32 API) within the Windows Programming forums, part of the Platform Specific Boards category; Hello! I'm making my own texteditor as a way to learn a bit about the win32 API. Most of it ...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    80

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

    Hello!

    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

    //Antex

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,671
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    80
    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, 11:39 AM
  2. cant make it work
    By papous27 in forum Linux Programming
    Replies: 0
    Last Post: 03-05-2002, 08:49 PM
  3. Make quicksort work the other way?
    By Nutshell in forum C Programming
    Replies: 4
    Last Post: 01-24-2002, 11:16 AM
  4. DPMI and how to make it work
    By Sunny in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 12-10-2001, 04: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, 03:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21