Announcement

Collapse
No announcement yet.

Obtain special folder - How?

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

  • Michael Mattias
    replied
    >>Somewhere here there is

    >Oh, this is very, very useful for me [sarcasm inferred]

    It was meant to be useful - without doing it for you. That's what "Search" is for. try "shortcut" as a search term.

    Leave a comment:


  • Alex Trenty
    replied
    Originally posted by Michael Mattias View Post
    ShGetFolderPath (use CSIDL_DESKTOP and/or CSIDL_STARTUP) will give you folder names.
    Thanks, I know it.

    Shortcuts are *.lnk files.
    Much thanks, I know it too.

    Somewhere here there is
    Oh, this is very, very useful for me...

    Knock yourself out.
    Sorry for my bad English, thnks for new idioma "Good bye"

    Leave a comment:


  • Alex Trenty
    replied
    Originally posted by Gary Beene View Post
    Here's some information, plus a compilable example on getting folder names.
    Thanks, Gary, I know it and use for several years. My problem is to enumerate all links (shortcuts) and get their program's names.

    Leave a comment:


  • Alex Trenty
    replied
    Originally posted by Herman Kieskamp View Post
    Thanks, Herman, I know and use this method. It's problem for me to read link's components.

    Leave a comment:


  • Alex Trenty
    replied
    Originally posted by Michael Mattias View Post
    I don't suppose you'd care that willy-nilly deleting program files is a good way to end up with a bunch of "orphan'' DLLs and registry entries, would you?

    If you are looking for an analogy close to home....... it's kind of like all the orphaned republics of the former USSR. The links to Moscow got servered and sure enough, you can't control anything anymore.
    Oh, don't worry, nothing DLL nor registry entries. Before setting up the new version of our popular antivirus "Doctor Web", it's necessary to delete all what was created to support the old version. I simply find the way to make that job in my support program.
    What about my native Moscow, Michael, let's stay off politic here. Although, if you are familiar in Russian, welcome to http://av.cemi.rssi.ru.

    Leave a comment:


  • Gary Beene
    replied
    Here's some information, plus a compilable example on getting folder names. What you do when you get there, is up to you - practice safe deleting!

    Code:
    Special Folders
    
    'Windows API can identify folders set aside for special purposes
    
    'Primary Code:
    Dim strPath As Asciiz * %MAX_PATH
    SHGetFolderPath(0, %CSIDL_DESKTOPDIRECTORY, 0, 0, strPath)
    
    'Here are a few of the equates to retrieve the corresponding directory:
    'See the Win32API.INC file for addiitional equates.
    '%CSIDL_DESKTOPDIRECTORY   DeskTop
    '%CSIDL_PROGRAM_FILES       Program Files
    '%CSIDL_SYSTEM                System folder
    '%CSIDL_WINDOWS            Windows directory
    '%CSIDL_DESKTOP               <desktop>
    '%CSIDL_PROGRAMS            Start Menu\Programs
    '%CSIDL_PERSONAL            My Documents
    '%CSIDL_STARTUP             Start Menu\Programs\Startup
    
    'Compilable Example:
    #Compile Exe
    #Dim All
    #Include "Win32API.inc"
    Global hDlg As Dword
    Function PBMain() As Long
       Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
       Control Add Button, hDlg, 100,"Push", 50,10,100,20
       Dialog Show Modal hDlg Call DlgProc
    End Function
    CallBack Function DlgProc() As Long
       If CB.Msg = %WM_Command AND CB.Ctl = 100 AND CB.Ctlmsg = %BN_Clicked Then
          Local sPath As Asciiz * %MAX_PATH, temp$
          SHGetFolderPath(0, %CSIDL_DeskTopDirectory, 0, 0, sPath) : temp$ = temp$ + sPath + $crlf
          SHGetFolderPath(0, %CSIDL_Program_Files, 0, 0, sPath) : temp$ = temp$ + sPath + $crlf
          SHGetFolderPath(0, %CSIDL_System, 0, 0, sPath) : temp$ = temp$ + sPath + $crlf
          SHGetFolderPath(0, %CSIDL_Windows, 0, 0, sPath) : temp$ = temp$ + sPath + $crlf
          SHGetFolderPath(0, %CSIDL_DeskTop, 0, 0, sPath) : temp$ = temp$ + sPath + $crlf
          SHGetFolderPath(0, %CSIDL_Programs, 0, 0, sPath) : temp$ = temp$ + sPath + $crlf
          SHGetFolderPath(0, %CSIDL_Personal, 0, 0, sPath) : temp$ = temp$ + sPath + $crlf
          SHGetFolderPath(0, %CSIDL_Startup, 0, 0, sPath) : temp$ = temp$ + sPath + $crlf
          SHGetFolderPath(0, %CSIDL_Startup, 0, 0, sPath) : temp$ = temp$ + sPath + $crlf
          MsgBox temp$
       End If
    End Function

    Leave a comment:


  • Herman Kieskamp
    replied
    Hi Alex,

    Check out this simpler version:



    MCM: your example is more a bit one-way example; russia->orphans oke(smart guy will recover from uninstall.log or replace deleted link), orphans->Russia no-go (roadsigns chopped down(shortcut deleted).

    Leave a comment:


  • Michael Mattias
    replied
    I don't suppose you'd care that willy-nilly deleting program files is a good way to end up with a bunch of "orphan'' DLLs and registry entries, would you?

    If you are looking for an analogy close to home....... it's kind of like all the orphaned republics of the former USSR. The links to Moscow got servered and sure enough, you can't control anything anymore.

    MCM

    Leave a comment:


  • Michael Mattias
    replied
    ShGetFolderPath (use CSIDL_DESKTOP and/or CSIDL_STARTUP) will give you folder names.

    Shortcuts are *.lnk files. Somewhere here there is code to resolve shortcut files to the associated executable program file name.

    Knock yourself out.

    MCM
    Last edited by Michael Mattias; 4 Aug 2009, 01:44 PM.

    Leave a comment:


  • Alex Trenty
    started a topic Obtain special folder - How?

    Obtain special folder - How?

    "Create... create..." But what must I do to obtain any special folder and DELETE part of it?
    For example, I want obtain the Desktop, find all shortcuts to any progname, such as "C:\BlaBla\prog.exe /par1 ...", and delete.
    Then, obtain the Startup folder, find all links to that progname, and delete.
    I saw pbcc code example shown in http://www.powerbasic.com/support/pb...ad.php?t=23057 but, in first, there is hard mistake there (the construction IF p$<>" THEN is incorrect, doublequater need be shown as CHR$(34)). And in second, since 2001 there are many changes in win32api.inc.
    I'm not guru enough with CoCreateInstance etc, maybe somebody solves such problem?
    Regards, Alex Trenty
    P.S. Sorry, I forgot to say about the platform. The result must work on 98SE/Me/2k/XP.
    Last edited by Alex Trenty; 4 Aug 2009, 01:41 PM. Reason: I forgot to say about the platform
Working...
X