Use custom Win32 Window Class

On the Windows platform, a Xojo Window appears to always use Win32 Window Class “RBWindow” as its underlying class.

I wish to construct a Xojo Window Class which uses a custom Win32 Window Class “my_custom_window_class” as its underlying class.

The reason is that I wish some windows to use certain Class Styles (specified via SetClassLong), which are incompatible with certain Class Styles to be used in other windows of the application.

How may this be done?

No need for a special class. You can change a window property with a simple declare. I use this to get a plain box from any type of window, such as modal, floating, etc.

#If TargetWin32 then Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (hwnd As Integer, nIndex As Integer, dwNewLong As Integer) As Integer Const GWL_STYLE = -16 dim rien as integer = SetWindowLong(self.handle, GWL_STYLE, &H800000) self.left = screen(0).width + 1 #Endif

See https://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).aspx to see how to set style and extended style.

Thank you for the reply.

However - the property I am wishing to manipulate resides on the Win32 Window Class itself.

It is set via SetClassLong. Example:

[code]Const GCL_STYLE = -26
Const CS_DROPSHADOW = &h00020000

Declare Function SetClassLongW Lib “User32” (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
call SetClassLongW(w.Handle, GCL_STYLE, CS_DROPSHADOW)[/code]

Good luck.

This can be done, but it’s not trivial and once you’re finished you will have a new appreciation for how much Xojo does automagically.

For example, here’s how I did it when I needed to create a Scintilla edit control class.