Unable to modify the form style using the Windows API, the window will blink
require 'fiddle'
require 'fiddle/import'
module User32
extend Fiddle::Importer
dlload 'user32.dll'
extern 'long SetWindowLong(long, int, long)'
extern 'long GetWindowLong(long, int)'
extern 'long FindWindow(char*, char*)'
end
title = Time.now.to_f.to_s
dialog = UI::HtmlDialog.new(
{
:dialog_title => title,
:preferences_key => title,
:scrollable => true, :resizable => true,
:width => 600, :height => 400,
:left => 100, :top => 100,
:min_width => 50, :min_height => 50,
:max_width => 1000, :max_height => 1000,
:style => UI::HtmlDialog::STYLE_WINDOW
})
dialog.set_url("http://www.sketchup.com")
dialog.show
UI.start_timer(0.1,false) do
handle = User32.FindWindow(nil,title)
_style = User32.GetWindowLong(handle, -16)
puts _style
# _style & ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU)
style = _style & (~(0x00C00000 | 0x00040000 | 0x00020000 | 0x00010000 | 0x00080000))
User32.SetWindowLong(handle, -16, style)
puts User32.GetWindowLong(handle, -16)
end
SketchUp now uses the Qt framework for it’s GUI, instead of the old MFC framework.
Qt (pronounced "cute" or as an initialism) is free and open-source cross-platform software for creating graphical user interfaces as well as cross-platform applications that run on various software and hardware platforms such as Linux, Windows, macOS, Android or embedded systems with little or no change in the underlying codebase while still being a native application with native capabilities and speed.
Qt is currently being developed by The Qt Company, a publicly listed company, and the Qt Pr...
Yes,I know. But in the end, they were all Win32 forms.And Sketchup 2023.0 is ok.
The migration to Qt objects has been an ongoing project, so yes you will see changes as they occur with releases beginning with 2022 on up.
I suppose what I am getting at is that you should look into why Qt objects do not respond to low level Win32 calls. I do not believe this is something that was purposefully done by the SketchUp Team.
You are right.I should first verify whether it is caused by the QT framework itself.
Based on the performance of 2023.0 and 2023.1, I thought it was due to some official adjustments.
I don’t think so. I think it would be due to the Qt library redrawing the UI.
Going forward perhaps making Qt calls might be the better way.
gao
December 28, 2023, 2:20am
7
I also encountered the same problem, is there any solution?
style = 0x94000000 # WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS
SetWindowLongA(handle, -16, style)
SetWindowLongA(handle, -20, style)
SetWindowPos(handle, 0, 0, 0, 0, 0, 0x0267)