Maximum number of gadgets
Maximum number of gadgets
Hi
I am working on a small application and I would like to use lots of gadgets. Is there any way I can use more gadgets then 10.000? If i create a lot I get the message: #Gadget object number is very high (over 10.000).
Any ideas?????
Neuronic
I am working on a small application and I would like to use lots of gadgets. Is there any way I can use more gadgets then 10.000? If i create a lot I get the message: #Gadget object number is very high (over 10.000).
Any ideas?????
Neuronic
Re: Maximum number of gadgets
How can a small application have more than 10000 gadgets????
Re: Maximum number of gadgets
He probably doesn't. He's may be referrring to a gadget by an improper id for the gadget in question.Phoenix wrote:How can a small application have more than 10000 gadgets????
I thought the message was 100,000 not 10,000 but my references to it may have been something other than on a gadget.
cheers
-
- Enthusiast
- Posts: 196
- Joined: Tue Sep 30, 2003 4:32 pm
- Location: The Netherlands
For files it is a 1000, had that exception yesterday try-ing to open a file with the number 1005, so why not for gadgets?
Jan V.
Jan V.
Life goes to Fast, Enjoy!!
PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!
AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!
AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
Hi again
I would really like to have that many gadgets. It is not a wrong id number or anything similar. The application is a simple map editor, where i need ImageGadgets depending on the size of the map.
If I turn the debugger off the execution goes on, but there are no more gadgets created.
Off course I can use a different method, where i don't need thousands of gadgets, but using this is the easiest way.
Bye
Neuronic
I would really like to have that many gadgets. It is not a wrong id number or anything similar. The application is a simple map editor, where i need ImageGadgets depending on the size of the map.
If I turn the debugger off the execution goes on, but there are no more gadgets created.
Off course I can use a different method, where i don't need thousands of gadgets, but using this is the easiest way.
Bye
Neuronic
Without #PB_Any you can create only 10000 Gadgets.
Use #PB_Any, you can create Gadgets with max from OS
Use #PB_Any, you can create Gadgets with max from OS
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.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
I almost replied with ts-soft's answer, as I believed it to work like that. It does work like that with windows as opposed to gadgets. But I ran a little test and it seems like there is an upper limit of 9999 for gadgets:
See what result you get, but I can't ever get more than 9999 successful gadget creations.
Code: Select all
Dim gadgets(100000)
OpenWindow(0,0,0,800,600,"")
CreateGadgetList(WindowID(0))
CreateImage(0,1,1)
gadgetcount = 1
gadgets(gadgetcount) = ImageGadget(#PB_Any, Random(799),Random(599),1,1,ImageID(0))
While IsGadget(gadgets(gadgetcount)) <> 0
gadgetcount+1
gadgets(gadgetcount) = ImageGadget(#PB_Any, Random(799),Random(599),1,1,ImageID(0))
Wend
Debug "Number of gadgets created: "+Str(gadgetcount)
Repeat:Until WaitWindowEvent()=#WM_CLOSE
BERESHEIT
You can Create Gadget from 0 to 9999 and Window from 0 to 4999 with
Constants! More only with #PB_Any
Constants! More only with #PB_Any
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.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

I modified your sample code to create 9000 gadgets with constants 1-9000 and then create as many additional ones as were possible with #PB_Any. I still only came to 9999 total. So it seems that combinations of constant numbering and #PB_Any doesn't seem to increase the total possible.netmaestro wrote:See what result you get, but I can't ever get more than 9999 successful gadget creations.
Demivec
It's probably a Windows limitation, as each control is an handle and 10 000 handle for only one application is way too much. Somebody can do a loop of CreateWindowEx() to see if it's reproducible with API only ?
BTW, the debugger warning about the maximum reached is just a warning, it doesn't prevent the creation.
BTW, the debugger warning about the maximum reached is just a warning, it doesn't prevent the creation.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Good idea, Fred:
This code is debugging 9999 here. I vote for Windows limitation 
[edit] The max# of open windows seems to be 10000, as if I remove the OpenWindow() from the above snip and take out the #WS_CHILD style, it dies at 10000 instead of 9999.
Code: Select all
hwnd=OpenWindow(0,0,0,320,240,"")
Repeat
MyText=CreateWindowEx_(#WS_EX_LEFT,"Static","",#WS_CHILD|#SS_CENTER,0,100,200,20,hwnd,0,GetModuleHandle_(0),0)
cc+1
Until mytext=0
Debug cc

[edit] The max# of open windows seems to be 10000, as if I remove the OpenWindow() from the above snip and take out the #WS_CHILD style, it dies at 10000 instead of 9999.
BERESHEIT