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 


Disable/Hijack Ctrl+C Dissassembler

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Game Hacking Dojo
Master Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 250

PostPosted: Fri Oct 11, 2024 8:33 pm    Post subject: Disable/Hijack Ctrl+C Dissassembler Reply with quote

Is there a way to change the behaviour of the OnKeyPress() (I believe) when pressing Ctrl+C on a selected address?

I want to copy the address and not get the window (I find it less useful than just instantly copying the address)

One way might be by using registerFormAddNotification() but is there another way?
Back to top
View user's profile Send private message Visit poster's website
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1528

PostPosted: Sat Oct 12, 2024 11:59 am    Post subject: Reply with quote

Here's an idea...
I assume you don't want this to work everywhere in Windows.

Define the specific window you want it to work in.

Code:
if wtmr1 then wtmr1.Destroy() wtmr1=nil end

wtmr1=createTimer(MainForm)
wtmr1.Interval=10

-----------------------------------
-- Define the window title in which the function will be active:
--HWND1 = executeCodeLocalEx("FindWindowA",0,"Memory Viewer")
fndWCpt = MainForm.Caption
--print(fndWCpt)
HWND2 = executeCodeLocalEx("FindWindowA",0,fndWCpt)
-----------------------------------

wtmr1.OnTimer=function()
gfw = getForegroundWindow()
--print("hwnd: "..HWND.." - "..gfw)
  if gfw==HWND2 then
    if isKeyPressed(VK_CONTROL) and isKeyPressed(VK_C) then
      sleep(200) -- Prevents the function from being triggered repeatedly
      print("true") -- your Ctrl+C func code..
    end
  end
end

wtmr1.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
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Sat Oct 12, 2024 1:37 pm    Post subject: Reply with quote

Here is an extension I made (sometime ago) to copy the address rather than hooking hotkeys etc... I found this to be the most effective way. You can alter the shortcuts for each menu within the Lua extension.

Just place it within the autorun folder within Cheat Engine's installation directory and restart Cheat Engine. The default shortcut is Ctrl, Shift + C.



extraCopy.lua
 Description:

Download
 Filename:  extraCopy.lua
 Filesize:  1.27 KB
 Downloaded:  2586 Time(s)

Back to top
View user's profile Send private message
Game Hacking Dojo
Master Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 250

PostPosted: Sat Oct 12, 2024 4:21 pm    Post subject: Reply with quote

Thank you for your help guys. I still didn't use AylinCE's but I'll give it a try.

Thank you LeFiXER I made my own version now because I can't accept the most common copy method to be 3 key shortcuts while something I don't use at all to be 2

Code:
local function copy_address(form)
   form.setPosition(getScreenHeight(), getScreenWidth())
   form.close()
   
   local clipboard_option = getMemoryViewForm().Copytoclipboard1
   for i = 0, clipboard_option.Count - 1 do
      if clipboard_option.Item[i].Name == 'miCopyAddressesOnly' then
         clipboard_option.Item[i].DoClick()
      end
   end

   local address = string.gsub(readFromClipboard(), "%s+$", "")
   writeToClipboard(address)
end

if copy_address_id then
  unregisterFormAddNotification(copy_address_id)
  copy_address_id = nil
end

copy_address_id = registerFormAddNotification(function(form)
  if form.ClassName ~= "TfrmSavedisassembly" and form.Caption ~= "Copy disassembled output" then return end
  createTimer(1, copy_address, form)
end)


Again thank you, lads. And please check out my "Suprior Go to Address" extension if you're interested in having a better go-to-address prompt:
https://forum.cheatengine.org/viewtopic.php?t=622886
Back to top
View user's profile Send private message Visit poster's website
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