I guess in those cases where the language might pose a problem you might consider specifying your question in English as well as in your native tongue.
I, for one, haven't got a clue what you are talking about
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
#GWLP_ID = -12
Procedure GadgetFromHwnd(hWnd)
Protected id = GetWindowLongPtr_(hWnd, #GWLP_ID)
If IsGadget(id) And GadgetID(id)=hWnd
ProcedureReturn id ; return gadget number
EndIf
ProcedureReturn -1 ; no PB gadget
EndIf
Procedure GadgetFromHwnd(hWnd)
;Protected id = GetWindowLongPtr_(hWnd, #GWLP_ID)
Protected id = GetDlgCtrlID_(hWnd)
If IsGadget(id) And GadgetID(id)=hWnd
ProcedureReturn id ; return gadget number
EndIf
ProcedureReturn -1 ; no PB gadget
EndProcedure
the same thing but only for Linux needed (тоже самое но только для линукс нужен)
this as SetGadgetData () and GetGadgetData () I only need to read the key and I do not know what Fred put (g_object_get_data_ (GadgetID, "PB_ID")) is not suitable
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom
English is not my native language... (I often use DeepL.)
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
DeclareModule PB
Enumeration
#PB_ID_Window
#PB_ID_Gadget
#PB_ID_Image
EndEnumeration
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Import ""
CompilerElse
ImportC ""
CompilerEndIf
PB_Object_EnumerateStart(*object)
PB_Object_EnumerateNext(*object,*id.Integer)
PB_Object_EnumerateAbort(*object)
PB_Gadget_Objects.i
PB_Image_Objects.i
PB_Window_Objects.i
EndImport
Declare PBID(OS_Handle, Type = #PB_ID_Window)
EndDeclareModule
Module PB
EnableExplicit
Procedure PBID(OS_Handle, Type = #PB_ID_Window)
Protected ID, Objects, Result = -1
If OS_Handle
Select Type
Case #PB_ID_Gadget : Objects = PB_Gadget_Objects
Case #PB_ID_Image : Objects = PB_Image_Objects
Case #PB_ID_Window : Objects = PB_Window_Objects
EndSelect
PB_Object_EnumerateStart(Objects)
While PB_Object_EnumerateNext(Objects, @ID)
Select Type
Case #PB_ID_Gadget
If OS_Handle = GadgetID(ID) : Result = ID : PB_Object_EnumerateAbort(Objects) : Break : EndIf
Case #PB_ID_Image
If OS_Handle = ImageID(ID) : Result = ID : PB_Object_EnumerateAbort(Objects) : Break : EndIf
Case #PB_ID_Window
If OS_Handle = WindowID(ID) : Result = ID : PB_Object_EnumerateAbort(Objects) : Break : EndIf
EndSelect
Wend
EndIf
ProcedureReturn Result
EndProcedure
EndModule
LoadImage(12, #PB_Compiler_Home + "examples/sources/data/geegee2.bmp")
OpenWindow(3, 100, 100, 500, 300, "testwindow")
ButtonGadget(22, 10, 10, 100, 20 , "test")
Debug "Window = " + Str(PB::PBID(WindowID(3)))
Debug "Gadget = " + Str(PB::PBID(GadgetID(22),PB::#PB_ID_Gadget))
Debug "Image = " + Str(PB::PBID(ImageID(12), PB::#PB_ID_Image))
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Last edited by Bisonte on Thu Feb 27, 2014 6:35 pm, edited 1 time in total.
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom
English is not my native language... (I often use DeepL.)