Announcement

Collapse
No announcement yet.

Files to Programs links

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Aldo Cavini
    replied
    Peter, Wayne --

    sorry I'm a registry novice I looked through the Win32Api help file and it is not easy to understand. Peter, I didn't know how the SendTo menu work; now I'm puzzled on two more questions:
    1- How to create a shortcut file by program
    2- Where to write it - that is, how to get the USER path to reach the SendTo folder

    (and, of course, I still need help on the automatic extension files process on esplorer).

    Thanks


    ------------------

    Leave a comment:


  • Wayne Diamond
    replied
    aldo,
    have a look at http://www.powerbasic.com/support/pb...ad.php?t=22943
    "registry.inc - easy general purpose registry access"

    best regards,
    wayne


    ------------------

    Leave a comment:


  • Peter P Stephensen
    replied
    I work with SendTo without using the registry:
    Just copy a shortcut to your program to the SendTo-folder.
    In your program you can obtain the file name by using command$.
    If multiple files is selected, you get a " "-delim. list.
    The only problem is that if too many files is selected, an
    error occurs.

    Regards
    Peter

    ------------------

    Leave a comment:


  • Aldo Cavini
    replied
    Peter, thanks a lot - Now I know the correct way to manage the registry entries.

    Now I need the registry key names to do what I want. That is, the keys to add an entry to the SendTo menu, and the keys to link a file extension to an application program.

    ------------------

    Leave a comment:


  • Peter P Stephensen
    replied
    Is this what you are looking for?

    Regards
    Peter

    Code:
    function SetRegistry(byval hKey as long, byval sSubKey as string, byval sValueName as string, byval sValue as string) as long
     
        local hResultKey as long
        local result as long
        local zText as asciiz * 2048
     
    '   ** Create the section
        if RegCreateKeyEx(hKey, sSubKey & chr$(0), 0, "", _
                        %REG_OPTION_NON_VOLATILE, %KEY_ALL_ACCESS, BYVAL %NULL, _
                        hResultKey, Result) <> %ERROR_SUCCESS then exit function
     
    '   ** Save the value for the key
        if len(sValue) then
            zText = sValue
            RegSetValueEx hResultKey, sValueName+CHR$(0), 0, %REG_SZ, zText, LEN(sValue)+1
        else
            RegSetValueEx hResultKey, sValueName+CHR$(0), 0, %REG_SZ, BYVAL %NULL, 0
        end if
     
    '   ** Close the key
        RegCloseKey hResultKey
         
        function = 1
     
    end function
     
    function GetRegistry(byval hKey as long, byval sSubKey as string, byval sValueName as string, sValue as string) as long
     
        local hResultKey as long
        local result  as long
        local keytype as long
        local buffer as string * 2048
        local size as long
     
    '   ** Open the section
        if RegOpenKeyEx(hKey, sSubKey & chr$(0), 0, %KEY_ALL_ACCESS, hResultKey) <> %ERROR_SUCCESS then exit function
     
    '   ** Get the key value
        size = SIZEOF(buffer)
        result = RegQueryValueEx(hResultKey, sValueName + CHR$(0), 0, keytype, buffer, size)
     
    '   ** Close the registry
        RegCloseKey hResultKey
     
    '   ** Exit if not successful or nothing there
        if (result <> %ERROR_SUCCESS) or (size = 0) then exit function
     
    '   ** Return the data
        if keytype = %REG_SZ then
            sValue = left$(buffer, size - 1)
        else
            sValue = left$(buffer, size)
        end if
     
        function = 1
     
    end function
    ------------------

    Leave a comment:


  • Aldo Cavini
    started a topic Files to Programs links

    Files to Programs links

    I would like to add a PB program the two following capabilities (bBoth capabilities should be enabled/removed as a response to DDT checkboxes):

    1 - Add/remove an entry to the Send To menu
    2 - Create/delete the automatic link to the file extension (double-clicks on explorer)

    I think I must use the registry, both write and read (read to get the initial status of my checkboxes inside the DDT). Can someone tell me the main "tricks" to do this? Any help would be greatly appreciated.

    Aldo

    ------------------
Working...
X
😀
🥰
🤢
😎
😡
👍
👎