Announcement

Collapse
No announcement yet.

WinAPI changes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • WinAPI changes

    The date of the winapi32.inc file included with PB9 is 27 January 2005, and that included with PB8.04 is dated after, at 21 February 2005.

    The differences between the files are minor, but may be relevant to someone. I have sent an e-mail to [email protected] with regard to this subject.

    Code:
    PB9:	Last Update: 27 January 2005
    PB8:	Last Update: 21 February 2005
    The following declarations have the word 'CodePage' mis-spelt as 'CodePag' in the PB9 version. In the PB8 version, the word is spelt correctly:

    Code:
    PB9:
    DECLARE FUNCTION GetCPInfo LIB "KERNEL32.DLL" ALIAS "GetCPInfo" (BYVAL CodePag AS DWORD, lpCPInfo AS CPINFO) AS LONG
    DECLARE FUNCTION GetCPInfoEx LIB "KERNEL32.DLL" ALIAS "GetCPInfoExA" (BYVAL CodePag AS DWORD, BYVAL dwFlags AS DWORD, lpCPInfo AS CPINFOEX) AS LONG
    DECLARE FUNCTION IsDBCSLeadByteEx LIB "KERNEL32.DLL" ALIAS "IsDBCSLeadByteEx" (BYVAL CodePag AS DWORD, BYVAL bTestChar AS BYTE) AS LONG
    DECLARE FUNCTION IsValidCodePage LIB "KERNEL32.DLL" ALIAS "IsValidCodePage" (BYVAL CodePag AS DWORD) AS LONG
    DECLARE FUNCTION MultiByteToWideChar LIB "KERNEL32.DLL" ALIAS "MultiByteToWideChar" (BYVAL CodePag AS DWORD, BYVAL dwFlags AS DWORD, lpMultiByteStr AS ASCIIZ, BYVAL cchMultiByte AS LONG, lpWideCharStr AS DWORD, BYVAL cchWideChar AS LONG) AS LONG
    DECLARE FUNCTION WideCharToMultiByte LIB "KERNEL32.DLL" ALIAS "WideCharToMultiByte" (BYVAL CodePag AS DWORD, BYVAL dwFlags AS DWORD, lpWideCharStr AS ANY, BYVAL cchWideChar AS LONG, lpMultiByteStr AS ANY, BYVAL cchMultiByte AS LONG, _
    DECLARE FUNCTION CharNextEx LIB "USER32.DLL" ALIAS "CharNextExA" (BYVAL CodePag AS WORD, lpCurrentChar AS ASCIIZ, BYVAL dwFlags AS DWORD) AS DWORD
    DECLARE FUNCTION CharPrevEx LIB "USER32.DLL" ALIAS "CharPrevExA" (BYVAL CodePag AS WORD, lpStart AS ASCIIZ, lpCurrentChar AS ASCIIZ, BYVAL dwFlags AS DWORD) AS DWORD
    The change in the PB9 version is correct as it includes a BYVAL:

    Code:
    PB9 (correct):
    DECLARE FUNCTION EnumDisplayMonitors LIB "USER32.DLL" ALIAS "EnumDisplayMonitors" (BYVAL hdc AS DWORD, lprcClip AS RECT, BYVAL lpfnEnum AS DWORD, BYVAL dwData AS LONG) AS LONG
    
    PB8 (missing BYVAL):
    DECLARE FUNCTION EnumDisplayMonitors LIB "USER32.DLL" ALIAS "EnumDisplayMonitors" (BYVAL hdc AS DWORD, lprcClip AS RECT, lpfnEnum AS DWORD, BYVAL dwData AS LONG) AS LONG

    In addition, I would like to suggest the following changes and additions to winapi32.inc:

    In the 'Raw Input Device Information' section:

    Add:
    Code:
    %RIDEV_INPUTSINK    = &H00000100
    Change:
    Code:
    TYPE RID_DEVICE_INFO_KEYBOARD
        dwType AS DWORD
        dwSubType AS DWORD
        dwKeyboardMode AS DWORD
        dwNumberOfFunctionKeys AS DWORD
        dwNumberOfKeysTotal AS DWORD
    END TYPE
    to:
    Code:
    TYPE RID_DEVICE_INFO_KEYBOARD
      dwType                  AS DWORD
      dwSubType               AS DWORD
      dwKeyboardMode          AS DWORD
      dwNumberOfFunctionKeys  AS DWORD
      dwNumberOfIndicators    AS DWORD			' << add this line
      dwNumberOfKeysTotal     AS DWORD
    END TYPE

    And add the following:

    Code:
    DECLARE FUNCTION ConvertSidToStringSid LIB "ADVAPI32.DLL" ALIAS "ConvertSidToStringSid" (pSid AS ANY, pStringSid AS ANY) AS LONG
    
    DECLARE FUNCTION CreateProcessWithLogonW LIB "ADVAPI32.DLL" ALIAS "CreateProcessWithLogonW" (BYVAL lpUsername AS DWORD, _
                     BYVAL lpDomain AS DWORD, BYVAL lpPassword AS DWORD, BYVAL dwLogonFlags AS DWORD, BYVAL lpApplicationName AS DWORD, _
                     BYVAL lpCommandLine AS DWORD, BYVAL dwCreationFlags AS DWORD, BYVAL lpEnvironment AS DWORD, BYVAL lpCurrentDirectory AS DWORD, _
                     lpStartupInfo AS STARTUPINFO, lpProcessInfo AS PROCESS_INFORMATION) AS LONG
    
    ' equates from shlobj.h
    %SHGFP_TYPE_CURRENT = 0&		' current value for user, verify it exists
    %SHGFP_TYPE_DEFAULT = 1&		' default value, may not exist
    Thanks.

    Christopher

  • #2
    Just for your info:

    Codepage is now a keyword in PowerBasic therefore CodePag
    So here we are, this is the end.
    But all that dies, is born again.
    - From The Ashes (In This Moment)

    Comment


    • #3
      >I have sent an e-mail to [email protected] with regard to this subject.

      And sending email really, really works!

      The correction to EnumDisplayMonitors() was one I sent in, and not very long ago at all. (Others may have have sent it in, too, but that would spoil the story line).
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Yup, Bob and Team listen to everyone, even annoying people like me. I got lots of things I've been needing in this latest version. Lots of inc file changes. I suggested the improved Write# that allows it to work in a loop, etc.

        The explanation above is also correct as to why it was renamed, then shortly after this change the compiler was made to not even care about the keywords that conflict like this. It should make it much easier to not worry about breaking code with the new version now.
        sigpic
        Mobile Solutions
        Sys Analyst and Development

        Comment

        Working...
        X