VERIFIED SOLUTION i

Is there a way to set the Map Window ID number via MapBasic?

Product Affected: MapBasic
Product Feature: Statements and Functions
 
Window ID cannot be set on a window.
However, the current Window ID can be read from that window and used within the MapBasic script\program.

The easiest way to get window ID is by using the FrontWindow() function.
This function returns the ID of the active window.

In an ideal scenario, the process will often be that a new window is opened or created and then the ID of this window is queried:

Dim nWindowID As Integer

Map From MyTable1, MyTable2
nWindowID = FrontWindow()

Now the variable nWindowID can be used in the MapBasic script to refer to the Map window.

For more information, refer MapBasic Reference Guide.
UPDATED:  June 28, 2018