News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

IShellFolder::Whatever!!! HELP

Started by xandaz, October 24, 2011, 09:29:38 PM

Previous topic - Next topic

xandaz

    How does one use the IShellFolder funtions? I saw that you need to SHGetDesktopFolder to get the adress to it but how does one then use the functions? Anyone have any examples? Thanks in advance. Bye

ToutEnMasm


You need include files with the defines of the interface.
The shobjidl.sdk have it .
there is about a thousand of interfaces translated in the "ready to use sdk"
http://www.masm32.com/board/index.php?topic=8542.msg62123#msg62123
The translation  follow  a rule to name all things.
If the interface is named  IShellFolder:
                                   You must create  a dword in data named  ppvIShellFolder
invoke SHGetDesktopFolder
put the value in ppvIShellFolder
It's finish.You can now use all the functions of the interfce as normal API with just a little difference
The name of the interface replace invoke  (IShellFolder is a macro who call invoke)

IShellFolder Release


ToutEnMasm


xandaz

   Thanks a lot Tout.... I'm looking into it. Praise M32 Forum.

xandaz

   I've seen how u do it however am having trouble so went searching for another mo. I found a shlobj.inc by Bill T. I has an enormous amount of conflicts so i had to make another include with only the declarations in needed. However, for the IShellFolder.GetDisplayNameOf, i found that the prototype has an extra dword and theres an AddRef and Query and unknown declarations in the IShellFolder Struct that are undefined symbols. I tried to change using dwords but the prog crashes. I'm going backk to your rtuSDK. Thanks

xandaz

   i found that windows.inc and shlobj structure declaration are bit different ( no significantelly ) but enough for ml to error. It gives non-benign strucutre redefs.
   For examplle
SHITEMID STRUCT [color=Blue]in windows.inc[/color]
cb dw ?
abID db 1 dup(?)
S...ENDS

SHITEMID struct DWORD[color=Orange] in shlobj.inc[/color]
cb WORD ?
abID BYTE ?
SHITEMID ends

   I wonder if there's actually a shlobj.inc that goes along with masm's windows.inc that is distributed. Thanks

dedndave

it may be that the constants and structures are missing
or, it may be that the constants and structures are defined, but the prototypes are missing   :P

you may not have much luck if you search for "shlobj.inc"
try searching for "shlobj.h", instead - the C-equivalent of an INC file

and - you might try Andreas' WinInc package...
http://www.japheth.de/WinInc.html

xandaz

   well dave.... there are slight differences in the structures declarations between windows.inc and shlobj.inc. Some are only of the sort:
SHITEMID Struct DWORD
    cb  WORD ?
    abID BYTE ?
SH.... ENDS

and
in windows.inc
SHITEMID struct
     cb dw ?
    abID db 1 dup(?)
SH... ENDS

    I fixed part and then proceeded to remove from shlobj those that were already in windows.inc. I'm not so sure anymore that such differences can turn into error.
Anyway there's a part of shlobj that goes:
IShellFolder struct DWORD
QueryInterface IUnknown_QueryInterface ?
AddRef IUnknown_AddRef ?
Release IUnknown_Release ?
...it errors on this reporting syntax error. Do you know how to fix this.... i'm getting desperate with this interfaces stuff. Thanks

xandaz

    Also, some protos differ from what's shown in API Ref. For example IShellFolder.GetDisplayNameOf has a :DWORD defore the ITEMIDLIST. I'm sure that there's a logical reason for this other than a careless mistake. I found two shlobj that look the same.

dedndave

http://msdn.microsoft.com/en-us/library/windows/desktop/ms680509%28v=vs.85%29.aspx

QueryInterface, AddRef, and Release appear to be functions (not data types) - defined in Unknwn.h
this is all COM stuff   :P
not for the faint of heart

structure definitions need an ENDS line, as well...
IShellFolder struct DWORD

IShellFolder ends


http://svn.assembla.com/svn/fragzone_lps/Project/TGE_1_5_2/lib/MSPlatformSDK/Include/Unknwn.h

beyond that - better gets someone that knows COM   :P
Donkey or maybe baltoro can help

xandaz

   yes... my heart is week for now... but not long ago it was weaker... yes they're all functions. what's strange is that IUnknow_Addref is like this wierd macro. Where it appears that IUnknown is a GUID and AddRef should represent the function. Well, i'm not so sure about what i just said. Just takle a look
; IShellFolder
;-------------------------------------------------------------------------------------------------

SHGDN_NORMAL     equ 0
SHGDN_INFOLDER          equ 1     
SHGDN_FORPARSING     equ 8000h 

SHCONTF_FOLDERS         equ 32
SHCONTF_NONFOLDERS      equ 64
SHCONTF_INCLUDEHIDDEN   equ 128

