Results 1 to 6 of 6

Calling Windows API with boolean argument in 64bit Excel: long, byte or boolean?

Threaded View

  1. #1
    Registered User
    Join Date
    01-10-2018
    Location
    Italy
    MS-Off Ver
    Excel 365 (2021-01)
    Posts
    71

    Question Calling Windows API with boolean argument in 64bit Excel: long, byte or boolean?

    I need to use the following function of the Windows API:

    Private Declare PtrSafe Function OpenProcess Lib "Kernel32.dll" (ByVal dwDesiredAccess As Long, _
    ByVal bInheritHandle As xxxxxxx, ByVal dwProcessId As Long) As LongPtr
    According to this page the argument bInheritHandle is a C++ BOOL that, if I'm correct, is 8bit.
    So, in place of xxxxxxx I don't know what data type to use: long, byte or boolean?

    Reason to use byte: VBA byte is 8bit as it's C++ boolean
    Reason to use boolean: because, despite it's 16bits in VBA, it's conceptually the same as a C++ 8bit boolean
    Reason to use long: because most (of the few) examples I find on the web use this
    Last edited by 6diegodiego9; 06-23-2022 at 03:20 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Exit Workbook_BeforeClose(Cancel As Boolean) if a public boolean = true
    By meabrams in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2016, 06:10 AM
  2. boolean in excel vba
    By daboho in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2016, 11:28 AM
  3. Optional Boolean Argument
    By cpfrona in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2015, 01:27 AM
  4. Cancel as Boolean argument
    By Larry.LeBlanc@O in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2015, 01:29 PM
  5. Replies: 3
    Last Post: 11-23-2012, 01:57 AM
  6. Using a Boolean function within an If statement: Argument not optional error message
    By elfsprin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-16-2011, 04:12 PM
  7. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) problem
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2009, 07:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1