Class

# OSHandle

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

<span class="title-ref">OSHandle</span> is used to convert a `Ptr</api/data_types/additional_types/ptr>` to a `Integer</api/data_types/integer>` for use with `declares</api/language/declare>`. For convenience, it will also accept `Integers</api/data_types/integer>`.

<span class="title-ref">OSHandle</span> is a special class in that it acts more like a keyword. See the `sample code<oshandle.sample_code>` for more details.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                    | Type                               | Read-Only | Shared |
|-------------------------|------------------------------------|-----------|--------|
| `Value<oshandle.value>` | `Integer</api/data_types/integer>` | ✓         |        |

## Property descriptions

<div id="oshandle.value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

OSHandle.Value

**Value** As `Integer</api/data_types/integer>`

> The converted value.
>
> This property is read-only.

## Notes

Use this class when you need to be able to pass both `Integers</api/data_types/integer>` and `pointers</api/data_types/additional_types/ptr>` to the same declare.

Consider a method in your Xojo code called Foo that accepts an <span class="title-ref">OSHandle</span> as a parameter. That method could then create a declare that accepts an `Integer</api/data_types/integer>`. When you call the declare method, you could then pass it a variable of type <span class="title-ref">OSHandle</span> which could have been assigned either an `Integer</api/data_types/integer>` or a `Ptr</api/data_types/additional_types/ptr>`.

## Sample code

To use this, declare a parameter as \`OSHandle\`:

``` xojo
MyMethod(handle As OSHandle)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

You can then pass in either an `Integer</api/data_types/integer>` or a `Ptr</api/data_types/additional_types/ptr>`:

``` xojo
Var handle As OSHandle = 5
MyMethod(handle)
```

## Compatibility

|                       |                               |
|-----------------------|-------------------------------|
| **Project Types**     | Console, Desktop, Mobile, Web |
| **Operating Systems** | iOS, Linux, macOS, Windows    |

<div id="oshandle.see_also">

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `Declare</api/language/declare>` keyword, `Ptr</api/data_types/additional_types/ptr>` data type, `External Methods</getting_started/using_the_xojo_language/advanced_language_features/external_methods>` topic

</div>

</div>
