forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Opening a shortcut's properties dialog?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed May 20, 2009 8:02 pm    Post subject: Opening a shortcut's properties dialog? Reply with quote

I saw a post a long time ago here for opening the properties dialog for shortcuts, but that method will not work at all on Vista. A PureBasic user was kind enough to share his code for opening the properties dialog.

Anyone here think they can take a stab at converting it to VDS?

Code:
Procedure ShowFileProperties(hWnd, File.s)
  Protected SEI.SHELLEXECUTEINFO
  Protected Verb.s = "properties"
 
  With SEI
    \hwnd = hWnd
    \cbSize = SizeOf(SHELLEXECUTEINFO)
    \fMask = #SEE_MASK_NOCLOSEPROCESS | #SEE_MASK_INVOKEIDLIST | #SEE_MASK_FLAG_NO_UI
    \lpVerb = @Verb
    \lpFile = @File
  EndWith
 
  ShellExecuteEx_(@SEI)
EndProcedure

OpenWindow(0, 0, 0, 200, 200, "", #PB_Window_SystemMenu)

ShowFileProperties(WindowID(0), "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Calculator.lnk")


I just don't get it myself and I do use PureBasic too... I believe the ShellExecuteEx_(@SEI) is similar to our "SHELL" command.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed May 20, 2009 8:20 pm    Post subject: Reply with quote

I can convert it but instead I decided to add this ability to either my ShortCut DLL or GadgetX... I just have not decided the best place for it since it would give you the properties dialog for any file type. I seen your other post awhile back about this.
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed May 20, 2009 8:25 pm    Post subject: Re: Opening a shortcut's properties dialog? Reply with quote

Garrett wrote:


Code:
Procedure ShowFileProperties(hWnd, File.s)
  Protected SEI.SHELLEXECUTEINFO
  Protected Verb.s = "properties"
 
  With SEI
    \hwnd = hWnd
    \cbSize = SizeOf(SHELLEXECUTEINFO)
    \fMask = #SEE_MASK_NOCLOSEPROCESS | #SEE_MASK_INVOKEIDLIST | #SEE_MASK_FLAG_NO_UI
    \lpVerb = @Verb
    \lpFile = @File
  EndWith
 
  ShellExecuteEx_(@SEI)
EndProcedure

OpenWindow(0, 0, 0, 200, 200, "", #PB_Window_SystemMenu)

ShowFileProperties(WindowID(0), "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Calculator.lnk")


I just don't get it myself and I do use PureBasic too... I believe the ShellExecuteEx_(@SEI) is similar to our "SHELL" command.


To explain what this is doing in PB... Basicly ShellExecuteEx takes a structure so the PB programmer created a User Defined Type called SEI which points to the SHELLEXECUTEINFO structure or User Defined Type and they filled it with just the values needed to tell the Windows shell that you want to see the Properties Dialog... I know the ShellExecuteEx function is a little misleading in this instance since you may be thinking but will this run the program... Well yes unless you give it other switches to tell it that you just want the associated file properties dialog.

Anyway it is not that hard to do in VDS but it would be easier to do in an External. Anyway I know how to do this without attaching ShellExecuteEx to a VDS dialog so that your program does not need a Dialog... Since most of us write utilities without a dialog Wink

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed May 20, 2009 9:03 pm    Post subject: Reply with quote

Exactly! I don't even need a window myself. It's for my program launcher that I've been working on. I thought it would simply be better to just use the windows properties dialog instead of creating my own. Why reinvent what's already there and can be used. It's just that I've been stuck on trying to get the darn properties dialog open and haven't found any solution at all. Sad

If you add it to a dll, why not both? Though, thinking about it, it's not really shortcut related, but still, might be a nice addition to both dlls.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed May 20, 2009 9:10 pm    Post subject: Reply with quote

Ok I am feeling generous today... So here it goes... Let me know how this roles in Vista Wink

Code:

#DEFINE COMMAND,SHOWFILEFOLDERPROPERTIES
ShowFileFolderProperties "C:\"

# since we don't have a User Interface we need to wait here or we will never see the Properties dialog.
wait 25 
Stop

:ShowFileFolderProperties
#--------------------------------------------------------------------------------#
#                                                                                #
# Description: Shows a File or Folder's Property dialog box                      #
#                                                                                #
# Author: Johnny Kinsey                                                          #
#                                                                                #
# Copyright © 2009 DragonSphere Software All Rights Reserved.                    #
#                                                                                #
#--------------------------------------------------------------------------------#

#Parameter1 = Path/FileName
#Paramter2 = Window Handle (optional)

%%SEE_MASK_NOCLOSEPROCESS = $00000040
%%SEE_MASK_INVOKEIDLIST = $0000000C
%%SEE_MASK_FLAG_NO_UI = $00000400

LoadLib shell32.dll
LoadLib user32.dll

   %v = properties
   %f = %1
   If @Null(%2)
     %2 = @lib(user32,GetDesktopWindow,INT,)
   End
  # Creates the SHELLEXECUTEINFO structure
  %S = @BINARY(DWORD,60)@BINARY(DWORD,@SUM(%%SEE_MASK_NOCLOSEPROCESS,%%SEE_MASK_INVOKEIDLIST,%%SEE_MASK_FLAG_NO_UI))@BINARY(DWORD,%2)@BINARY(DWORD,@ADDR("%v"))@BINARY(DWORD,@Addr("%f"))@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)
   %R = @lib(shell32,ShellExecuteEx,BOOL,INT:@Addr("%S"))
   If @Null(%R)
     error 20
   End
Exit %R

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed May 20, 2009 9:23 pm    Post subject: Reply with quote

Here's a hint... Try giving the command the physical path to the user's desktop folder Wink
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed May 20, 2009 9:40 pm    Post subject: Reply with quote

Works like a champ DragonSphere! Used it on a shortcut and not a single problem.

I can't thank you enough for this. Smile If I had any money, I'd give you wine and women in return. Wink

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed May 20, 2009 10:05 pm    Post subject: Reply with quote

Well I started messing with it and here is a version for those that want to use it with a dialog... If you have multiple monitors it's a real treat because the properties dialog will show on the same monitor of the dialog or what ever window handle that you pass it.

Code:

#DEFINE COMMAND,SHOWFILEFOLDERPROPERTIES

  DIALOG CREATE,Show Desktop Properties,-1,0,362,160
REM *** Modified by Dialog Designer on 5/20/2009 - 17:56 ***
  DIALOG ADD,BUTTON,BUTTON1,63,140,64,24,Show
  DIALOG SHOW

:evloop
  wait event
   %E = @event()
   If %E
     goto %E
   End 
goto evloop

:CLOSE
Stop


:BUTTON1BUTTON
  ShowFileFolderProperties @windir(Desktop),@WINEXISTS(Show Desktop Properties)
goto evloop

:ShowFileFolderProperties
#--------------------------------------------------------------------------------#
#                                                                                #
# Description: Shows a File or Folder's Property dialog box                      #
#                                                                                #
# Author: Johnny Kinsey                                                          #
#                                                                                #
# Copyright © 2009 DragonSphere Software All Rights Reserved.                    #
#                                                                                #
#--------------------------------------------------------------------------------#

#Parameter1 = Path/FileName
#Paramter2 = Window Handle (optional)
%%SEE_MASK_DEFAULT = $00000000
%%SEE_MASK_NOCLOSEPROCESS = $00000040
%%SEE_MASK_INVOKEIDLIST = $0000000C
%%SEE_MASK_FLAG_NO_UI = $00000400
%%SEE_MASK_HMONITOR = $00200000
%%MONITOR_DEFAULTTONEAREST = $00000002
LoadLib shell32.dll
LoadLib user32.dll

   %v = properties
   %f = %1
   If %2
     If @Greater(@Pos(@chr(37),%2),0)
        %2 = @strdel(%2,1,1)
     End
     %%fMask = @SUM(%%SEE_MASK_DEFAULT,%%SEE_MASK_NOCLOSEPROCESS,%%SEE_MASK_INVOKEIDLIST,%%SEE_MASK_FLAG_NO_UI,%%SEE_MASK_HMONITOR)
   Else
     %%fMask = @SUM(%%SEE_MASK_DEFAULT,%%SEE_MASK_NOCLOSEPROCESS,%%SEE_MASK_INVOKEIDLIST,%%SEE_MASK_FLAG_NO_UI,%%SEE_MASK_HMONITOR)
     %2 = @lib(user32,GetDesktopWindow,INT,)
   End
   %M = @lib(user32,MonitorFromWindow,INT,INT:%2,INT:%%MONITOR_DEFAULTTONEAREST)
   
  # Creates the SHELLEXECUTEINFO structure
  %S = @BINARY(DWORD,60)@BINARY(DWORD,%%fMask)@BINARY(DWORD,%2)@BINARY(DWORD,@ADDR("%v"))@BINARY(DWORD,@Addr("%f"))@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,%M)@BINARY(DWORD,0)
   %R = @lib(shell32,ShellExecuteEx,BOOL,INT:@Addr("%S"))
   If @Null(%R)
     error 20
   End
Exit %R


Have fun Wink

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group