Jose's Read Only Forum 2023

IT-Consultant: José Roca (PBWIN 10+/PBCC 6+) (Archive only) => Discussion => Topic started by: Mikael Tobiasson on February 13, 2019, 12:14:43 AM

Title: CWindow and PROPERTY SET ClassName (BYVAL strClassName AS STRING)
Post by: Mikael Tobiasson on February 13, 2019, 12:14:43 AM
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

Title: Re: CWindow and PROPERTY SET ClassName (BYVAL strClassName AS STRING)
Post by: José Roca on February 13, 2019, 05:28:07 PM
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.
Title: Re: CWindow and PROPERTY SET ClassName (BYVAL strClassName AS STRING)
Post by: Mikael Tobiasson on February 13, 2019, 08:07:06 PM
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