Announcement

Collapse
No announcement yet.

Windows API Headers III v. 1.07

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Thank you John.
    José, is that how you would have implemented it?

    Comment


    • #22
      In ListBoxCtrl.inc:
      Code:
      ' ========================================================================================
      ' 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



      I found this mod on the forum, but I cannot remember who posted it.
      In WinUser.Inc
      '2017-03-30 CHANGE GetKeyState from INTEGER to LONG

      Code:
      DECLARE FUNCTION GetKeyState IMPORT "USER32.DLL" ALIAS "GetKeyState" ( _
         BYVAL nVirtKey AS LONG _ ' __in int nVirtKey
      ) AS LONG ' SHORT
      ' ) AS INTEGER ' SHORT

      Comment


      • #23
        Hey John,
        According to Microsoft , GetKeyState() return a SHORT, so INTEGER was right.

        Comment


        • #24
          Also in ListBoxCtrl.Inc
          Code:
          ' ========================================================================================
          ' 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
          Jose' knows about this one. %LB_GETITEMHEIGHT should be %LB_GETITEMRECT

          Comment


          • #25
            Originally posted by Pierre Bellisle View Post
            Hey John,
            According to Microsoft , GetKeyState() return a SHORT, so INTEGER was right.
            Without documentation on who suggested it or where I got it, I have no problem returning it to the original...

            Thanks for checking it,
            -John

            Comment


            • #26
              Hey Frank,
              Mine is already correct, are you sure it is for v3.1.07 and not a previous version?

              Added:
              OK found it in v1.19 for Win9/CC5. I will add it lo my list thank you

              Comment


              • #27
                I have INTEGER as well v3.1.07

                Comment


                • #28
                  Yep, this is good...

                  Note:
                  I added the ListBox_GetItemRect to my list above.
                  For WinSnmp.inc, I will wait for José opinion to see how he wants it.

                  Comment


                  • #29
                    Jose' told me to just edit the file back in June 2016, but it was the 1.07 headers.

                    Comment


                    • #30
                      José Roca "Windows API Headers 3.1.07" minor update 2020-01-21
                      mfidl.inc
                      Under interface INTERFACE IMFSourceResolver $IID_IMFSourceResolver
                      Under method METHOD CreateObjectFromURL
                      Change BYVAL to BYREF
                      ' , BYVAL pObjectType AS LONG _ ' __out MF_OBJECT_TYPE *pObjectType

                      The Method should look like this:
                      HTML Code:
                      [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]

                      Comment


                      • #31
                        Did you also changed BYVAL pwszURLthe to BYREF pwszURL ?
                        I got BYVAL in inc...
                        Reading Microsoft, it should be BYVAL as it is in my inc.
                        So I'll change only pObjectType in my list.
                        Last edited by Pierre Bellisle; 21 Jan 2020, 05:33 PM.

                        Comment


                        • #32
                          Originally posted by Pierre Bellisle View Post
                          Did you a\so changed BYVAL pwszURLthe to BYREF pwszURL ?
                          I got BYVAL in inc...
                          I do not believe I had to change it. Mine was BYREF which seems to work. My version had some of the changes that you referred to in your post already applied. In this case pwszURL is a WSTRINGZ PTR so likely it should have been BYREF. It could be someone that was helping me out at the time may have recommended that change. Hard to say at this point. I know I alerted folks way back then when I was developing a Media Foundation Music Player app. That was what 2 years ago?

                          Comment


                          • #33
                            To be sure I will download José stuff, unzip a fresh folder and see what's in it.
                            I got to go now, back in a couple of hours...

                            Comment


                            • #34
                              Pierre,
                              If you want to see the conversation with Bob Carver. See here. We did not talk about the BYREF for the pwszURL. It was all about the pObjectType.

                              If you search for all the pwszURL in the mfidl.inc they are defined like this BYREF pwszURL AS WSTRINGZ. I never had a question about that.

                              Comment


                              • #35
                                Ok. I have revised all the reported changes, most of which I already had changed in my copy.

                                Regarding smiVALUE_UNION, I have changed the QUAD to smiCNTR64

                                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
                                And regarding ListBox_SetCurSel, I already had changed it to:

                                Code:
                                ' ========================================================================================
                                ' 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
                                ' ========================================================================================
                                For multiple selection, use ListBox_SetSel instead of ListBox_SetCurSel.

                                If there are no more changes, I will post version 3.1.08 soon. Didn't know that now I can upload 30 MB a month. Last time that I attempted to upload it said that I had exceded my quota by a ton of MB.

                                P.S. Regarding the headers for PB 9, it probably contains more mistakes. I only uploaded it because there were many requests in the short time when this version was free, but I haven't made any changes to it since PB 10 was released.
                                Forum: http://www.jose.it-berater.org/smfforum/index.php

                                Comment


                                • #36
                                  @ Jim: Yes you are right Jim, I was still in v1.19. All is fine...

                                  Comment


                                  • #37
                                    @ José,
                                    Thank.
                                    So in TYPE smiCNTR64 you left hipart AS DWORD I guess.

                                    I updated the above list. This way we will have the same inc.


                                    Comment


                                    • #38
                                      In the C code, hipart is a DWORD. I have no idea if PB needs it to be a LONG instead of a DWORD and why. I also don't have code to test.
                                      Forum: http://www.jose.it-berater.org/smfforum/index.php

                                      Comment


                                      • #39
                                        Well, the PB documentation for QUAD says that it is equivalet to a C++ LARGE_INTEGER structure, so I have changed it to:

                                        Code:
                                        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
                                        Forum: http://www.jose.it-berater.org/smfforum/index.php

                                        Comment


                                        • #40
                                          This test give same result with DWORD and LONG.
                                          If you go with LONG, I'll put it in the above list.

                                          Code:
                                          [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]

                                          Comment

                                          Working...
                                          X