Home/ Reference/ Connection & Init

app.Visible = True

Shows the CDR window. Setting it False is faster for batch runs, but keep it True while debugging so you can see what actually happened.

Signature

app.Visible = True

Notes

Shows the CDR window. Setting it False is faster for batch runs, but keep it True while debugging so you can see what actually happened.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
app.Visible = True        # True = show the UI, so you see each step (keep it on while debugging)

# app.Visible = False     # False = hidden, faster, but you cannot see failures

print("Visible: ", app.Visible)

It controls the application window, not document windows

app.Visible is an application-level property: it shows or hides the CorelDRAW main window. It does not open a document, and it does not bring a particular document window forward — that is the job of the window objects under doc.Windows.

The two opposite problems people hit

Problem one: no window, but the process exists. An instance started through COM can come up minimised or behind everything. Dispatch succeeds, app.Version reads fine, and the screen shows nothing, so you assume you attached to a phantom object. Set app.Visible = True first, then go look at Task Manager.

Problem two: windows flashing, user interrupted. In unattended batch work, showing the window is slower (every step repaints) and, if someone else is using that machine, it keeps stealing focus. That case wants False.

What to do when it is visible but still behind

Visible = True guarantees "shown", not "brought to front". Two approaches:

Keep the perspective though: a background script stealing focus is bad behaviour by default. The legitimate case is you debugging and wanting to see what it is doing. Do that temporarily; do not ship it.

The real cost of setting it to False

Hiding the window does save repaint work, but it is not risk-free. These change behaviour when the application is invisible: anything that depends on a dialog (export options, font substitution prompts, missing-link prompts), some render paths that need a window handle, and properties computed from window dimensions. The failure mode is rarely a clean exception — it is a property that reads back as 0, or a call that waits forever for a dialog nobody will ever see.

So the safe order in batch work: get the whole pipeline correct with Visible = True, then flip it to False and run it again to see which steps slow down or return odd values. Do not debug with it hidden. Errors produced in an invisible session cost several times more to diagnose than the same errors with the window on screen.

Setting it and immediately calling into it

When Dispatch returns, the process exists, but the main window's message pump may not be ready. Fire a heavy operation straight away and you will occasionally get "object not available". The pragmatic readiness check is to read a property that must return something:

Python
import time
import win32com.client

app = win32com.client.Dispatch("CorelDRAW.Application")
app.Visible = True

for _ in range(50):                 # up to 5 seconds
    try:
        n = app.Documents.Count    # readable means the channel is live
        break
    except Exception:
        time.sleep(0.1)
else:
    raise SystemExit("CorelDRAW started but never became ready - check for a modal dialog")

print("ready, open documents:", n)

This beats a flat time.sleep(10): no wasted time on fast machines, and no shortfall on slow ones.

Typical usage

Python
import win32com.client

app = win32com.client.Dispatch("CorelDRAW.Application")

# interactive debugging: show the window so you can watch it work
app.Visible = True

# unattended batch: use this instead, it cuts repaint work
# app.Visible = False

doc = app.CreateDocument()
print(doc.Name, doc.Pages.Count)

Details that trip people up

About this section: Connection & Init

Connection & Init — connecting to CorelDRAW over COM.

Other entries in this section