It is currently Fri Jan 15, 2021 6:58 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 43 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: Requested API Structure and constants
PostPosted: Thu Mar 22, 2018 10:34 am 
Offline
Addict
Addict
User avatar

Joined: Mon Sep 15, 2003 5:55 am
Posts: 1344
missing padding for 64bit:
Code:
Structure NMTVITEMCHANGE
  hdr.NMHDR
  uChanged.l
  CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
    PB_Alignment.b[4]
  CompilerEndIf
  hItem.i
  uStateNew.l
  uStateOld.l
  lParam.i
EndStructure

c ya,
nco2k

_________________
If OSVersion() = #PB_OS_Windows_ME : End : EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Sun Jun 02, 2019 3:44 pm 
Offline
Moderator
Moderator

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1113
Location: Gernsbach (Germany)
The constant #TVM_SETLINECOLOR exists in the auto completion list, but PureBasic does not know the value.
Code:
#TVM_SETLINECOLOR = #TV_FIRST + 40


\\Edit:
Code:
#TVM_SETTEXTCOLOR = #TV_FIRST + 30

Code:
#TVM_SETBKCOLOR = #TV_FIRST + 29

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Sat Jun 29, 2019 9:58 am 
Offline
Moderator
Moderator

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1113
Location: Gernsbach (Germany)
For LoadIcon_():
Code:
#IDI_SHIELD = 32518

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Tue Jul 30, 2019 3:03 pm 
Offline
Moderator
Moderator

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1113
Location: Gernsbach (Germany)
The WinAPI function SearchTreeForFile_() does not work.
Please change the import of the WinAPI function. SearchTreeForFileA -> SearchTreeForFileW
Example for SearchTreeForFileW: viewtopic.php?p=539852#p539852

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Wed Feb 05, 2020 8:29 pm 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 1130
Location: Russia
https://msdn.microsoft.com/en-us/ie/aa363244(v=vs.80)
Code:
Structure DEV_BROADCAST_DEVICEINTERFACE Align #PB_Structure_AlignC
  dbcc_size.l
  dbcc_devicetype.l
  dbcc_reserved.l
  dbcc_classguid.GUID
  dbcc_name.c[1]
EndStructure

_________________
Library XP_Menu_Lib - office menu; HID_Lib - USB Library
Torrent client - pbTorrent (source code); Create driver in PureBasic.


Top
 Profile  
Reply with quote  
 Post subject: API Structure and constants
PostPosted: Fri Oct 23, 2020 12:23 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Apr 25, 2003 5:10 pm
Posts: 556
Location: Doubs - France
Structure LVGROUP declared in PB has to be updated.

I use these declarations since a while now without crash

C/C++ code using Visual Studio 2019 Version 16.7.6 (use declarations 10.0.18362.0)

Code:

#include <iostream>
#include <windows.h>
#include <commctrl.h>


#define PRINTF_SIZEOF(type) printf("  SizeOf( "  #type  " ) = %zu\n", sizeof(type))
#define PRINTF_OffsetOf(type,member) printf("  OffsetOf( "  #member  " ) = %zu\n", offsetof(type,member))

int main()
{
   #ifdef UNICODE


   #if defined(_WIN64)
      printf("\n");
      printf("\n");
      printf("  Compilation Window 64 bit - mode unicode\n");
   #else
      printf("\n");
      printf("\n");
      printf("  Compilation Window 32 bit - mode unicode\n");
   #endif

      /*
         commctrl.h  line 4043
         --------------------
         typedef struct tagLVGROUP
                  {
                     UINT    cbSize;
                     UINT    mask;
                     LPWSTR  pszHeader;
                     int     cchHeader;

                     LPWSTR  pszFooter;
                     int     cchFooter;

                     int     iGroupId;

                     UINT    stateMask;
                     UINT    state;
                     UINT    uAlign;
                  #if (NTDDI_VERSION >= NTDDI_VISTA)
                     LPWSTR  pszSubtitle;
                     UINT    cchSubtitle;
                     LPWSTR  pszTask;
                     UINT    cchTask;
                     LPWSTR  pszDescriptionTop;
                     UINT    cchDescriptionTop;
                     LPWSTR  pszDescriptionBottom;
                     UINT    cchDescriptionBottom;
                     int     iTitleImage;
                     int     iExtendedImage;
                     int     iFirstItem;         // Read only
                     UINT    cItems;             // Read only
                     LPWSTR  pszSubsetTitle;     // NULL if group is not subset
                     UINT    cchSubsetTitle;

                  #define LVGROUP_V5_SIZE CCSIZEOF_STRUCT(LVGROUP, uAlign)

                  #endif
                  } LVGROUP, *PLVGROUP;
               */

      printf("\n");
      printf("  Structure LVGROUP\n");
      printf("  -----------------\n");

      PRINTF_SIZEOF(LVGROUP);
      printf("\n");
      PRINTF_OffsetOf(LVGROUP, cbSize);
      PRINTF_OffsetOf(LVGROUP, mask);
      PRINTF_OffsetOf(LVGROUP, pszHeader);
      PRINTF_OffsetOf(LVGROUP, cchHeader);
      PRINTF_OffsetOf(LVGROUP, pszFooter);
      PRINTF_OffsetOf(LVGROUP, cchFooter);
      PRINTF_OffsetOf(LVGROUP, iGroupId);
      PRINTF_OffsetOf(LVGROUP, stateMask);
      PRINTF_OffsetOf(LVGROUP, state);
      PRINTF_OffsetOf(LVGROUP, uAlign);
      PRINTF_OffsetOf(LVGROUP, pszSubtitle);
      PRINTF_OffsetOf(LVGROUP, cchSubtitle);
      PRINTF_OffsetOf(LVGROUP, pszTask);
      PRINTF_OffsetOf(LVGROUP, cchTask);
      PRINTF_OffsetOf(LVGROUP, pszDescriptionTop);
      PRINTF_OffsetOf(LVGROUP, cchDescriptionTop);
      PRINTF_OffsetOf(LVGROUP, pszDescriptionBottom);
      PRINTF_OffsetOf(LVGROUP, cchDescriptionBottom);
      PRINTF_OffsetOf(LVGROUP, iTitleImage);
      PRINTF_OffsetOf(LVGROUP, iExtendedImage);
      PRINTF_OffsetOf(LVGROUP, iFirstItem);
      PRINTF_OffsetOf(LVGROUP, cItems);
      PRINTF_OffsetOf(LVGROUP, pszSubsetTitle);
      PRINTF_OffsetOf(LVGROUP, cchSubsetTitle);

   #else
      printf("You must compile in unicode mode!\n");
   #endif


   return 0;
}