SFGAO_CANCOPY           equ DROPEFFECT_COPY
SFGAO_CANMOVE           equ DROPEFFECT_MOVE
SFGAO_CANLINK           equ DROPEFFECT_LINK
SFGAO_CANRENAME         equ 00000010h     
SFGAO_CANDELETE         equ 00000020h     
SFGAO_HASPROPSHEET      equ 00000040h   
SFGAO_DROPTARGET equ 00000100h
SFGAO_CAPABILITYMASK    equ 00000177h
SFGAO_LINK              equ 00010000h
SFGAO_SHARE             equ 00020000h
SFGAO_READONLY          equ 00040000h
SFGAO_GHOSTED           equ 00080000h 
SFGAO_DISPLAYATTRMASK   equ 000F0000h
SFGAO_FILESYSANCESTOR   equ 10000000h   
SFGAO_FOLDER            equ 20000000h     
SFGAO_FILESYSTEM        equ 40000000h     
SFGAO_HASSUBFOLDER      equ 80000000h     
SFGAO_CONTENTSMASK      equ 80000000h
SFGAO_VALIDATE          equ 01000000h   
SFGAO_REMOVABLE         equ 02000000h   

LPSHELLFOLDER typedef DWORD
LPPSHELLFOLDER typedef DWORD

IShellFolder_ParseDisplayNameProto typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :LPPENUMIDLIST, :DWORD
IShellFolder_EnumObjectsProto typedef proto :DWORD, :DWORD, :DWORD, :LPPENUMIDLIST
IShellFolder_BindToObjectProto typedef proto :DWORD, :LPITEMIDLIST, :DWORD, :DWORD, :DWORD
IShellFolder_BindToStorageProto typedef proto :DWORD
IShellFolder_CompareIDsProto typedef proto :DWORD, :DWORD, :LPITEMIDLIST, :LPITEMIDLIST
IShellFolder_CreateViewObjectProto typedef proto :DWORD, :DWORD, :DWORD, :DWORD
IShellFolder_GetAttributesOfProto typedef proto :DWORD, :DWORD, :LPITEMIDLIST, :DWORD
IShellFolder_GetUIObjectOfProto typedef proto :DWORD, :DWORD, :DWORD, :LPPITEMIDLIST, :DWORD, :DWORD, :DWORD
IShellFolder_GetDisplayNameOfProto typedef proto :DWORD, :LPITEMIDLIST, :DWORD, :LPSTRRET
IShellFolder_SetNameOfProto typedef proto :DWORD, :DWORD, :LPITEMIDLIST, :DWORD, :DWORD, :LPPITEMIDLIST

IShellFolder_ParseDisplayName typedef ptr IShellFolder_ParseDisplayNameProto
IShellFolder_EnumObjects typedef ptr IShellFolder_EnumObjectsProto
IShellFolder_BindToObject typedef ptr IShellFolder_BindToObjectProto
IShellFolder_BindToStorage typedef ptr IShellFolder_BindToStorageProto
IShellFolder_CompareIDs typedef ptr IShellFolder_CompareIDsProto
IShellFolder_CreateViewObject typedef ptr IShellFolder_CreateViewObjectProto
IShellFolder_GetAttributesOf typedef ptr IShellFolder_GetAttributesOfProto
IShellFolder_GetUIObjectOf typedef ptr IShellFolder_GetUIObjectOfProto
IShellFolder_GetDisplayNameOf typedef ptr IShellFolder_GetDisplayNameOfProto
IShellFolder_SetNameOf typedef ptr IShellFolder_SetNameOfProto

IShellFolder struct DWORD
QueryInterface IUnknown_QueryInterface ?
AddRef IUnknown_AddRef ?
Release IUnknown_Release ?
ParseDisplayName IShellFolder_ParseDisplayName ?
EnumObjects IShellFolder_EnumObjects ?
BindToObject IShellFolder_BindToObject ?
BindToStorage IShellFolder_BindToStorage ?
CompareIDs IShellFolder_CompareIDs ?
CreateViewObject IShellFolder_CreateViewObject ?
GetAttributesOf IShellFolder_GetAttributesOf ?
GetUIObjectOf IShellFolder_GetUIObjectOf ?
GetDisplayNameOf IShellFolder_GetDisplayNameOf ?
SetNameOf IShellFolder_SetNameOf ?
IShellFolder ends


;-------------------------------------------------------------------------------------------------
; Guids and Clsids


externdef CLSID_ShellDesktop:IID
externdef CLSID_ShellLink:IID

externdef IID_IUnknown:IID
externdef IID_IContextMenu:IID
externdef IID_IShellExtInit:IID
externdef IID_IShellPropSheetExt:IID
externdef IID_IExtractIcon:IID
externdef IID_IShellLink:IID
externdef IID_IShellCopyHook:IID
externdef IID_IFileViewerSite:IID
externdef IID_IFileViewer:IID
externdef IID_IEnumIDList:IID
externdef IID_IShellFolder:IID



xandaz

    I sudenlly realised that the release AddRef and Query functions are common to all interfaces and the reason its IUnknow is that IUnknow represents a variable address depending on which interfce you're using. I suppose its like this right?

xandaz

    I'm still having a hard time understanding how to make it work.

xandaz

    Why would the protos have an extra :dword on top?

qWord

Quote from: xandaz on October 29, 2011, 11:01:18 PM
    Why would the protos have an extra :dword on top?
object pointer? (this-pointer)
FPU in a trice: SmplMath
It's that simple!