Thank you John.
José, is that how you would have implemented it?
José, is that how you would have implemented it?
' ======================================================================================== ' Selects a string and scroll it into view, if necessary. When the new string is selected, ' the list box removes the highlight from the previously selected string. ' ======================================================================================== 'FUNCTION ListBox_SetCurSel (BYVAL hListBox AS DWORD, BYVAL Index AS LONG) AS LONG ' FUNCTION = SendMessage(hListBox, IIF&((GetWindowLong(hListBox, %GWL_STYLE) AND %LBS_MULTIPLESEL), %LB_SETSEL, %LB_SETCURSEL), Index, 0) 'END FUNCTION ' FUNCTION ListBox_SetCurSel (BYVAL hListBox AS DWORD, BYVAL Index AS LONG) AS LONG if (GetWindowLong(hListBox, %GWL_STYLE) AND %LBS_MULTIPLESEL) then FUNCTION = SendMessage(hListBox, %LB_SETSEL, %TRUE, Index) ' w multi-select, LAST param is INDEX 'Without this fix, the original code always returns element 0 else FUNCTION = SendMessage(hListBox, %LB_SETCURSEL, Index, 0) ' w single-select, INDEX is second-to-last param, and last param must be 0 end if END FUNCTION
DECLARE FUNCTION GetKeyState IMPORT "USER32.DLL" ALIAS "GetKeyState" ( _ BYVAL nVirtKey AS LONG _ ' __in int nVirtKey ) AS LONG ' SHORT ' ) AS INTEGER ' SHORT
' ======================================================================================== ' Gets the dimensions of the rectangle that bounds a list box item as it is currently ' displayed in the list box. ' ======================================================================================== #IF %DEF(%USEPBDECL) MACRO ListBox_GetItemRect(hwndCtl, index, lprc)=SendMessage(hwndCtl, %LB_GETITEMRECT, index, lprc) #ELSE FUNCTION Listbox_GetItemRect (BYVAL hListBox AS DWORD, BYVAL index AS LONG, BYREF lpRect AS RECT) AS LONG FUNCTION = SendMessage(hListBox, [B]%LB_GETITEMHEIGHT[/B], index, VARPTR(lpRect)) END FUNCTION #ENDIF
[code] ' ===================================================================================== METHOD CreateObjectFromURL ( _ ' VTable offset = 12 BYREF pwszURL AS WSTRINGZ _ ' __in LPCWSTR pwszURL , BYVAL dwFlags AS DWORD _ ' __in DWORD dwFlags , BYVAL pProps AS IPropertyStore _ ' __in IPropertyStore *pProps , BYREF pObjectType AS LONG _ ' __out MF_OBJECT_TYPE *pObjectType , BYREF ppObject AS IUnknown _ ' __out IUnknown **ppObject ) AS LONG ' HRESULT ' ===================================================================================== [/code]
UNION smiVALUE_UNION DWORD sNumber AS INTEGER ' smiINT uNumber AS DWORD ' smiUINT32 hNumber AS smiCNTR64 ' smiCNTR64 string AS smiOCTETS ' smiOCTETS oid AS smiOID ' smiOID empty AS BYTE ' smiBYTE END UNION
' ======================================================================================== ' Selects a string and scroll it into view, if necessary. When the new string is selected, ' the list box removes the highlight from the previously selected string. ' ======================================================================================== FUNCTION ListBox_SetCurSel (BYVAL hListBox AS DWORD, BYVAL Index AS LONG) AS LONG FUNCTION = SendMessage(hListBox, %LB_SETCURSEL, Index, 0) END FUNCTION ' ========================================================================================
TYPE smiCNTR64 DWORD ' hipart AS DWORD ' smiUINT32 hipart AS LONG ' PB does not support unisgned quads - A PB QUAD is equivalent to a C++ LARGE_INTEGER structure lopart AS DWORD ' smiUINT32 END TYPE
[noparse][noparse][/noparse] [COLOR=#0000FF]#COMPILE EXE[/COLOR] [B][I][COLOR=#008080]'#Win 10.04#[/COLOR][/I][/B] [COLOR=#0000FF]#DIM ALL[/COLOR] [B][I][COLOR=#008080]'no includes[/COLOR][/I][/B] [COLOR=#0000FF]TYPE[/COLOR] smiCNTR64 [COLOR=#0000FF]DWORD[/COLOR] hipart [COLOR=#0000FF]AS DWORD[/COLOR] [B][I][COLOR=#008080]'hipart AS LONG[/COLOR][/I][/B] lopart [COLOR=#0000FF]AS DWORD[/COLOR] [COLOR=#0000FF]END TYPE[/COLOR] [COLOR=#0000FF]UNION[/COLOR] smiVALUE_UNION [COLOR=#0000FF]DWORD[/COLOR] hNumber [COLOR=#0000FF]AS[/COLOR] smiCNTR64 [COLOR=#0000FF]END UNION[/COLOR] [COLOR=#0000FF]TYPE[/COLOR] smiVALUE [COLOR=#0000FF]DWORD[/COLOR] value [COLOR=#0000FF]AS[/COLOR] smiVALUE_UNION [COLOR=#0000FF]END TYPE[/COLOR] [B][I][COLOR=#008080]'_____________________________________________________________________________[/COLOR][/I][/B] [COLOR=#0000FF]FUNCTION PBMAIN[/COLOR]() [COLOR=#0000FF]AS LONG[/COLOR] [COLOR=#0000FF]LOCAL[/COLOR] entryValue [COLOR=#0000FF]AS[/COLOR] smiVALUE [COLOR=#0000FF]LOCAL[/COLOR] quadValue [COLOR=#0000FF]AS QUAD[/COLOR] entryValue.value.hNumber.hipart = [COLOR=#FF0000]&H80000000???[/COLOR] entryValue.value.hNumber.lopart = [COLOR=#FF0000]&H000000FF???[/COLOR] quadValue = [COLOR=#0000FF]MAK[/COLOR]([COLOR=#0000FF]QUAD[/COLOR], entryValue.value.hNumber.lopart, entryValue.value.hNumber.hipart) [COLOR=#0000FF]? DEC$[/COLOR](quadValue) [COLOR=#0000FF]END FUNCTION[/COLOR] [B][I][COLOR=#008080]'_____________________________________________________________________________ '[/COLOR][/I][/B] [/noparse]
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment