<div class="meta" robots="noindex">

</div>

Constant

# TargetWin32

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

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2018r1. Please use `TargetWindows</api/compiler_directives/targetwindows>` as a replacement.

</div>

## Description

Used to indicate that the code has been compiled for or is running on Microsoft Windows.

## Usage

*result* = **TargetWin32**

| Part   | Type                               | Description                                                           |
|--------|------------------------------------|-----------------------------------------------------------------------|
| result | `Boolean</api/data_types/boolean>` | Returns `True</api/language/true>` if you are compiling Windows code. |

## Notes

TargetWin32 indicates that your application compiled or running on Windows (using the Win32 platform, as opposed to something like .NET). This is True for both 64-bit and 32-bit apps. If you need to detect whether an app is 32-bit or 64-bit, use the appropriate constants: `Target32Bit</api/compiler_directives/target32bit>` and `Target64Bit</api/compiler_directives/target64bit>`.

## Sample code

Use this code to follow a different code path when running on Windows:

``` xojo
If TargetWin32 Then
  ' Do some Windows-specific stuff here
End If
```

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

Using conditional compilation with the <span class="title-ref">TargetWin32</span> constant means that this code will only appear in Windows builds:

``` xojo
#If TargetWin32 Then
  ' Use Registry to save preferences
#EndIf
```

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

This example function can be used to detect if you application is building for a 64-bit version of Windows:

``` xojo
#If TargetWin32
  #If Target64Bit
    ' Building for 64-bit Windows
  #Else
    ' Building for 32-bit Windows
  #EndIf
#EndIf
```

## Compatibility

All project types on all supported operating systems.

## See also

`DebugBuild</api/compiler_directives/debugbuild>`, `XojoVersion</api/language/xojoversion>`, `XojoVersionString</api/language/xojoversionstring>`, `TargetBigEndian</api/compiler_directives/targetbigendian>`, `TargetMacOS</api/compiler_directives/targetmacos>`, `TargetDesktop</api/compiler_directives/targetdesktop>`, `TargetLinux</api/compiler_directives/targetlinux>`, `TargetLittleEndian</api/compiler_directives/targetlittleendian>`, `TargetMachO</api/compiler_directives/targetmacho>`, `TargetMacOS</api/compiler_directives/targetmacos>`, `TargetWeb</api/compiler_directives/targetweb>`, `TargetX86</api/compiler_directives/targetx86>`, `Target32Bit</api/compiler_directives/target32bit>`, `Target64Bit</api/compiler_directives/target64bit>` constants; `＃If...＃EndIf</api/compiler_directives/if...endif>` statement.
