Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Form: invalid window handle [Closed/Solved]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Sun Oct 27, 2024 3:51 am    Post subject: Form: invalid window handle [Closed/Solved] Reply with quote

I am currently working on a gui for a table. initially no probs, until after some time this appeared: [ https://ibb.co/album/6NZ97H ]
(images are not in proper order...)

Once i press [esc], i'll get the '...loop detected...' error; and it'll repeat this error for quite a few of the elements already on the form (see 3rd pic overview)

Now: when i load the table, and then choose [Table ~ mainGUI - Edit] the form editor loads fine, and i can seem to do pretty much anything without issues ?!
I have no idea where to look for what, so any suggestion would be appreciated. I can obviously start all over again, but fear I'll run into this again at some point...
(i did do some "reshuffling" of panels in the process ~ i rarely use the editor actually)

ps: this tool is in dev_status, so can/want not give more visual info.
ps2: somebody encountered same issue here: [ https://fearlessrevolution.com/viewtopic.php?p=318339#p318339 ]; and workaround is what i've mentioned above.
ps3: building this in v7.2


Last edited by paul44 on Wed Oct 30, 2024 12:10 pm; edited 2 times in total
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1516

PostPosted: Sun Oct 27, 2024 6:00 pm    Post subject: Reply with quote

My idea;

Run this code in a new window with "File--> Add Tab" from the Lua script menu and check the output.

If there is a control that you do not know, have forgotten or "should not be there", an arrangement will be created that you can intervene.

Code:
function writeFormObject(Form)
local prt = ""
i1 = 0
CompCount = Form.getComponentCount()
MFname = Form.getName()
print("Form Name: " .. MFname .. "\n Object Count: " .. CompCount .. "\n")
  for i=0, CompCount -1 do
    i1 = i + 1
    Object = Form.Component[i] --.Name
    local _parent = ""
    if Object.Parent~=nil then
      _parent = Object.Parent.Name
    else
      _parent = "No object parent???"
    end
    _type = object_getClassName(Object) or error("No object type???");
    _name = Object.Name or false
    _left = Object.Left or nil
    _top = Object.Top or nil
    if _left~=nil or _top~=nil then
      prt = string.format(" -------------------- %s \nName = %s \nType = %s \nParent = %s \nLeft = %s \nTop = %s \n--------------------------------- \n",i1,_name,_type,_parent,_left,_top)
    else
      prt = string.format(" -------------------- %s \nName = %s \nType = %s \nParent = %s \n--------------------------------- \n",i1,_name,_type,_parent)
    end
  print(prt)
  end
end

writeFormObject(UDF1)

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Mon Oct 28, 2024 5:28 am    Post subject: all objects are reported... Reply with quote

thx for script; interesting...

as for outcome: all objects are accounted for; no errors reported.
(was kinda hoping for a few '...???' lines here)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25785
Location: The netherlands

PostPosted: Mon Oct 28, 2024 6:02 am    Post subject: Reply with quote

it's related to autosize. One onResize triggers another one which then triggers the original one

Best is remove all onresize event handlers and see if it still happens, and if not, then perhaps put all resizing in a different single spot. e.g a timer that adjusts things a little each time

it can also happen if anchors are used and for some reason they go into a loop

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1516

PostPosted: Mon Oct 28, 2024 6:37 am    Post subject: Re: all objects are reported... Reply with quote

paul44 wrote:

(was kinda hoping for a few '...???' lines here)


Ambiguous outputs (???) are ignored status outputs for "Timer" and similar controls (controls that do not use Parent, Left, Top.)

And an important idea was given by @DB.

I hope there will be more ideas and this type of error will be added to the archive for those who get it.

Good luck.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Mon Oct 28, 2024 11:06 am    Post subject: some more testing.... Reply with quote

test_table and image: [ https://www.mediafire.com/file/bbkwoeykg0snkqi/__GameMgr_GUI_v1.0e_DELETE2.rar/file ]

1. step 1: removed panel_objects one by one. saved table. quit/reload table and tried 'mainGUI.Show()'
=> still error; even after all objects where deleted ?!
2. looking at mainGui, noticed the 'Anchors'...
=> disabled those, save/etc and error disappeared but... show_script will NOT show form
(it gave me a 'circular...' warning upon disabling anchors ~ see image)
==> reload table, then load form via [... Restore and show]: show_script runs fine
3. tried original table/form: dito (see image)

also: no events used on this form. and: i did not touch anything in particular on the form (unless accidentally ofc)

4. just did another test: create new table and form (using v7.5 now)
=> and having pretty much the same problem ?!

-- show_script:
local formGUI = nil
formGUI = mainGUI
formGUI.Width = 1000
formGUI.Height = 800
formGUI.Show()
=> this is what i do in my standard table btw; never had any issues with it.


PS: what is the command/function to show form via [... Restore and show] ?
=> could be my workaround, unless this is not advised ?!
PS2: is it possible to copy/paste elements from one form to another (~ no context_menu, it seems)
=> unless copy/paste via LFM files ? Is this even een good/practical idea ?

Note: ignore the 'Errors & Settings...' (and such) in the linked table; i have been using my framework here; normally not part of this table...
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1516

PostPosted: Mon Oct 28, 2024 2:52 pm    Post subject: Reply with quote

Maybe instead of reprocessing and killing the form (local) in lua and asm, you should try different names!

"formGUI" .. lines: 1395,1411,1425... and script!

Code:
local formGUI = mainGUI

function mainGUI_ProjectClick(sender)
 -- local formGUI = nil

  -- painting form...
       --  formGUI = mainGUI
         local panProject = formGUI.TabProject
         panProject.Visible = true
         local panAnalyse = formGUI.TabAnalyze
         panAnalyse.Visible = false
         local panLog = formGUI.LogShort
         panLog.AnchorSideTop.Control = MidContent
         --print(panProject.Name)

end


-- script

Code:
[ENABLE]

{$lua}
 -- local formGUI = nil
  -- painting form...
     --    formGUI = mainGUI
         formGUI.Width = 1000
         formGUI.Height = 800
         formGUI.Show()

{$asm}

[DISABLE]


( Note: "mainGUI" sounds too global.

Can you create slightly different names for the form name and controls? )

--------------------------------------------------------------------------------

paul44 wrote:

PS: what is the command/function to show form via [... Restore and show] ?


-- use

Code:
function selectFormRestoreClick(mgform)
   local menuItems = MainForm.Menu.Items[3] -- miTable
   for i = 0, menuItems.Count - 1 do
      --print(menuItems[i].Caption)
      if menuItems[i].Name=="miResyncFormsWithLua" then -- Resynchronize forms with Lua
        print(1, menuItems[i].Caption)
        --menuItems[i].DoClick()
      end
      if menuItems[i].Caption==mgform then
        menuItems1 = menuItems[i]
        for j = 0, menuItems1.Count - 1 do
          if menuItems1[j].caption=="Restore and show" then
            menuItems1[j].DoClick()
            --print(2, menuItems1[j].Name)
            --print(2, menuItems1[j].caption)
          end
        end
      end
    end
end

selectFormRestoreClick("mainGUI") -- or "UDF1"


paul44 wrote:

PS2: is it possible to copy/paste elements from one form to another (~ no context_menu, it seems)
=> unless copy/paste via LFM files ? Is this even een good/practical idea ?


If you can't find a different idea, examine the first code I gave.

With this code; Get the necessary properties of the object and add it to the other form (Form name or owner or parent assignment.)
Also, if you do this while the new form is open in the "Form Designer", you won't have any problems with the registration.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Tue Oct 29, 2024 1:19 am    Post subject: a "small" favour... Reply with quote

^ @AylinCE: thx for maintaining support; really appreciated !
=> will try out your suggestions this evening, and report back
(btw: form_naming is of "no importance", so will change that name pronto)

Can i ask one big favour ?
1. create a new table
2. add a standard form; do NOT touch/change any of the props
3. add script to addresslist, which will show that script
(i've used the width/height so i could clearly see its result)
4. save that table, then quit
5. load the table, then click the script: will it show the form ?

=> if not, then you know where i am atm...
=> if it DOES show without errors, please upload your table so i can try that one out. The "only" thing i can then think of, is that either i have some CE registry issues and/or CE installation issues (or something alike) ?!
(ignoring the fact that i've tried it with both v7.2 & v7.5)
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1516

PostPosted: Tue Oct 29, 2024 1:48 am    Post subject: Reply with quote

I followed what you said and had no problems.
Here is the method I used and CT.

CT : https://www.mediafire.com/file/v769ql1shoa01ck/exformShow1.CT/file

---------------------------------------
Note: I ran it without any problems on your ct form that you linked.

You may also consider publishing an article on "Cheat Engine Extensions" for your extensions.

----------------------------------------
If you have any problems with this;

1) Transfer all the extension files that you added to the autorun folder, except the original CE extensions, to an empty folder.

2) Run "ceregreset.exe".

3) Re-open the created (error) form.ct.

4) If it works fine, put one of your own extensions that you transferred to the empty folder into the autorun folder and repeat steps 3 and 4.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Tue Oct 29, 2024 12:46 pm    Post subject: continuing... and on hold... Reply with quote

^tested that table and had zero issues; just working as expected...
=> worse even: did the same process all over again (7.2 & 7.5), and this time had no probs either ?!

So, i decided to try out your [selectFormRestore] function, and it instantly quit CE... Tried the same script on your table, and works as expected. tried this also on them 2 other tables i just made, and no issues either..
=> bottomline; definitely something in the form it does not like
==> spent last half hr parcouring each object, verifying them 'anchors'; but - besides some minor changes i've done - no fix.

I'm putting my post 'OnHold', and will do some other T&Es (trial & error); and probably close it eventually if no progress

ps: your script has a minor omission: > if menuItems[i].Caption==mgform.Name then
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1516

PostPosted: Tue Oct 29, 2024 1:14 pm    Post subject: Re: continuing... and on hold... Reply with quote

This problem can be solved entirely with your tests.

You are responsible for the controls you added to the form and the manipulations you made in the lua code.

I tried the form you sent and it did not give me an error. (Ah, having an empty form may have eliminated the error. Maybe it was the conflicting controls you used that triggered the error.)

As far as I have followed you, you make very complex spreadsheets and somehow manage to make all the controls work properly. Smile

I hope these errors will not discourage you.

-----------------------------------------------------------
paul44 wrote:

ps: your script has a minor omission: > if menuItems[i].Caption==mgform.Name then


I would not recommend this.

This may work in your case, but normally it represents a variable structure.

Form name; UDF1
Form description (Caption): "My Game Trainer V3"
Comparing name and caption in this case can give misleading results.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Wed Oct 30, 2024 12:05 pm    Post subject: topic considered "solved"... Reply with quote

prenote: reason i took .Name is because i assume it compares iwth a string, while mgform is a formobject ?! (i'm not a "regular" oop programmer, so..)
=> it would then execute the print; and kill my CE in the process Rolling Eyes
==> just double-check: you pass on a string as param, and i think i've changed that to actual formobject itself ?! (no matter, minor detail)

That said:
1. uninstalled CE 7.5 completely, ran ccleaner to clear registry; then reinstalled CE again. create basic form, and... same thing...
2. did other stuff, incl disabling AV, excluding CE ànd CE folder; and some...
3. got an epiphany, and figured: "why not use AylinCE's base table, since this one is working for me ?"
=> guess what ?
a. added 3 panels: head, mid & foot. tried & saved it; quit/reload table and still working... (these 3 panels are anchored with their "neighbor_panels" btw)
b. added (sub) panels to header and mid; plus some labels and edit_boxes
(doing the "normal" stuff one would expect to do)
=> intermittent save/quit/reload/check and 3 pc reboots later, still no issues ! Iow something is definitely "off" on my end; and it seems to happen upon initial creation of the form (kinda) ?!

Bottomline:
1. save/quit/load/check regularly
2. for future forms, I'll use "your" table/form as base_form Smile

thx a mil for your time ànd patience; much appreciated.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1516

PostPosted: Wed Oct 30, 2024 3:18 pm    Post subject: Reply with quote

I just wondered;

Code:
  local formGUI = nil
  -- painting form...
         formGUI = mainGUI
         formGUI.Width = 1000
         formGUI.Height = 800
         formGUI.Show()


I mean, especially the kill and redefine lines;
Code:
 local formGUI = nil
  -- painting form...
         formGUI = mainGUI


If you are still doing something like this, it may be a problem.

In other words; If the form is already there and you want to assign it to another value and shorten it and use this value (local formGUI) over and over again, don't kill it (nil)!

Or if you are using the same style of coding in a panel or another object, control, don't kill it (nil)!

-----------------------------------------
I hope your research continues and thanks to you, we will continue to develop.

Happy coding.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites