Results 1 to 9 of 9

Thread: [RESOLVED] Shell II

  1. #1

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Resolved [RESOLVED] Shell II

    Hello !

    I was attempting to launch the Internet Explorer 'Organize Favorites' window using the code below.

    VB Code:
    1. Shell "RunDll32.exe shdocvw.dll,DoOrganizeFavDlg"

    The Dialog Box appears successfully. but the problem is the dialog box shows the Desktop Items insted of Favorites

    See the screen shot for a detail view.

    Please help me to list the favorites items in the Organize Favorites dialog.
    Attached Images Attached Images  

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Shell II

    hmmm does the same on mine.. and looking around the net.. thats the command!?
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Red face Re: Shell II

    Quote Originally Posted by Static
    hmmm does the same on mine.. and looking around the net.. thats the command!?
    Hai static !

    I just double checked now. result is same.
    here i just copied the code again form the program.

    VB Code:
    1. Shell "RunDll32.exe shdocvw.dll,DoOrganizeFavDlg"

    Any diffrents?

    remark :- as soon as i launch the program it realy lists the favorites and next second it displays the desktop items.

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Shell II

    Yep.. u are correct.. same thing happens here.

    are u on a work pc? I wonder if its because of diff users... Very Odd!
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Shell II

    are u on a work pc?
    No. it is my personal computer and only one account.

  6. #6
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Shell II

    Got me!! lol.. ANyone else want to chime in on this one?
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  7. #7
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Shell II

    ok, this seems to work:
    VB Code:
    1. Private Const MAX_PATH As Long = 260
    2. Private Const S_OK As Long = 0
    3. Private Const SHGFP_TYPE_CURRENT As Long = &H0
    4. Private Const CSIDL_FAVORITES As Long = &H6
    5.    
    6. Private Declare Function DoOrganizeFavDlg Lib "shdocvw" _
    7.   (ByVal hWnd As Long, _
    8.    ByVal lpszRootFolder As String) As Long
    9.  
    10. Private Declare Function SHGetFolderPath Lib "shfolder" _
    11.    Alias "SHGetFolderPathA" _
    12.   (ByVal hwndOwner As Long, _
    13.    ByVal nFolder As Long, _
    14.    ByVal hToken As Long, _
    15.    ByVal dwReserved As Long, _
    16.    ByVal lpszPath As String) As Long
    17.  
    18. Private Sub Command1_Click()
    19.     DoOrganizeFavDlg hWnd, GetFolderPath(CSIDL_FAVORITES)
    20. End Sub
    21.  
    22. Private Function GetFolderPath(CSIDL As Long) As String
    23.    Dim sPath As String, sTmp As String
    24.    
    25.    sPath = Space$(MAX_PATH)
    26.    If SHGetFolderPath(Me.hWnd, CSIDL, 0&, SHGFP_TYPE_CURRENT, sPath) = S_OK Then
    27.        GetFolderPath = Left$(sPath, InStr(sPath, Chr$(0)) - 1)
    28.    End If
    29. End Function
    Stripped down version of: http://vbnet.mvps.org/index.html?cod...shdocvwfav.htm

  8. #8
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Shell II

    In fact, try just doing:
    VB Code:
    1. Private Declare Function DoOrganizeFavDlg Lib "shdocvw" ( _
    2.                 ByVal hWnd As Long, _
    3.                 ByVal lpszRootFolder As String) As Long
    4.  
    5. Private Sub Command1_Click()
    6.     DoOrganizeFavDlg Me.hWnd, vbNullString
    7. End Sub
    works on mine!

  9. #9

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Talking Re: Shell II

    Quote Originally Posted by bushmobile
    In fact, try just doing:
    VB Code:
    1. Private Declare Function DoOrganizeFavDlg Lib "shdocvw" ( _
    2.                 ByVal hWnd As Long, _
    3.                 ByVal lpszRootFolder As String) As Long
    4.  
    5. Private Sub Command1_Click()
    6.     DoOrganizeFavDlg Me.hWnd, vbNullString
    7. End Sub
    works on mine!
    Hai bushmobile.

    i feel i did not notify by mail of your last 2 posts. (but vbf is great)
    i almost given up this thread. but unexpectedly i had to come with code from an out side forum. but i found your code (quoted) works just fine for me.
    Thanks a lot!

    Any way this is the code i bought from an outside forum.

    VB Code:
    1. Option Explicit
    2. Private Const WM_COMMAND As Long = &H111
    3. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    4. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    5. Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As Long) As Long
    6.  
    7. Private Sub Command1_Click()
    8.     Const lngMenuID As Long = 41330
    9.     Dim lngHWnd As Long
    10.     lngHWnd = FindWindow("IEFrame", vbNullString)
    11.     If lngHWnd Then
    12.         SetForegroundWindow lngHWnd
    13.         SendMessage lngHWnd, WM_COMMAND, lngMenuID, 0
    14.     End If
    15. End Sub

    This is the result on my XP - SPK1 machine.

    after executing the code the Organize Favorites Dialog appears. then Hangs !!! an IExplorer Process is Created and It Utilizes CPU 100%.

    any way i am stay with your code (coted above). it seems very simple. hope this would work in win9x as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width