Git Product home page Git Product logo

windevlib's People

Contributors

fafalone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

windevlib's Issues

Toolbox

I have just imported from the internet the tbshellLib. Should I see a toolbox?
grafik

GdipGetLineColors has different call signatures for 32-bit versus 64-bit

I've confirmed that the 32- and 64-bit versions have different call signatures by using both in tB (and of course they are not interchangeable). The 32-bit version requires a Long array of dimension 2 (Colors(0) and Colors(1)).

#If Win64 Then
Private Declare PtrSafe Function GdipGetLineColors Lib "gdiplus" (ByVal brush As LongPtr, color1 As Long, color2 As Long) As GpStatus
#Else
Private Declare Function GdipGetLineColors Lib "gdiPlus" (ByVal brush As Long, Colors As Any) As GpStatus
#End If

Thx!

Why OLEAutomation(False)?

Is this restriction necessary? For example, if I want to return an ITypeInfo from a function in a dll I call from VBA, will I be able to with this flag?

ShowWindow function triggering error

This was due to the SHOWWINDOW enum being moved; they're only not ambiguous when in the same module. I was in the middle of 10 things so an update is taking a while. For a temp workaround, fully qualify it with tbShellLib.slAPI.ShowWindow.

IShellItemImageFactory definition will not work for x64

The GetImage function takes a ByVal SIZE; in x64 this is done with 2x ByVal Long, but on x64 must be a single ByVal LongLong (CopyMemory to read it in/out).

The following updated definition will appear in future versions but the code in this repo is not yet updated:

[ InterfaceId ("bcc18b79-ba16-442f-80c4-8a59c30c463b") ]
Interface IShellItemImageFactory Extends stdole.iunknown
    #If Win64 Then
    Sub GetImage(ByVal cxy As LongLong, ByVal flags As SIIGBF, phbm As LongPtr)
    #Else
    Sub GetImage(ByVal cx As Long, ByVal cy As Long, ByVal flags As SIIGBF, phbm As LongPtr)
    #End If
End Interface

IUnknownUnrestricted not yet available

Up until twinBASIC Beta 132, there was no option to not have an interface inherit from something, so the definition in the current version will not work.

If you have Beta 132, the following definition will fix it and will be applied in the next version:

[ InterfaceId ("00000000-0000-0000-C000-000000000046") ]
Interface IUnknownUnrestricted Extends Nothing
    Sub QueryInterface(riid As UUID, ppvObject As any)
    Sub AddRef()
    Sub Release()
End Interface

GdipFillClosedCurve2 and GdipFillClosedCurve2I declarations

Jon, just now starting to use your WinDevLib for vb6-to-tB project conversion. This helps a lot but still a very tedious process!

Anyway, I'm currently using WinDevLib 7.7.370.0 and ran across possible mis-declarations for two GDI-Plus functions.

These are the current declarations your wdGDPI.twin module:

Public Declare PtrSafe Function GdipFillClosedCurve2 Lib "gdiplus" (ByVal Graphics As LongPtr, ByVal brush As LongPtr, Points As POINTF, ByVal count As Long, ByVal fillMode As GpFillMode) As GpStatus
Public Declare PtrSafe Function GdipFillClosedCurve2I Lib "gdiplus" (ByVal Graphics As LongPtr, ByVal brush As LongPtr, Points As POINT, ByVal count As Long, ByVal fillMode As GpFillMode) As GpStatus

which I believe might be missing the "tension" argument:

Public Declare PtrSafe Function GdipFillClosedCurve2 Lib "gdiplus" (ByVal Graphics As LongPtr, ByVal brush As LongPtr, Points As POINTF, ByVal count As Long, ByVal tension As Single, ByVal fillMode As GpFillMode) As GpStatus
Public Declare PtrSafe Function GdipFillClosedCurve2I Lib "gdiplus" (ByVal Graphics As LongPtr, ByVal brush As LongPtr, Points As POINT, ByVal count As Long, ByVal tension As Single, ByVal fillMode As GpFillMode) As GpStatus

Can you take a look? Thx!

