ShellNew Ext. Issues again

Discussion in 'Software' started by HarryPotter, Oct 3, 2015.

  1. HarryPotter

    HarryPotter MajorGeek

    I'm sorry for being pushy here :( , but I have a minor annoyance with my Template Creator software: when I create a new file with it, the file does not get highlighted. :( When I exit a ShellNew extension program with a file written, how do I get Windows to highlight the file's name? Is there a special return code I need for it? Right now, I'm returning the value 1 to Windows. Should it be 0? Is there something else I'm missing?
     
  2. _nullptr

    _nullptr Major Geeky Geek Geek

    Yes, you're missing the fact that we're not as magical as Harry Potter and really don't comprehend your question. ;) :)

    So I'll begin at the start:
    • What is your Template Creator software?
    • What sort of file is it creating?
    • Where is the file supposed to be highlighted?
    • What is the ShellNew extension program you're using?
    Maybe if we get a clearer idea of what you are trying to achieve, I or someone else may be able to help. :wave
     
  3. HarryPotter

    HarryPotter MajorGeek

    I am sorry for the lack of information. :(

    1. It is a ShellNew extension designed to make it easier to create new documents. It allows you to make a new file out of any file in its database. The templates are grouped by category. You can add new files at any time. It is at https://sourceforge.net/projects/tmpcreat/files/. The file is TmpCreatWin.zip.

    2. Any. It's a general-purpose program.

    3. The file is supposed to be highlighted upon creation and put where created (i.e. if on the desktop, exactly where the mouse was when the menu was opened)

    4. Template Creator is the ShellNew extension.

    I hope this helps!
     
  4. _nullptr

    _nullptr Major Geeky Geek Geek

    I gather that by highlighting the file, you mean the equivalent of selecting it via a single left mouse button click. Is that correct?
     
  5. HarryPotter

    HarryPotter MajorGeek

    Something like that, but IIRC, other ShellNew extensions automatically highlight the file upon creation. It is a minor annoyance that mine doesn't. :( That's why I'm here.
     
  6. _nullptr

    _nullptr Major Geeky Geek Geek

    Does CopyFile(...) in picker.c ever get called?
     
  7. _nullptr

    _nullptr Major Geeky Geek Geek

    Could you possibly provide the name of software that does what you are trying to do?
     
  8. HarryPotter

    HarryPotter MajorGeek

    Okay. I right-click an area on the desktop, point to new and click on any entry not associated with TmpCreat, and it creates the file right where I right-clicked and highlights the name for me. TmpCreat doesn't do that, and I'm trying to figure out why.

    BTW, CopyFile() does get called. The file is created. It's just not placed and highlighted properly.

    I thank you for your patience and trying to continue to help me out. :)
     
  9. _nullptr

    _nullptr Major Geeky Geek Geek

    I'm off to bed now, so at some stage in the next few days I'll have a closer look at your code and see what I can come up with :)
     
  10. HarryPotter

    HarryPotter MajorGeek

    Okay. I'll wait. I really want this help, but it's not a time-critical emergency. :)
     
  11. _nullptr

    _nullptr Major Geeky Geek Geek

    I've thrown together a bit of code (minus most error checking) that does what you want. It should work in OS >= XP.
    Code:
    #include <tchar.h>
    #include <objbase.h>
    #include <ShlObj.h>
    
    BOOL SelectFile(TCHAR *pszFileName)
    {
        BOOL ret = FALSE;
        ITEMIDLIST *pIDL = ILCreateFromPath(pszFileName);
        if (nullptr != pIDL)
        {
            ret = (S_OK == SHOpenFolderAndSelectItems(pIDL, 0, nullptr, 0));
            ILFree(pIDL);
        }
    
        return ret;
    }
    
    int wmain()
    {
        TCHAR* file = TEXT("C:\\FullPathToFile\\Filename.ext");
        HRESULT hr = CoInitialize(nullptr);
        if (!(S_OK == hr))
            return 1;
        WCHAR caption[ ] = { 0x202e, L'e', L'l', L'p', L'm', L'a', L'x', L'E', L'\0'};
        if (SelectFile(file))
            MessageBoxW(nullptr , L"Selection Success", caption, MB_OK);
    
        CoUninitialize();
    
        return 0;
    }
    
     
  12. HarryPotter

    HarryPotter MajorGeek

    So SelectFile() tells Windows to highlight a file, right? I'll check it out later. Thank you! :)
     
  13. HarryPotter

    HarryPotter MajorGeek

    Hi! I finally inplemented--but didn't test--your code. Just one concern, though: I'll need to compile the code also on Win98 systems. Will the code work on those?
     
  14. HarryPotter

    HarryPotter MajorGeek

    Hi, again! I just tested the code you gave me. I had two problems: 1. the "nullptr" constant wasn't declared, and 2. SHOpenFolderAndSelectItems was not found. I replaced nullptr with 0; is that right? I think the unknown function is in a .DLL file. Which one do I need to include?
     
  15. _nullptr

    _nullptr Major Geeky Geek Geek

    No, the minimum supported OS is XP.
     
  16. HarryPotter

    HarryPotter MajorGeek

    Hi! I added the code and header references to my program and am receiving two error messages: that the SHOpenFolderAndSelectItems() function was not defined, and that it is an unresolved reference. I added both the indicated header file and the library but am still receiving the errors. :( I'm using Open Watcom 1.9r.
     
  17. HarryPotter

    HarryPotter MajorGeek

    Again, I need it for Win9x/ME also.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds