open explorer to dir when user double clicks

This is a discussion on open explorer to dir when user double clicks within the Windows Programming forums, part of the Platform Specific Boards category; hey..i've written a program that searches non-executable files for a certain string or strings and then outputs which file(s) contain ...

  1. #1
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378

    open explorer to dir when user double clicks

    hey..i've written a program that searches non-executable files for a certain string or strings and then outputs which file(s) contain these strings to a listbox. what i'd like to do now is to allow the user to double click on an item and have that open up an explorer window to the folder that contains the file that has been found.
    any ideas on how to do this?

    or even, how could i add a horizontal scrollbar to the listbox? i've tried adding WS_HSCROLL but that didn't do it.

    thanks
    Last edited by willc0de4food; 04-17-2006 at 11:30 PM.
    Registered Linux User #380033. Be counted: http://counter.li.org

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You can use the Explorer.exe /select command line syntax. Given a file, this command will open the containing folder and select the file. This is what Firefox does when you click on 'Open Containing Folder' in the download manager. Here is an example:
    Code:
    #include <windows.h>
    
    int main(void)
    {
    	STARTUPINFO         si = { sizeof(STARTUPINFO) };
    	PROCESS_INFORMATION pi = { 0 };
    
    	CreateProcess(NULL, TEXT("Explorer.exe /select,C:\\Windows\\Win.ini"), NULL,
    	              NULL, FALSE, 0, NULL, NULL, &si, &pi);
    
    	CloseHandle(pi.hThread);
    	CloseHandle(pi.hProcess);
    
    	return 0;
    }

  3. #3
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    mm...so with LBS_NOTIFY, is it possible to distinguish between a single and double click? because i dont want anything to happen if the user simply clicks on an item. but if a double click occurs, i want the process to execute.?

    thanks :]



    HAH....i hate it when this happens.
    yes, LBN_DBLCLK
    sigh.. lol
    Last edited by willc0de4food; 04-18-2006 at 12:16 AM.
    Registered Linux User #380033. Be counted: http://counter.li.org

  4. #4
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    one more question....can i create a tooltip like thing so that when the user mouses over an item and see the full path before they double click it?
    Registered Linux User #380033. Be counted: http://counter.li.org

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    If you use a list-view control with the LVS_EX_LABELTIP extended style, tooltips are automatic. The older listbox does not have built-in tool tips and would require you to manually implement them using subclassing. I'm sure there are implementations out there.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No Match For Operator+ ???????
    By Paul22000 in forum C++ Programming
    Replies: 24
    Last Post: 05-14-2008, 11:53 AM
  2. Conversion From C++ To C
    By dicon in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 03:54 PM
  3. expected primary expression
    By mju4t in forum C Programming
    Replies: 2
    Last Post: 03-27-2007, 07:59 PM
  4. Unknown Math Issues.
    By Sir Andus in forum C++ Programming
    Replies: 1
    Last Post: 03-06-2006, 06:54 PM
  5. SSH Hacker Activity!! AAHHH!!
    By Kleid-0 in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 03-06-2005, 03:53 PM

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