Support for GetLayeredWindowAttributes

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Support for GetLayeredWindowAttributes

Post by MachineCode »

Because PureBasic already supports SetLayeredWindowAttributes, but not getting them.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: Support for GetLayeredWindowAttributes

Post by Mijikai »

+1 still missing
User avatar
chi
Addict
Addict
Posts: 1034
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Support for GetLayeredWindowAttributes

Post by chi »

It's probably faster to add missing API functions yourself... :oops:
  • copy user32.lib (from your desired WinSDK) to ".\PureBasic\PureLibraries\Windows\Libraries"
  • create an .imp file and copy it to ".\PureBasic\PureLibraries\Windows"
  • edit ".\PureBasic\Compilers\APIFunctionListing.txt" and add the function
Let me know if you need any help. I could write a more detailed tutorial ^^
Et cetera is my worst enemy
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4663
Joined: Sun Apr 12, 2009 6:27 am

Re: Support for GetLayeredWindowAttributes

Post by RASHAD »

Hi

Code: Select all

Prototype LayeredWindowAttributes(a,b,c,d)

OpenLibrary(0, "user32.dll")
Global GetLayeredWindowAttributes_.LayeredWindowAttributes = GetFunction(0, "GetLayeredWindowAttributes")

OpenWindow(0,0,0,640,480,"",#PB_Window_ScreenCentered| #PB_Window_SystemMenu)
SetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE) | #WS_EX_LAYERED)
SetLayeredWindowAttributes_(WindowID(0), $0000FF, 128, #LWA_ALPHA)

GetLayeredWindowAttributes_(WindowID(0), @color, @alpha, #LWA_ALPHA)
;GetLayeredWindowAttributes_(WindowID(0), @color, @alpha, #LWA_COLORKEY)
Debug color
Debug alpha

Repeat
  EventID = WaitWindowEvent()
 
Until EventID = #PB_Event_CloseWindow
CloseLibrary(0)


Egypt my love
User avatar
chi
Addict
Addict
Posts: 1034
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Support for GetLayeredWindowAttributes

Post by chi »

Hi

Code: Select all

GetLayeredWindowAttributes_(WindowID(0), @color, @alpha, @flags)

Debug color
Debug alpha
Debug flags
Et cetera is my worst enemy
Post Reply