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 


How to change window size?

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

Joined: 12 Jun 2016
Posts: 96

PostPosted: Fri Nov 01, 2019 12:08 am    Post subject: How to change window size? Reply with quote

Some old game can't change window size and it's 640x480 resolution.

I heard some windows API something something can change window size.

So how can I do it with Cheat Engine?
Back to top
View user's profile Send private message
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Fri Jul 03, 2020 10:57 pm    Post subject: Reply with quote

OK,about half year,and I have done this with C++.

Don't know how to write lua to do this.

But I will leave some tips on how to do this in C++,maybe someone may need it.

The question is some old game run on window mode and can't change to a specific window size.

Windows resize window WIN32 API is called MoveWindow

Don't be confused by it's name,it can do both move and resize window job.

So,the flow for C++ is

1.Enum process and find target like notepad.exe and open it with OpenProcess WIN32 API

2.MoveWindow API need HWND as it's first parameter.
There may be many ways to do this.But I only know 2

2.1 Use FindWindow WIN32 API to find HWND by window title name.
And there is a problem if the game's title is written with string you don't know or some symbol you can't type it out like chinese,japanese characters.

Then you can't get what you want.


2.2 Use EnumWindows WIN32 API to get HWND by ProcessID which can be captured before OpenProcess

Finally you can call something like
x=0;
y=0;
width=1440;
height=900;
::MoveWindow(hwnd, x,y,width,height, true);
to resize the target window to specifiy size.

Although some game may drop fps.
At least you got a large size window and for some none fps matter game,
It's still useful
Back to top
View user's profile Send private message
Ultraplayer
Newbie cheater
Reputation: 0

Joined: 06 Apr 2019
Posts: 20

PostPosted: Tue Jul 07, 2020 6:14 pm    Post subject: Reply with quote

This is my version

Code:
// This script changes nontepad window size
{$lua}

[ENABLE]
function getAppHangle(sClassName)
  return findWindow(sClassName)
end;

local H = getAppHangle("notepad")
-- if not found
if H == 0 then
  MessageDialog('Please run Notepad', mtError, mbOk, 0)
  return
end
-- if found
local HWND_TOP = 0
local SWP_NOSENDCHANGING = 1024
executeCodeLocalEx("user32.SetWindowPos", H, HWND_TOP, 24, 24, 800, 600, SWP_NOSENDCHANGING)
[DISABLE]
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Wed Jul 08, 2020 12:26 am    Post subject: Reply with quote

Note:

Not all Windows app can resizing or moving to specific post.
Almost example on internet sites use notepad app. As Windows handle.
You need try with others app. Usually, browser windows can't resize or move by using WIN32 API setWindowPos or MoveWindow.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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 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