Edit: I'm on Windows 11 if that matters

Incorrect argument for GdipDrawImagePointsRect and GdipDrawImagePointsRectI API functions

The first argument "Graphics" should be LongPtr type instead of Long I think. Here is what is currently in WDL:

Public Declare PtrSafe Function GdipDrawImagePointsRect Lib "gdiplus" (ByVal Graphics As Long, ByVal Image As LongPtr, points As POINTF, ByVal count As Long, ByVal srcx As Single, ByVal srcy As Single, ByVal srcwidth As Single, ByVal srcheight As Single, ByVal srcUnit As GpUnit, Optional ByVal imageAttributes As LongPtr = 0, Optional ByVal callback As LongPtr = 0, Optional callbackData As Any) As GpStatus

Public Declare PtrSafe Function GdipDrawImagePointsRectI Lib "gdiplus" (ByVal Graphics As Long, ByVal Image As LongPtr, dstpoints As POINT, ByVal count As Long, ByVal srcx As Long, ByVal srcy As Long, ByVal srcwidth As Long, ByVal srcheight As Long, ByVal srcUnit As GpUnit, Optional ByVal imageAttributes As LongPtr = 0, Optional ByVal callback As LongPtr = 0, Optional callbackData As Any) As GpStatus

Bug in ITypeLib 64 bit + Discussion on style of declarations

https://github.com/fafalone/tbShellLib/blob/93346dece996ba12da8526ad21a923bdb95cc00f/Export/Sources/slTypelib.twin#L33

This should return LongPtr I believe (it is PVOID)


Also I wonder how you would feel about 2 (or 3) improvements to make this more idiomatic:

https://github.com/fafalone/tbShellLib/blob/93346dece996ba12da8526ad21a923bdb95cc00f/Export/Sources/slTypelib.twin#L30

In my code, I have declared this as

Sub GetDocumentation(ByVal memid As MEMID, Optional ByRef pBstrName As String, Optional ByRef pBstrDocString As String = vbNullString, Optional ByRef pdwHelpContext As Long, Optional ByRef pBstrHelpFile As String)

with 2 changes: The Optional arguments, since these are optional from the API point of view. You can specify default of =vbNullString and =NULL_PTR or =0 if needed

Second change is I do

Public Enum MEMID
	[_]
End Enum

This does a sort of typedef for DWORD types which improves readability IMO

3rd change is I rename parameters to for example

Sub GetDocumentation(ByVal memid As MEMID, Optional ByRef outName As String, ...)

Since ByRef pBstrName to me is

  • Too much information; I don't need to know about Bstr as a VBA developer, just String
  • ByRef and p both mean kinda the same thing, doubling up makes me expect to get a pointer to a string out, not just a string
  • I think the outParam prefix is good from a VBA consumer point of view to make it clear. Attributes may be better in future tB.

I think this may be a harder sell as it is backwards incompatible for your library interface. However in my experience when I declare the APIs this way it makes me much less likely to need to look at the MSDN documentation. But it's still easy to look up online even if I've renamed the params, the function name is the same and the order of params is the same. Maybe for version 3.x of your package.

SysReAllocStringW declared incorrectly

Missing an alias, should be

Public Declare PtrSafe Function SysReAllocStringW Lib "oleaut32" Alias "SysReAllocString" (ByVal pBSTR As LongPtr, Optional ByVal pszStrPtr As LongPtr) As Long

SHGetPathFromIDList and SHGetPathFromIDListW are declared incorrectly

These currently have an incorrect 3rd parameter and should instead be:

Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32" Alias "SHGetPathFromIDListA" (ByVal pidl As LongPtr, ByVal pszPath As String) As Long

Public Declare PtrSafe Function SHGetPathFromIDListW Lib "shell32" (ByVal pidl As LongPtr, ByVal pszPath As LongPtr) As Long

OPENFILENAME[AW] UDTs incorrect

I just updated the package so it might be a few days until this is fixed... the OPENFILENAME, OPENFILENAMEA, and OPENFILENAMEW UDTs all have 2 members that should be a String/LongPtr but are set as Long.

