#include once "window9.bi"

Function SetGadgetStyle(byval gadget As Long, byval style As Integer, byval ExStyle As Bool, byval added As BOOL) As Integer Export
	If ExStyle<>0 Then
		ExStyle = GWL_EXSTYLE
	Else
		ExStyle = GWL_STYLE
	EndIf
	If added = 0 Then
		Function = SetWindowLongPtr(GadgetID(gadget),ExStyle,style)
	Else
		Function = SetWindowLongPtr(GadgetID(gadget),ExStyle,style Or GetWindowLongPtr(GadgetID(gadget),ExStyle))
	endif
End Function

Function SetWindowStyle(byval hwnd As HWND, byval style As Integer, byval ExStyle As Bool, byval added As BOOL) As Integer Export
	If ExStyle<>0 Then
		ExStyle = GWL_EXSTYLE
	Else
		ExStyle = GWL_STYLE
	EndIf
	If added = 0 Then
		Function = SetWindowLongPtr(hwnd,ExStyle,style)
	Else
		Function = SetWindowLongPtr(hwnd,ExStyle,style Or GetWindowLongPtr(hwnd,ExStyle))
	EndIf
End Function