Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ListBox OnDblclkSout() Event

ListBox OnDblclkSout() Event

Scheduled Pinned Locked Moved C / C++ / MFC
help
10 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VinayCool
    wrote on last edited by
    #1

    Hi, I get the list of file name with full path as the output in the list box. when the user double clicks on the list box item i want the file to be opened i have used the below code but it has no effect, its not opening the file. can u please tell me what will be the error. void CSearchDlg::OnDblclkSout() { int d; d=m_SOUT.GetCurSel(); CString FName; m_SOUT.GetText(d,FName); ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL); } Regards, Vinay Charan.

    N 1 Reply Last reply
    0
    • V VinayCool

      Hi, I get the list of file name with full path as the output in the list box. when the user double clicks on the list box item i want the file to be opened i have used the below code but it has no effect, its not opening the file. can u please tell me what will be the error. void CSearchDlg::OnDblclkSout() { int d; d=m_SOUT.GetCurSel(); CString FName; m_SOUT.GetText(d,FName); ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL); } Regards, Vinay Charan.

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      vinaycool wrote:

      m_SOUT.GetText(d,FName); ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL);

      Is FName the full path to the file?


      Nibu thomas A Developer Programming tips[^]  My site[^]

      V 1 Reply Last reply
      0
      • N Nibu babu thomas

        vinaycool wrote:

        m_SOUT.GetText(d,FName); ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL);

        Is FName the full path to the file?


        Nibu thomas A Developer Programming tips[^]  My site[^]

        V Offline
        V Offline
        VinayCool
        wrote on last edited by
        #3

        Hi Nibu thomas, List box contains a data like C:\dir\filename.ext i used the F5 and checked the value of FName i am getting Error symbol "FName" not found. Is the code correct to get the value of the selected item from the list box ??

        L 1 Reply Last reply
        0
        • V VinayCool

          Hi Nibu thomas, List box contains a data like C:\dir\filename.ext i used the F5 and checked the value of FName i am getting Error symbol "FName" not found. Is the code correct to get the value of the selected item from the list box ??

          L Offline
          L Offline
          Laxman Auti
          wrote on last edited by
          #4

          Vinay wrote:

          List box contains a data like C:\dir\filename.ext

          The Fname should be in the format of '\\' instead of '\' for e.g C:\\path\\filename.extension instead of C:\path\filename.extension Knock out 't' from can't, You can if you think you can :cool:

          V R 2 Replies Last reply
          0
          • L Laxman Auti

            Vinay wrote:

            List box contains a data like C:\dir\filename.ext

            The Fname should be in the format of '\\' instead of '\' for e.g C:\\path\\filename.extension instead of C:\path\filename.extension Knock out 't' from can't, You can if you think you can :cool:

            V Offline
            V Offline
            VinayCool
            wrote on last edited by
            #5

            Hi Laxman, I cant change the file path,because the items in the list box contains a data like D:\folder\folder\00000301\0123.txt Can u please tell me how to open the file ???

            L 1 Reply Last reply
            0
            • V VinayCool

              Hi Laxman, I cant change the file path,because the items in the list box contains a data like D:\folder\folder\00000301\0123.txt Can u please tell me how to open the file ???

              L Offline
              L Offline
              Laxman Auti
              wrote on last edited by
              #6

              Vinay wrote:

              Hi Laxman, I cant change the file path,because the items in the list box contains a data like D:\Parichay\Box01\00000301\0123.txt Can u please tell me how to open the file ???

              void CSearchDlg::OnDblclkSout() { int d; d=m_SOUT.GetCurSel(); CString FName; m_SOUT.GetText(d,FName); modify the FName path here as above post ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL); } Knock out 't' from can't, You can if you think you can :cool:

              V 1 Reply Last reply
              0
              • L Laxman Auti

                Vinay wrote:

                List box contains a data like C:\dir\filename.ext

                The Fname should be in the format of '\\' instead of '\' for e.g C:\\path\\filename.extension instead of C:\path\filename.extension Knock out 't' from can't, You can if you think you can :cool:

                R Offline
                R Offline
                Rudolf Jan
                wrote on last edited by
                #7

                This answer is not correct. The double backslash is only neccessary if you use a literal string in your programming code. Here you just read the name entered in a listbox. I recoomend to use the source level debuger and place some breakpoints. You should always check following things: is the function actually called? Does the Listbox provide the correct handle? (I also recommend to handle LB_ERR so you see it if something is wrong)Do you get the correct string back from the listbox? Is your call to ShellExecute handled correctly? Does it give back an error message? I really do not understand why you need to ask such a question in the forum. You reaaly should invest some time to learn how to use the source level debugger and how to read the documentation.

                1 Reply Last reply
                0
                • L Laxman Auti

                  Vinay wrote:

                  Hi Laxman, I cant change the file path,because the items in the list box contains a data like D:\Parichay\Box01\00000301\0123.txt Can u please tell me how to open the file ???

                  void CSearchDlg::OnDblclkSout() { int d; d=m_SOUT.GetCurSel(); CString FName; m_SOUT.GetText(d,FName); modify the FName path here as above post ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL); } Knock out 't' from can't, You can if you think you can :cool:

                  V Offline
                  V Offline
                  VinayCool
                  wrote on last edited by
                  #8

                  Hi Laxman, I dont know how to do that can u please tell me how to alter the file name in the runtime...

                  L M 2 Replies Last reply
                  0
                  • V VinayCool

                    Hi Laxman, I dont know how to do that can u please tell me how to alter the file name in the runtime...

                    L Offline
                    L Offline
                    Laxman Auti
                    wrote on last edited by
                    #9

                    vinaycool wrote:

                    I dont know how to do that can u please tell me how to alter the file name in the runtime...

                    Sorry , this is too much :| Knock out 't' from can't, You can if you think you can :cool:

                    1 Reply Last reply
                    0
                    • V VinayCool

                      Hi Laxman, I dont know how to do that can u please tell me how to alter the file name in the runtime...

                      M Offline
                      M Offline
                      Maxwell Chen
                      wrote on last edited by
                      #10

                      vinaycool wrote:

                      how to alter the file name

                      #include <cstdio> int rename(const char* oldname, const char* newname);


                      Maxwell Chen

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups