Color bug when use Win32Api

Windows specific forum
User avatar
gurj
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Color bug when use Win32Api

Post by gurj »

Color bug when use Win32Api
1 use #LWA_COLORKEY, bug when moust into Or out a form,Color destroy
2 use #GWLP_HWNDPARENT Or SetParent_(),setColor invalidation

Code: Select all

OpenWindow(1,0,0,200,200,"",#PB_Window_SystemMenu)
g1=ButtonGadget(1, 0, 0,200, 20,""):bc=GetPixel_(GetDC_(g1),33,10)
;TODO test code 1 {
SetWindowLongPtr_(g1, #GWL_EXSTYLE,GetWindowLongPtr_(g1, #GWL_EXSTYLE) | #WS_EX_LAYERED)
SetLayeredWindowAttributes_(g1, bc,0, #LWA_COLORKEY)
;}
g2=TextGadget(2, 2, 2,196, 16,"text",#PB_Text_Center)
SetGadgetColor(2,#PB_Gadget_FrontColor,#Red)
SetGadgetColor(2,#PB_Gadget_BackColor,#Green)
;TODO test code 2 {
;SetWindowLongPtr_(g2,#GWLP_HWNDPARENT,g1)
;}
;TODO test code 3 {
;SetParent_(g2, g1)
;}
TextGadget(3, 0, 60,200, 20,"move")
ButtonGadget(4, 0, 25,200, 20,"try")
Repeat:ev=WaitWindowEvent():Select ev
  Case #PB_Event_Gadget:eg=EventGadget()
   Select eg
    Case 4
;TODO test code 1 {
     ResizeGadget(3,0, 0,200, 20)
     Delay(2222):ResizeGadget(3,0, 60,200, 20)
     Delay(2222):SetCursorPos_(100,35)
     While WindowEvent():Wend
;}
   EndSelect
   
  Case #PB_Event_CloseWindow:Break
EndSelect:ForEver
End
; IDE Options = PureBasic 5.70 LTS (Windows - x86)
; CursorPosition = 3
; EnableXP
; DPIAware
my pb for chinese:
http://ataorj.ys168.com
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Color bug when use Win32Api

Post by chi »

https://docs.microsoft.com/en-us/window ... ed-windows
Beginning with Windows 8, WS_EX_LAYERED can be used with child windows and top-level windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.
Et cetera is my worst enemy
User avatar
gurj
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: Color bug when use Win32Api

Post by gurj »

Thanks to Chi, answer the first question!
my pb for chinese:
http://ataorj.ys168.com
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Color bug when use Win32Api

Post by Fred »

API only use, not a PB bug
Post Reply