The following definitions are correct:

Public Type OPENFILENAMEA
    lStructSize As Long
    hwndOwner As LongPtr
    hInstance As LongPtr
    lpstrFilter As String
    lpstrCustomFilter As String
    nMaxCustFilter As Long
    nFilterIndex As Long
    lpstrFile As String
    nMaxFile As Long
    lpstrFileTitle As String
    nMaxFileTitle As Long
    lpstrInitialDir As String
    lpstrTitle As String
    Flags As OFNFlags
    nFileOffset As Integer
    nFileExtension As Integer
    lpstrDefExt As String
    lCustData As LongPtr
    lpfnHook As LongPtr
    lpTemplateName As String
    pvReserved As LongPtr
    dwReserved As Long
    FlagsEx As OFNFlagsEx
End Type
Public Type OPENFILENAMEW
    lStructSize As Long
    hwndOwner As LongPtr
    hInstance As LongPtr
    lpstrFilter As LongPtr
    lpstrCustomFilter As LongPtr
    nMaxCustFilter As Long
    nFilterIndex As Long
    lpstrFile As LongPtr
    nMaxFile As Long
    lpstrFileTitle As LongPtr
    nMaxFileTitle As Long
    lpstrInitialDir As LongPtr
    lpstrTitle As LongPtr
    Flags As OFNFlags
    nFileOffset As Integer
    nFileExtension As Integer
    lpstrDefExt As LongPtr
    lCustData As LongPtr
    lpfnHook As LongPtr
    lpTemplateName As LongPtr
    pvReserved As LongPtr
    dwReserved As Long
    FlagsEx As OFNFlagsEx
End Type
Public Type OPENFILENAME
    lStructSize As Long
    hwndOwner As LongPtr
    hInstance As LongPtr
    lpstrFilter As LongPtr
    lpstrCustomFilter As LongPtr
    nMaxCustFilter As Long
    nFilterIndex As Long
    lpstrFile As LongPtr
    nMaxFile As Long
    lpstrFileTitle As LongPtr
    nMaxFileTitle As Long
    lpstrInitialDir As LongPtr
    lpstrTitle As LongPtr
    Flags As OFNFlags
    nFileOffset As Integer
    nFileExtension As Integer
    lpstrDefExt As LongPtr
    lCustData As LongPtr
    lpfnHook As LongPtr
    lpTemplateName As LongPtr
    pvReserved As LongPtr
    dwReserved As Long
    FlagsEx As OFNFlagsEx
End Type

CreateTypeLib API incorrectly defined

This bug carried over from oleexp; the 2nd argument should be ByVal, not ByRef. You can use CreateTypeLib2 as a workaround until the next update if this impacts you.

CM_COLUMNINFO wszName array is too short

Public Const MAX_COLUMN_NAME_LEN = 80
Public Type CM_COLUMNINFO
	cbSize As Long ' size in bytes of struct
	dwMask As CM_MASK ' CM_MASK
	dwState As CM_STATE ' CM_STATE
	uWidth As Long ' CM_MASK_WIDTH, for SetColumnInfo it can be a CM_SET_WIDTH_VALUE
	uDefaultWidth As Long ' CM_MASK_DEFAULTWIDTH
	uIdealWidth As Long ' CM_MASK_IDEALWIDTH
	wszName(0 To (MAX_COLUMN_NAME_LEN - 1)) As Byte
End Type

should be

Public Const MAX_COLUMN_NAME_LEN = 80
Public Type CM_COLUMNINFO
	cbSize As Long ' size in bytes of struct
	dwMask As CM_MASK ' CM_MASK
	dwState As CM_STATE ' CM_STATE
	uWidth As CM_SET_WIDTH_VALUE ' CM_MASK_WIDTH, for SetColumnInfo it can be a CM_SET_WIDTH_VALUE
	uDefaultWidth As Long ' CM_MASK_DEFAULTWIDTH
	uIdealWidth As Long ' CM_MASK_IDEALWIDTH
	wszName(0 To (MAX_COLUMN_NAME_LEN - 1)) As Integer
End Type

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.