PB code

Code:
; https://docs.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvgroup
; Structure actuelle LVGROUP PB x86/x64
; Structure LVGROUP
;       cbSize.l
;       mask.l
;       *pszHeader
;       cchHeader.l
;       *pszFooter
;       cchFooter.l
;       iGroupId.l
;       stateMask.l
;       state.l
;       uAlign.l
; EndStructure

; Version fichier h --> 10.0.18362.0
; commctrl.h  Structure x64 line 4043
; typedef struct tagLVGROUP
; {
;     UINT    cbSize;
;     UINT    mask;
;     LPWSTR  pszHeader;
;     int     cchHeader;
;
;     LPWSTR  pszFooter;
;     int     cchFooter;
;
;     int     iGroupId;
;
;     UINT    stateMask;
;     UINT    state;
;     UINT    uAlign;
; #if (NTDDI_VERSION >= NTDDI_VISTA)
;     LPWSTR  pszSubtitle;
;     UINT    cchSubtitle;
;     LPWSTR  pszTask;
;     UINT    cchTask;
;     LPWSTR  pszDescriptionTop;
;     UINT    cchDescriptionTop;
;     LPWSTR  pszDescriptionBottom;
;     UINT    cchDescriptionBottom;
;     int     iTitleImage;
;     int     iExtendedImage;
;     int     iFirstItem;         // Read only
;     UINT    cItems;             // Read only
;     LPWSTR  pszSubsetTitle;     // NULL if group is not subset
;     UINT    cchSubsetTitle;
;
; #define LVGROUP_V5_SIZE CCSIZEOF_STRUCT(LVGROUP, uAlign)
;
; #endif
; } LVGROUP, *PLVGROUP;

