• Welcome to Jose's Read Only Forum 2023.
 

CWindow and PROPERTY SET ClassName (BYVAL strClassName AS STRING)

Started by Mikael Tobiasson, February 13, 2019, 12:14:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mikael Tobiasson

When I set my own classname, ":0" is added to the end of the  classname.

e.g. pWindow.ClassName = "myWinclass"
The classname becomes "myWinclass:0"

I'm curious why.
/Mikael


José Roca

Because there is other code, such the one that deals with tab pages, that create new instances of CWindow on the fly and will fail to register the class if the name of the class if already registered.

Mikael Tobiasson

Hi Jose, I became curious when I noticed the below code in your include file.

IF LEN(strClassName) THEN szClassName = strClassName ELSE szClassName = "PBWindowClass"
    szClassName = szClassName & ":" & FORMAT$(nCount)

I sometimes use FindWindow with classnames, I just have to remember to add the ":0" when using CWindow.

Thank you /Mikael