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 


messageDialog in FormShow (Always In Foreground).

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
FIRESKY
Cheater
Reputation: 0

Joined: 01 Mar 2017
Posts: 34

PostPosted: Mon Apr 29, 2024 8:04 am    Post subject: messageDialog in FormShow (Always In Foreground). Reply with quote

I thought is it possible that a Dialogmessage launched automatically and inserted on "function FormShow(sender)" is always seen in the foreground on windows?
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 34

Joined: 16 Feb 2017
Posts: 1418

PostPosted: Mon Apr 29, 2024 11:04 am    Post subject: Reply with quote

Check this out.

https://forum.cheatengine.org/viewtopic.php?p=5788926

Or explain a little more what you want with an example.
Wink

_________________
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
FIRESKY
Cheater
Reputation: 0

Joined: 01 Mar 2017
Posts: 34

PostPosted: Tue Apr 30, 2024 4:15 am    Post subject: Reply with quote

Hey AylinCE Thanks as usual for the reply,

To explain the problem in more detail,
I noticed that if I write a simple Dialogmessage, exemple:



if messageDialog([[
HELLO WORLD!

BLA BLA]],mtConfirmation, mbYes, mbNo) ==mrNo then
closeCE()
end
end



And I make this appear as a message before the CETRAINER appears,
then connecting it to the SHOWFORM, which is the first thing that will appear when launching a CETRAINER,

for some strange reason this won't appear in the foreground for any reason.

My goal would be that, even if I am browsing or watching a video, it always appears in the foreground.


I also think that it is possible that this happens due to a BUG in the cheat engine [7.4],

I currently use version 7.4 because the new versions have a serious BUG with the CETRAINERS that do not allow them to be opened after a certain number of times, about 10, a unless the "Reset Windows Position" checkbox from the CE setting is disabled, and honestly I don't like that every time I launch CE it starts again from a formatting of 0.

But this is another different problem of the new CE like the latest version which probably only
Quote:
@DARKBYTE
can know,
but even having tried to inform he of this BUG also with any VIDEO, doesn't seem like the problem has been solved.


But returning to the minor problem, that of the message not appearing in the foreground,
I'm not sure if this is a CE 7.4 bug or a general problem that messages like this don't appear in the foreground.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 34

Joined: 16 Feb 2017
Posts: 1418

PostPosted: Tue Apr 30, 2024 6:35 am    Post subject: Reply with quote

These are also ideas;

Code:

UDF1.Hide() -- or your trainer name ..

function startMsg()
if f1 then f1.Destroy() f1=nil end
 if messageDialog([[
  HELLO WORLD!

  BLA BLA]],mtConfirmation, mbYes, mbNo) == mrNo then
  closeCE()
 else
 -- UDF1.Show()
  -- start form gui and all controls ..
  f1=createForm()
  b1=createButton(f1) b1.Caption="Click me"
  b1.OnClick=startMsg
 end
end

startMsg()



Bringing the window forward;

Code:
local ctpid = 0
if ctpid==0 then ctpid = getForegroundProcess() end

if tmr22 then tmr22.Destroy() tmr22=nil end
tmr22=createTimer()
tmr22.Interval=5000 -- Some time was devoted to leaving the window in the background while testing.
tmr22.Enabled=false

function startMsg()
if f1 then f1.Destroy() f1=nil end
 if messageDialog([[
  HELLO WORLD!

  BLA BLA]],mtConfirmation, mbYes, mbNo) == mrNo then
  closeCE()
 else
  -- start form gui and all controls ..
  f1=createForm()
  b1=createButton(f1) b1.Caption="Click me"
  b1.OnClick=startMsg
 end
end

function foregroundW1()
tmr22.Enabled=false
--print(ctpid)
 sl=createStringList()
 sltext=getWindowlist(sl)
  for i=0, sl.count -1 do
    pd = tonumber((sl[i]):sub(1,8),16)
    name = (sl[i]):sub(10,80)
    if tonumber(pd)==tonumber(ctpid) then
      --print(name,pd,ctpid)
      hwnd = findWindow(nil, name)
      executeCodeLocal('SetForegroundWindow',hwnd)
      return startMsg()
    end
  end
end

tmr22.OnTimer=function()
foregroundW1()
tmr22.Enabled=false
end

tmr22.Enabled=true

_________________
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
FIRESKY
Cheater
Reputation: 0

Joined: 01 Mar 2017
Posts: 34

PostPosted: Tue Apr 30, 2024 7:43 am    Post subject: Reply with quote

This is certainly a great idea
with this method the CETRAINER opens and only AFTER then the message appears and it goes to the foreground perfectly.

But what if you wanted to do it the other way around?
I'll explain
First the message appears and only after clicking yes does the CETRAINER to appear, or NO to close all.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 34

Joined: 16 Feb 2017
Posts: 1418

PostPosted: Tue Apr 30, 2024 8:57 am    Post subject: Reply with quote

Added automatic shutdown if no selection is made.

Code:
function startMsg()
if f1 then f1.Destroy() f1=nil end
 local ansver = messageDialog([[
  HELLO WORLD!

  BLA BLA]],mtConfirmation, mbYes, mbNo)
  if ansver==mrNo then
    closeCE()
  elseif ansver==mrYes then
    -- Trainer.Show() -- your trainer gui
    -- start form gui and all controls .. (test gui)
    f1=createForm()
    b1=createButton(f1) b1.Caption="Click me"
    b1.OnClick=startMsg
  else -- click "X" close message box
    closeCE()
    return cafree
  end
end

startMsg()

_________________
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
FIRESKY
Cheater
Reputation: 0

Joined: 01 Mar 2017
Posts: 34

PostPosted: Tue Apr 30, 2024 1:54 pm    Post subject: Reply with quote

Thanks great idea!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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