CompilerSelect #PB_Compiler_Processor
      CompilerCase #PB_Processor_x86
            ; Structure PureBasic LVGROUP mise à jour/Structure PureBasic LVGROUP updated
            Debug "  Compilation Window 32 bit - mode unicode"
            Structure LVGROUP_x86
                  cbSize.l
                  mask.l
                  *pszHeader
                  cchHeader.l
                  *pszFooter
                  cchFooter.l
                  iGroupId.l
                  stateMask.l
                  state.l
                  uAlign.l
                  *pszSubtitle
                  cchSubtitle.l
                  *pszTask
                  cchTask.l
                  *pszDescriptionTop
                  cchDescriptionTop.l
                  *pszDescriptionBottom
                  cchDescriptionBottom.l
                  iTitleImage.l
                  iExtendedImage.l
                  iFirstItem.l
                  cItems.l
                  *pszSubsetTitle
                  cchSubsetTitle.l
            EndStructure
           
            Debug ""
            Debug "  Structure LVGROUP"
            Debug "  -----------------"

            Debug "  SizeOf(  LVGROUP_x86  ) = " + Str(SizeOf(LVGROUP_x86))
            Debug ""
            Debug "  OffsetOf(  cbSize  ) = " + Str(OffsetOf(LVGROUP_x86\cbSize))
            Debug "  OffsetOf(  mask  ) = " + Str(OffsetOf(LVGROUP_x86\mask))
            Debug "  OffsetOf(  *pszHeader  ) = " + Str(OffsetOf(LVGROUP_x86\pszHeader))
            Debug "  OffsetOf(  cchHeader  ) = " + Str(OffsetOf(LVGROUP_x86\cchHeader))
            Debug "  OffsetOf(  *pszFooter  ) = " + Str(OffsetOf(LVGROUP_x86\pszFooter))
            Debug "  OffsetOf(  cchFooter  ) = " + Str(OffsetOf(LVGROUP_x86\cchFooter))
            Debug "  OffsetOf(  iGroupId  ) = " + Str(OffsetOf(LVGROUP_x86\iGroupId))
            Debug "  OffsetOf(  stateMask  ) = " + Str(OffsetOf(LVGROUP_x86\stateMask))
            Debug "  OffsetOf(  state  ) = " + Str(OffsetOf(LVGROUP_x86\state))
            Debug "  OffsetOf(  uAlign  ) = " + Str(OffsetOf(LVGROUP_x86\uAlign))
            Debug "  OffsetOf(  *pszSubtitle  ) = " + Str(OffsetOf(LVGROUP_x86\pszSubtitle))
            Debug "  OffsetOf(  cchSubtitle  ) = " + Str(OffsetOf(LVGROUP_x86\cchSubtitle))
            Debug "  OffsetOf(  *pszTask  ) = " + Str(OffsetOf(LVGROUP_x86\pszTask))
            Debug "  OffsetOf(  cchTask  ) = " + Str(OffsetOf(LVGROUP_x86\cchTask))
            Debug "  OffsetOf(  *pszDescriptionTop  ) = " + Str(OffsetOf(LVGROUP_x86\pszDescriptionTop))
            Debug "  OffsetOf(  cchDescriptionTop  ) = " + Str(OffsetOf(LVGROUP_x86\cchDescriptionTop))
            Debug "  OffsetOf(  *pszDescriptionBottom  ) = " + Str(OffsetOf(LVGROUP_x86\pszDescriptionBottom))
            Debug "  OffsetOf(  cchDescriptionBottom  ) = " + Str(OffsetOf(LVGROUP_x86\cchDescriptionBottom))
            Debug "  OffsetOf(  iTitleImage  ) = " + Str(OffsetOf(LVGROUP_x86\iTitleImage))
            Debug "  OffsetOf(  iExtendedImage  ) = " + Str(OffsetOf(LVGROUP_x86\iExtendedImage))
            Debug "  OffsetOf(  iFirstItem  ) = " + Str(OffsetOf(LVGROUP_x86\iFirstItem))
            Debug "  OffsetOf(  cItems  ) = " + Str(OffsetOf(LVGROUP_x86\cItems))
            Debug "  OffsetOf(  *pszSubsetTitle  ) = " + Str(OffsetOf(LVGROUP_x86\pszSubsetTitle))
            Debug "  OffsetOf(  cchSubsetTitle  ) = " + Str(OffsetOf(LVGROUP_x86\cchSubsetTitle))
           
      CompilerCase #PB_Processor_x64
            ; Structure PureBasic mise à jour/Structure PureBasic LVGROUP updated
            Debug "  Compilation Window 64 bit - mode unicode"
            Structure LVGROUP_x64
                  cbSize.l
                  mask.l
                  *pszHeader
                  cchHeader.l
                  PB_Alignment.b[4]
                  *pszFooter
                  cchFooter.l
                  iGroupId.l
                  stateMask.l
                  state.l
                  uAlign.l
                  PB_Alignment_1.b[4]
                  *pszSubtitle
                  cchSubtitle.l
                  PB_Alignment_2.b[4]
                  *pszTask
                  cchTask.l
                  PB_Alignment_3.b[4]
                  *pszDescriptionTop
                  cchDescriptionTop.l
                  PB_Alignment_4.b[4]
                  *pszDescriptionBottom
                  cchDescriptionBottom.l
                  iTitleImage.l
                  iExtendedImage.l
                  iFirstItem.l
                  cItems.l
                  PB_Alignment_5.b[4]
                  *pszSubsetTitle
                  cchSubsetTitle.l
                  PB_Alignment_6.b[4]
            EndStructure
           
            Debug ""
            Debug "  Structure LVGROUP"
            Debug "  -----------------"

            Debug "  SizeOf(  LVGROUP_x64  ) = " + Str(SizeOf(LVGROUP_x64))
            Debug ""
            Debug "  OffsetOf(  cbSize  ) = " + Str(OffsetOf(LVGROUP_x64\cbSize))
            Debug "  OffsetOf(  mask  ) = " + Str(OffsetOf(LVGROUP_x64\mask))
            Debug "  OffsetOf(  *pszHeader  ) = " + Str(OffsetOf(LVGROUP_x64\pszHeader))
            Debug "  OffsetOf(  cchHeader  ) = " + Str(OffsetOf(LVGROUP_x64\cchHeader))
            Debug "  OffsetOf(  *pszFooter  ) = " + Str(OffsetOf(LVGROUP_x64\pszFooter))
            Debug "  OffsetOf(  cchFooter  ) = " + Str(OffsetOf(LVGROUP_x64\cchFooter))
            Debug "  OffsetOf(  iGroupId  ) = " + Str(OffsetOf(LVGROUP_x64\iGroupId))
            Debug "  OffsetOf(  stateMask  ) = " + Str(OffsetOf(LVGROUP_x64\stateMask))
            Debug "  OffsetOf(  state  ) = " + Str(OffsetOf(LVGROUP_x64\state))
            Debug "  OffsetOf(  uAlign  ) = " + Str(OffsetOf(LVGROUP_x64\uAlign))
            Debug "  OffsetOf(  *pszSubtitle  ) = " + Str(OffsetOf(LVGROUP_x64\pszSubtitle))
            Debug "  OffsetOf(  cchSubtitle  ) = " + Str(OffsetOf(LVGROUP_x64\cchSubtitle))
            Debug "  OffsetOf(  *pszTask  ) = " + Str(OffsetOf(LVGROUP_x64\pszTask))
            Debug "  OffsetOf(  cchTask  ) = " + Str(OffsetOf(LVGROUP_x64\cchTask))
            Debug "  OffsetOf(  *pszDescriptionTop  ) = " + Str(OffsetOf(LVGROUP_x64\pszDescriptionTop))
            Debug "  OffsetOf(  cchDescriptionTop  ) = " + Str(OffsetOf(LVGROUP_x64\cchDescriptionTop))
            Debug "  OffsetOf(  *pszDescriptionBottom  ) = " + Str(OffsetOf(LVGROUP_x64\pszDescriptionBottom))
            Debug "  OffsetOf(  cchDescriptionBottom  ) = " + Str(OffsetOf(LVGROUP_x64\cchDescriptionBottom))
            Debug "  OffsetOf(  iTitleImage  ) = " + Str(OffsetOf(LVGROUP_x64\iTitleImage))
            Debug "  OffsetOf(  iExtendedImage  ) = " + Str(OffsetOf(LVGROUP_x64\iExtendedImage))
            Debug "  OffsetOf(  iFirstItem  ) = " + Str(OffsetOf(LVGROUP_x64\iFirstItem))
            Debug "  OffsetOf(  cItems  ) = " + Str(OffsetOf(LVGROUP_x64\cItems))
            Debug "  OffsetOf(  *pszSubsetTitle  ) = " + Str(OffsetOf(LVGROUP_x64\pszSubsetTitle))
            Debug "  OffsetOf(  cchSubsetTitle  ) = " + Str(OffsetOf(LVGROUP_x64\cchSubsetTitle))
