Proper way to enable/disable a display?

I’m wondering what the proper way is to either set a connected display to “disconnect this display” mode or set a disabled display to extended/clone mode.

I’m wondering this because I’ve been using NvAPI_GPU_SetEDID to set EDIDs on display IDs, but sometimes when they’re set they start off disconnected and I have to manually turn them to extended mode. Is there some way to do this programatically?