CompilerEndSelect



result in x86 mode :
Image

result in x64 mode :
Image

_________________
A+
Denis


Last edited by Denis on Fri Oct 23, 2020 4:05 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Fri Oct 23, 2020 3:27 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Apr 25, 2003 5:10 pm
Posts: 556
Location: Doubs - France
Structure HDITEM declared in PB has to be updated.

C/C++ code using Visual Studio 2019 Version 16.7.6 (use declarations 10.0.18362.0)
Code:

#include <iostream>
#include <windows.h>
#include <commctrl.h>


#define PRINTF_SIZEOF(type) printf("  SizeOf( "  #type  " ) = %zu\n", sizeof(type))
// #define PRINTF_OffsetOf(type,member) printf("  OffsetOf(" #type", "#member ") = %zu\n", offsetof(type,member))
#define PRINTF_OffsetOf(type,member) printf("  OffsetOf( "  #member  " ) = %zu\n", offsetof(type,member))


int main()
{
#ifdef UNICODE


#if defined(_WIN64)
   printf("\n");
   printf("\n");
   printf("  Compilation Window 64 bit - mode unicode\n");
#else
   printf("\n");
   printf("\n");
   printf("  Compilation Window 32 bit - mode unicode\n");
#endif

   /*
      commctrl.h  line 788
      --------------------
         typedef struct _HD_ITEMW
         {
            UINT    mask;
            int     cxy;
            LPWSTR  pszText;
            HBITMAP hbm;
            int     cchTextMax;
            int     fmt;
            LPARAM  lParam;
            int     iImage;         // index of bitmap in ImageList
            int     iOrder;
            UINT    type;           // [in] filter type (defined what pvFilter is a pointer to)
            void *  pvFilter;       // [in] fillter data see above
         #if (NTDDI_VERSION >= NTDDI_VISTA)
            UINT   state;
         #endif
         } HDITEM, *LPHDITEMW;

         #ifdef UNICODE
         #define HDITEM HDITEM
         #define LPHDITEM LPHDITEMW
         #define HDITEM_V1_SIZE HDITEMW_V1_SIZE
         #else
         #define HDITEM HDITEMA
         #define LPHDITEM LPHDITEMA
         #define HDITEM_V1_SIZE HDITEMA_V1_SIZE
         #endif


            */

         printf("\n");
         printf("  Structure HDITEM\n");
         printf("  -----------------\n");

         PRINTF_SIZEOF(HDITEM);
         printf("\n");
         PRINTF_OffsetOf(HDITEM, mask);
         PRINTF_OffsetOf(HDITEM, cxy);
         PRINTF_OffsetOf(HDITEM, pszText);
         PRINTF_OffsetOf(HDITEM, hbm);
         PRINTF_OffsetOf(HDITEM, cchTextMax);
         PRINTF_OffsetOf(HDITEM, fmt);
         PRINTF_OffsetOf(HDITEM, lParam);
         PRINTF_OffsetOf(HDITEM, iImage);
         PRINTF_OffsetOf(HDITEM, iOrder);
         PRINTF_OffsetOf(HDITEM, type);
         PRINTF_OffsetOf(HDITEM, pvFilter);
         PRINTF_OffsetOf(HDITEM, state);


#else
   printf("You must compile in unicode mode!\n");
#endif


   return 0;
}


PB code
Code:
;   Structure HDITEMW
;  https://docs.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-hditemw

; Structure actuelle HDITEM PB x86
; Structure HDITEM
;   mask.l
;   cxy.l
;   *pszText
;   hbm.i
;   cchTextMax.l
;   fmt.l
;   lParam.i
;   iImage.l
;   iOrder.l
;   type.l
;   *pvFilter
; EndStructure

; Structure actuelle HDITEM PB x64
; Structure HDITEM
;   mask.l
;   cxy.l
;   *pszText
;   hbm.i
;   cchTextMax.l
;   fmt.l
;   lParam.i
;   iImage.l
;   iOrder.l
;   type.l
;   PB_Alignment.b[4]
;   *pvFilter
; EndStructure

; Version fichier h etc. --> 10.0.18362.0
; commctrl.h  Structure x64 line 788
;  typedef struct _HD_ITEMW
;  {
;     UINT    mask;
;     int     cxy;
;     LPWSTR  pszText;
;     HBITMAP hbm;
;     int     cchTextMax;
;     int     fmt;
;     LPARAM  lParam;
;     int     iImage;        // index of bitmap in ImageList
;     int     iOrder;
;     UINT    type;          // [in] filter type (defined what pvFilter is a pointer to)
;     void* pvFilter;        // [in] fillter data see above
;     #if (NTDDI_VERSION >= NTDDI_VISTA)
;          UINT   state;
;     #endif
;  } HDITEMW, * LPHDITEMW;

CompilerSelect #PB_Compiler_Processor
      CompilerCase #PB_Processor_x86
            ; Structure PureBasic mise à jour/Structure PureBasic HDITEM updated
            Debug "  Compilation Window 32 bit - mode unicode"
            Structure HDITEM_x86
                  mask.l
                  cxy.l
                  *pszText
                  hbm.i
                  cchTextMax.l
                  fmt.l
                  lParam.i
                  iImage.l
                  iOrder.l
                  type.l
                  *pvFilter
                  state.l
            EndStructure
           
            Debug ""
            Debug "  Structure HDITEM_x86"
            Debug "  -----------------"

            Debug "  SizeOf(HDITEM_x86  ) = " + Str(SizeOf(HDITEM_x86))
            Debug ""
            Debug "  OffsetOf(  mask  ) = " + Str(OffsetOf(HDITEM_x86\mask))
            Debug "  OffsetOf(  cxy  ) = " + Str(OffsetOf(HDITEM_x86\cxy))
            Debug "  OffsetOf(  pszText  ) = " + Str(OffsetOf(HDITEM_x86\pszText))
            Debug "  OffsetOf(  hbm  ) = " + Str(OffsetOf(HDITEM_x86\hbm))
            Debug "  OffsetOf(  cchTextMax  ) = " + Str(OffsetOf(HDITEM_x86\cchTextMax))
            Debug "  OffsetOf(  fmt  ) = " + Str(OffsetOf(HDITEM_x86\fmt))
            Debug "  OffsetOf(  lParam  ) = " + Str(OffsetOf(HDITEM_x86\lParam))
            Debug "  OffsetOf(  iImage  ) = " + Str(OffsetOf(HDITEM_x86\iImage))
            Debug "  OffsetOf(  iOrder  ) = " + Str(OffsetOf(HDITEM_x86\iOrder))
            Debug "  OffsetOf(  type  ) = " + Str(OffsetOf(HDITEM_x86\type))
            Debug "  OffsetOf(  pvFilter  ) = " + Str(OffsetOf(HDITEM_x86\pvFilter))
            Debug "  OffsetOf(  state  ) = " + Str(OffsetOf(HDITEM_x86\state))
           
           
      CompilerCase #PB_Processor_x64
            ; Structure PureBasic mise à jour/Structure PureBasic HDITEM updated
            Debug "  Compilation Window 64 bit - mode unicode"
            Structure HDITEM_x64
                  mask.l
                  cxy.l
                  *pszText
                  hbm.i
                  cchTextMax.l
                  fmt.l
                  lParam.i
                  iImage.l
                  iOrder.l
                  type.l
                  PB_Alignment.b[4]
                  *pvFilter
                  state.l
                  PB_Alignment_1.b[4]
            EndStructure
           
            Debug ""
            Debug "  Structure HDITEM_x64"
            Debug "  -----------------"

            Debug "  SizeOf(HDITEM_x64  ) = " + Str(SizeOf(HDITEM_x64))
            Debug ""
            Debug "  OffsetOf(  mask  ) = " + Str(OffsetOf(HDITEM_x64\mask))
            Debug "  OffsetOf(  cxy  ) = " + Str(OffsetOf(HDITEM_x64\cxy))
            Debug "  OffsetOf(  pszText  ) = " + Str(OffsetOf(HDITEM_x64\pszText))
            Debug "  OffsetOf(  hbm  ) = " + Str(OffsetOf(HDITEM_x64\hbm))
            Debug "  OffsetOf(  cchTextMax  ) = " + Str(OffsetOf(HDITEM_x64\cchTextMax))
            Debug "  OffsetOf(  fmt  ) = " + Str(OffsetOf(HDITEM_x64\fmt))
            Debug "  OffsetOf(  lParam  ) = " + Str(OffsetOf(HDITEM_x64\lParam))
            Debug "  OffsetOf(  iImage  ) = " + Str(OffsetOf(HDITEM_x64\iImage))
            Debug "  OffsetOf(  iOrder  ) = " + Str(OffsetOf(HDITEM_x64\iOrder))
            Debug "  OffsetOf(  type  ) = " + Str(OffsetOf(HDITEM_x64\type))
            Debug "  OffsetOf(  pvFilter  ) = " + Str(OffsetOf(HDITEM_x64\pvFilter))
            Debug "  OffsetOf(  state  ) = " + Str(OffsetOf(HDITEM_x64\state))
CompilerEndSelect

result in x86 mode :
Image
result in x64 mode :
Image

_________________
A+
Denis


Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Fri Oct 23, 2020 5:21 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Apr 25, 2003 5:10 pm
Posts: 556
Location: Doubs - France
Structure LVITEM declared in PB has to be updated but only with x64 declaration
Just added a padding of 4 bytes after the very last element.

C/C++ code using Visual Studio 2019 Version 16.7.6 (use declarations 10.0.18362.0)
Code:

#include <iostream>
#include <windows.h>
#include <commCtrl.h>


#define PRINTF_SIZEOF(type) printf("  SizeOf( "  #type  " ) = %zu\n", sizeof(type))
#define PRINTF_OffsetOf(type,member) printf("  OffsetOf( "  #member  " ) = %zu\n", offsetof(type,member))


int main()
{
#ifdef UNICODE


#if defined(_WIN64)
   printf("\n");
   printf("\n");
   printf("  Compilation Window 64 bit - mode unicode\n");
#else
   printf("\n");
   printf("\n");
   printf("  Compilation Window 32 bit - mode unicode\n");
#endif

   /*
      commctrl.h  line 3219
   typedef struct tagLVITEMW
   {
      UINT mask;
      int iItem;
      int iSubItem;
      UINT state;
      UINT stateMask;
      LPWSTR pszText;
      int cchTextMax;
      int iImage;
      LPARAM lParam;
      int iIndent;
   #if (NTDDI_VERSION >= NTDDI_WINXP)
      int iGroupId;
      UINT cColumns; // tile view columns
      PUINT puColumns;
   #endif
   #if (NTDDI_VERSION >= NTDDI_VISTA)
      int* piColFmt;
      int iGroup; // readonly. only valid for owner data.
   #endif
   } LVITEMW, *LPLVITEMW;

   #ifdef UNICODE
   #define LVITEM    LVITEMW
   #define LPLVITEM  LPLVITEMW
   #define LVITEM_V1_SIZE LVITEMW_V1_SIZE
   #else
   #define LVITEM    LVITEMA
   #define LPLVITEM  LPLVITEMA
   #define LVITEM_V1_SIZE LVITEMA_V1_SIZE
   #endif


   */

   printf("\n");
   printf("  Structure LVITEM\n");
   printf("  -----------------\n");

   PRINTF_SIZEOF(LVITEM);
   printf("\n");
   PRINTF_OffsetOf(LVITEM, mask);
   PRINTF_OffsetOf(LVITEM, iItem);
   PRINTF_OffsetOf(LVITEM, iSubItem);
   PRINTF_OffsetOf(LVITEM, state);
   PRINTF_OffsetOf(LVITEM, stateMask);
   PRINTF_OffsetOf(LVITEM, pszText);
   PRINTF_OffsetOf(LVITEM, cchTextMax);
   PRINTF_OffsetOf(LVITEM, iImage);
   PRINTF_OffsetOf(LVITEM, lParam);
   PRINTF_OffsetOf(LVITEM, iIndent);
   PRINTF_OffsetOf(LVITEM, iGroupId);
   PRINTF_OffsetOf(LVITEM, cColumns);
   PRINTF_OffsetOf(LVITEM, puColumns);
   PRINTF_OffsetOf(LVITEM, piColFmt);
   PRINTF_OffsetOf(LVITEM, iGroup);


#else
   printf("You must compile in unicode mode!\n");
#endif


   return 0;
}

PB code
Code:
; Structure LVITEM
; https://docs.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvitemw

; Structure LVITEM x86  PB
; Structure LVITEM
;   mask.l
;   iItem.l
;   iSubItem.l
;   state.l
;   stateMask.l
;   *pszText
;   cchTextMax.l
;   iImage.l
;   lParam.i
;   iIndent.l
;   iGroupId.l
;   cColumns.l
;   puColumns.i
;   piColFmt.i
;   iGroup.l
; EndStructure

; Structure LVITEM x64  PB
; Structure LVITEM
;   mask.l
;   iItem.l
;   iSubItem.l
;   state.l
;   stateMask.l
;   PB_Alignment1.b[4]
;   *pszText
;   cchTextMax.l
;   iImage.l
;   lParam.i
;   iIndent.l
;   iGroupId.l
;   cColumns.l
;   PB_Alignment2.b[4]
;   puColumns.i
;   piColFmt.i
;   iGroup.l
; EndStructure

; Version fichier h etc. --> 10.0.18362.0
; commctrl.h  Structure x64 line 3219
; typedef struct tagLVITEMW
; {
;     UINT mask;
;     int iItem;
;     int iSubItem;
;     UINT state;
;     UINT stateMask;
;     LPWSTR pszText;
;     int cchTextMax;
;     int iImage;
;     LPARAM lParam;
;     int iIndent;
; #if (NTDDI_VERSION >= NTDDI_WINXP)
;     int iGroupId;
;     UINT cColumns; // tile view columns
;     PUINT puColumns;
; #endif
; #if (NTDDI_VERSION >= NTDDI_VISTA)
;     int* piColFmt;
;     int iGroup; // readonly. only valid for owner data.
; #endif
; } LVITEMW, *LPLVITEMW;


CompilerSelect #PB_Compiler_Processor
      CompilerCase #PB_Processor_x86
            Debug "  Compilation Window 32 bit - mode unicode"
            Structure LVITEM_x86 Extends LVITEM
            EndStructure
           
            Debug ""
            Debug "  Structure LVITEM_x86"
            Debug "  --------------------"
           
            Debug "  SizeOf(  LVITEM_x86  ) = " + Str(SizeOf(LVITEM_x86))
            Debug ""
            Debug "  OffsetOf(  mask  ) = " + Str(OffsetOf(LVITEM_x86\mask))
            Debug "  OffsetOf(  iItem  ) = " + Str(OffsetOf(LVITEM_x86\iItem))
            Debug "  OffsetOf(  iSubItem  ) = " + Str(OffsetOf(LVITEM_x86\iSubItem))
            Debug "  OffsetOf(  state  ) = " + Str(OffsetOf(LVITEM_x86\state))
            Debug "  OffsetOf(  stateMask  ) = " + Str(OffsetOf(LVITEM_x86\stateMask))
            Debug "  OffsetOf(  *pszText  ) = " + Str(OffsetOf(LVITEM_x86\pszText))
            Debug "  OffsetOf(  cchTextMax  ) = " + Str(OffsetOf(LVITEM_x86\cchTextMax))
            Debug "  OffsetOf(  iImage  ) = " + Str(OffsetOf(LVITEM_x86\iImage))
            Debug "  OffsetOf(  lParam  ) = " + Str(OffsetOf(LVITEM_x86\lParam))
            Debug "  OffsetOf(  iIndent  ) = " + Str(OffsetOf(LVITEM_x86\iIndent))
            Debug "  OffsetOf(  iGroupId  ) = " + Str(OffsetOf(LVITEM_x86\iGroupId))
            Debug "  OffsetOf(  cColumns  ) = " + Str(OffsetOf(LVITEM_x86\cColumns))
            Debug "  OffsetOf(  puColumns  ) = " + Str(OffsetOf(LVITEM_x86\puColumns))
            Debug "  OffsetOf(  piColFmt  ) = " + Str(OffsetOf(LVITEM_x86\piColFmt))
            Debug "  OffsetOf(  iGroup  ) = " + Str(OffsetOf(LVITEM_x86\iGroup))
           
           
           
      CompilerCase #PB_Processor_x64
            ; Structure PureBasic mise à jour/Structure PureBasic LVITEM updated
            Debug "  Compilation Window 64 bit - mode unicode"
            Structure LVITEM_x64
                  mask.l
                  iItem.l
                  iSubItem.l
                  state.l
                  stateMask.l
                  PB_Alignment1.b[4]
                  *pszText
                  cchTextMax.l
                  iImage.l
                  lParam.i
                  iIndent.l
                  iGroupId.l
                  cColumns.l
                  PB_Alignment2.b[4]
                  puColumns.i
                  piColFmt.i
                  iGroup.l
                  PB_Alignment3.b[4]
            EndStructure
           
            Debug ""
            Debug "  Structure LVITEM_x64"
            Debug "  --------------------"
           
            Debug "  SizeOf(  LVITEM_x64  ) = " + Str(SizeOf(LVITEM_x64))
            Debug ""
            Debug "  OffsetOf(  mask  ) = " + Str(OffsetOf(LVITEM_x64\mask))
            Debug "  OffsetOf(  iItem  ) = " + Str(OffsetOf(LVITEM_x64\iItem))
            Debug "  OffsetOf(  iSubItem  ) = " + Str(OffsetOf(LVITEM_x64\iSubItem))
            Debug "  OffsetOf(  state  ) = " + Str(OffsetOf(LVITEM_x64\state))
            Debug "  OffsetOf(  stateMask  ) = " + Str(OffsetOf(LVITEM_x64\stateMask))
            Debug "  OffsetOf(  *pszText  ) = " + Str(OffsetOf(LVITEM_x64\pszText))
            Debug "  OffsetOf(  cchTextMax  ) = " + Str(OffsetOf(LVITEM_x64\cchTextMax))
            Debug "  OffsetOf(  iImage  ) = " + Str(OffsetOf(LVITEM_x64\iImage))
            Debug "  OffsetOf(  lParam  ) = " + Str(OffsetOf(LVITEM_x64\lParam))
            Debug "  OffsetOf(  iIndent  ) = " + Str(OffsetOf(LVITEM_x64\iIndent))
            Debug "  OffsetOf(  iGroupId  ) = " + Str(OffsetOf(LVITEM_x64\iGroupId))
            Debug "  OffsetOf(  cColumns  ) = " + Str(OffsetOf(LVITEM_x64\cColumns))
            Debug "  OffsetOf(  puColumns  ) = " + Str(OffsetOf(LVITEM_x64\puColumns))
            Debug "  OffsetOf(  piColFmt  ) = " + Str(OffsetOf(LVITEM_x64\piColFmt))
            Debug "  OffsetOf(  iGroup  ) = " + Str(OffsetOf(LVITEM_x64\iGroup))
           
CompilerEndSelect

result in x86 mode :
Image
result in x64 mode :
Image

_________________
A+
Denis


Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Mon Nov 23, 2020 3:21 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 14181
Location: France
We opensourced the whole Residents directory, so please do a pull request if you want to add something to it:

https://github.com/fantaisie-software/p ... ts/Windows


Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Mon Nov 23, 2020 11:41 pm 
Offline
New User
New User

Joined: Mon May 07, 2018 9:58 am
Posts: 5
Hi Fred, Could you also upload files from /Imports there? he is already in "free" access.
There is a desire to assign normal names to parameters, all Arg1-ArgX and then you can update the current APIFunctionListing.txt in one click


Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Mon Dec 21, 2020 11:36 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 803
Missing constant: #CALLBACK_EVENT = $50000
https://docs.microsoft.com/en-us/window ... aveoutopen


Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Tue Dec 22, 2020 3:36 pm 
Offline
User
User

Joined: Wed Dec 31, 2008 3:36 pm
Posts: 53
From my codes I have this to ask for:
Single constants (maybe already mentioned in the former texts
Code:
#MOD_NOREPEAT          = $00004000    ;' Hotkey parameter

#CAPTUREBLT            = $40000000    ;' BitBlt parameter
 
#HWND_MESSAGE          =        -3    ;' creates a Message-Only Window --> SetParent(WindowID(<Window>), #HWND_MESSAGE)

#LBS_NOSEL             = $00004000    ;' 0x4000 ... in ListViewGadget()  ???


Receiving Shutdown messages
Maybe this WM_ messages can go into the main loop by similar PB_Event_... events ?
The constants below are missing anyways.
Code:
;   ;' WM_QUERYENDSESSION and WM_ENDSESSION lParam
;   ;'   Note that this parameter is a bit mask.
;   ;'   To test for this value, use a bit-wise operation; do not test for equality.
;   ;' WM_ENDSESSION ..
;   ;'  If wParam is TRUE, the application must shut down.
;   ;'  Any Data should be saved automatically without prompting the user (For more information, see Remarks).
;   ;'  The Restart Manager sends this message when the application is using a file that needs to be replaced,
;   ;'  when it must service the system, Or when system resources are exhausted. The application will be restarted
;   ;'  if it has registered for restart using the RegisterApplicationRestart function. For more information, see Guidelines for Applications.
;   ;'
;   ;'  If wParam is FALSE, the application should not shut down.
#ENDSESSION_CLOSEAPP   = $00000001     ;' (0x1)
#ENDSESSION_CRITICAL   = $40000000     ;' (0x40000000)  The application is forced to shut down.
#ENDSESSION_LOGOFF     = $80000000     ;' (0x80000000)  The user is logging off. For more information, see Logging Off.


Power Management
The constant for PowerSettingChange is already defined, the structure unfortunately not. (Sorry, this request needs some improvement.)
Code:
;   ;' #WM_POWERBROADCAST -- constants for windows powermanagement message
;   ;' [url]https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-powerbroadcast_setting[/url]

;   Global pbs.POWERBROADCAST_SETTING

  Debug #PBT_POWERSETTINGCHANGE      ;' = $8013         ;' A power setting change event has been received.


I found more missing constants like this:
Code:
  #PBTF_APMRESUMEFROMFAILURE   = $00000001     ;' not found

  #PBT_APMQUERYSTANDBY         = $0001         ;' not found
  #PBT_APMQUERYSTANDBYFAILED   = $0003         ;' not found
  #PBT_APMSTANDBY              = $0005         ;' not found
  #PBT_APMRESUMESTANDBY        = $0008         ;' not found

Select uMsg
  Case #WM_POWERBROADCAST
    If wParam = #PBT_APMQUERYSUSPEND Or wParam = #PBT_APMQUERYSTANDBY
      ;' windows want to go into standby or hibernation mode
    ElseIf wParam = #PBT_APMRESUMECRITICAL Or wParam = #PBT_APMRESUMESUSPEND Or wParam = #PBT_APMRESUMESTANDBY
      ;'  windows returns from standby or hibernation
    EndIf
;'
; [url]http://msdn.microsoft.com/en-us/library/aa372721(VS.85).aspx[/url]

; The system allows approximately two seconds for an application to handle this notification. If an application is still performing operations after its time allotment has expired, the system may interrupt the application.
; Windows Server 2003 and Windows XP/2000: Applications are allowed up to 20 seconds to respond to the PBT_APMSUSPEND event.



Autocomplete on Stringgadget
Code:
#SHACF_DEFAULT               = $00000000
#SHACF_FILESYSTEM            = $00000001     ;' *
#SHACF_URLHISTORY            = $00000002
#SHACF_URLMRU                = $00000004
#SHACF_URLALL                = #SHACF_URLHISTORY | #SHACF_URLMRU
#SHACF_USETAB                = $00000008
#SHACF_FILESYS_ONLY          = $00000010
#SHACF_AUTOSUGGEST_FORCE_ON  = $10000000
#SHACF_AUTOSUGGEST_FORCE_OFF = $20000000
#SHACF_AUTOAPPEND_FORCE_ON   = $40000000
#SHACF_AUTOAPPEND_FORCE_OFF  = $80000000
#SHACF_FILESYS_DIRS          = $00000020

;' sample code
  CoInitialize_(#Null) ;' init once at beginning -- for autocomplete in stringgadgets 
  ; ...
    StringGadget(#GADGET_SourceDir, 288, 80, 304, 20, "")
    SHAutoComplete_(GadgetID(#GADGET_SourceDir), #SHACF_AUTOAPPEND_FORCE_ON | #SHACF_AUTOSUGGEST_FORCE_ON | #SHACF_FILESYSTEM)
  ; ...
  CoUninitialize_()  ;' uninit at end of program

_________________
Running PureBasic <latest Version> (x64) on Windows 10 Home


Top
 Profile  
Reply with quote  
 Post subject: Re: Requested API Structure and constants
PostPosted: Mon Dec 28, 2020 3:04 pm 
Offline
User
User

Joined: Wed Dec 31, 2008 3:36 pm
Posts: 53
Together with the MessageBox_(..) function there is a constant missing:

Code:
;MB_DEFBUTTON1 = $00000000  ;' The first button is the default button. #MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
;MB_DEFBUTTON2 = $00000100  ;' The second button is the default button.
;MB_DEFBUTTON3 = $00000200  ;' The third button is the default button.
#MB_DEFBUTTON4 = $00000300  ;' The fourth button is the default button.

_________________
Running PureBasic <latest Version> (x64) on Windows 10 Home


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 43 posts ]  Go to page Previous  1, 2, 3

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye