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 correctly call DwmExtendFrameIntoClientArea

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

Joined: 03 May 2020
Posts: 49

PostPosted: Thu May 07, 2020 11:31 pm    Post subject: How to correctly call DwmExtendFrameIntoClientArea Reply with quote

I tried this but it didn't work
Code:

MARGINS={
cxLeftWidth=-1,
cxRightWidth=-1,
cyTopHeight=-1,
cyBottomHeight=-1
}

executeCodeLocalEx('dwmapi.DwmExtendFrameIntoClientArea',UDF1.Handle,MARGINS)

Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu May 07, 2020 11:44 pm    Post subject: Reply with quote

Use a memory stream instead. Try this:
Code:

local margins = createMemoryStream();
margins.writeDword(-1);
margins.writeDword(-1);
margins.writeDword(-1);
margins.writeDword(-1);

executeCodeLocalEx('dwmapi.DwmExtendFrameIntoClientArea', UDF1.Handle, margins.Memory);

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
blankTM
Cheater
Reputation: 1

Joined: 03 May 2020
Posts: 49

PostPosted: Fri May 08, 2020 12:19 am    Post subject: no effect Reply with quote

atom0s wrote:
Use a memory stream instead. Try this:
Code:

local margins = createMemoryStream();
margins.writeDword(-1);
margins.writeDword(-1);
margins.writeDword(-1);
margins.writeDword(-1);

executeCodeLocalEx('dwmapi.DwmExtendFrameIntoClientArea', UDF1.Handle, margins.Memory);



no effect
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Fri May 08, 2020 6:27 am    Post subject: Reply with quote

Not work, because value that indicates whether Desktop Window Manager (DWM) composition is not checked and set to enabled.

Check for : DwmIsCompositionEnabled (on MSDN)

Here an work example:

Code:
f = createForm(true)
f.Caption = 'Extended Frame'

function DwmIsCompositionEnabled(en)
 return executeCodeLocalEx("dwmapi.DwmIsCompositionEnabled",en)
end

local margins = createMemoryStream();
margins.writeDword(25)
margins.writeDword(25)
margins.writeDword(25)
margins.writeDword(25)

ver = 6.1  -- This is windows 7 (check for other windows version first)
DwmIsCompositionEnabled(ver)
executeCodeLocalEx('dwmapi.DwmExtendFrameIntoClientArea', f.Handle, margins.Memory)

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
blankTM
Cheater
Reputation: 1

Joined: 03 May 2020
Posts: 49

PostPosted: Fri May 08, 2020 7:42 am    Post subject: Reply with quote

Corroder wrote:
Not work, because value that indicates whether Desktop Window Manager (DWM) composition is not checked and set to enabled.

Check for : DwmIsCompositionEnabled (on MSDN)

Here an work example:

Code:
f = createForm(true)
f.Caption = 'Extended Frame'

function DwmIsCompositionEnabled(en)
 return executeCodeLocalEx("dwmapi.DwmIsCompositionEnabled",en)
end

local margins = createMemoryStream();
margins.writeDword(25)
margins.writeDword(25)
margins.writeDword(25)
margins.writeDword(25)

ver = 6.1  -- This is windows 7 (check for other windows version first)
DwmIsCompositionEnabled(ver)
executeCodeLocalEx('dwmapi.DwmExtendFrameIntoClientArea', f.Handle, margins.Memory)



I tried using executeCodeEx but it lasted for a second



QQ图片20200508213642.png
 Description:
 Filesize:  130.87 KB
 Viewed:  3273 Time(s)

QQ图片20200508213642.png


Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Fri May 08, 2020 8:04 am    Post subject: Reply with quote

What windows version you use?.

Windows 7 version value = 6.1
Windows 8 version value = 6.2
Windows 10 version value = 10,0

You need set this windows version correctly, also try change:

Code:
f = createForm()


to

Code:
f = createForm(true)


And this another version using dwmapi.DwmExtendFrameIntoClientArea:

Code:
function DwmIsCompositionEnabled(en)
 return executeCodeLocalEx("dwmapi.DwmIsCompositionEnabled",en)
end

function DwmExtendFrameIntoClientArea(hwnd, MARGINS)
 return executeCodeLocalEx("dwmapi.DwmExtendFrameIntoClientArea", hwnd, MARGINS)
end

UDF1.Caption = 'Entended Frame'

--function SetGlass(Form, Left, Top, Right, Right)
    local margins = createMemoryStream();
    margins.writeDword(25) --Left)
    margins.writeDword(50) --Right)
    margins.writeDword(25) --Top)
    margins.writeDword(25) --Bottom)
    Ver = 6.1  -- set this windows version correctly
    DwmIsCompositionEnabled(Ver)
    --DwmExtendFrameIntoClientArea(Form.Handle, margins.Memory)
    DwmExtendFrameIntoClientArea(UDF1.Handle, margins.Memory)
--end

UDF1.Show()
--SetGlass(UDF1, 25, 25, 25, 25)



Capture.JPG
 Description:
 Filesize:  86.34 KB
 Viewed:  3268 Time(s)

Capture.JPG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
blankTM
Cheater
Reputation: 1

Joined: 03 May 2020
Posts: 49

PostPosted: Fri May 08, 2020 8:28 am    Post subject: Reply with quote

Corroder wrote:
What windows version you use?.

Windows 7 version value = 6.1
Windows 8 version value = 6.2
Windows 10 version value = 10,0

You need set this windows version correctly, also try change:

Code:
f = createForm()


to

Code:
f = createForm(true)


And this another version using dwmapi.DwmExtendFrameIntoClientArea:

Code:
function DwmIsCompositionEnabled(en)
 return executeCodeLocalEx("dwmapi.DwmIsCompositionEnabled",en)
end

function DwmExtendFrameIntoClientArea(hwnd, MARGINS)
 return executeCodeLocalEx("dwmapi.DwmExtendFrameIntoClientArea", hwnd, MARGINS)
end

UDF1.Caption = 'Entended Frame'

--function SetGlass(Form, Left, Top, Right, Right)
    local margins = createMemoryStream();
    margins.writeDword(25) --Left)
    margins.writeDword(50) --Right)
    margins.writeDword(25) --Top)
    margins.writeDword(25) --Bottom)
    Ver = 6.1  -- set this windows version correctly
    DwmIsCompositionEnabled(Ver)
    --DwmExtendFrameIntoClientArea(Form.Handle, margins.Memory)
    DwmExtendFrameIntoClientArea(UDF1.Handle, margins.Memory)
--end

UDF1.Show()
--SetGlass(UDF1, 25, 25, 25, 25)





I don't quite understand why this problem occurs



QQ图片20200508222527.png
 Description:
 Filesize:  149.36 KB
 Viewed:  3263 Time(s)

QQ图片20200508222527.png


Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Fri May 08, 2020 2:11 pm    Post subject: Reply with quote

Note from: https://docs.microsoft.com/en-us/windows/win32/dwm/composition-ovw?redirectedfrom=MSDN

As of Windows 8, the information in this section is no longer valid. DWM can no longer be programmatically disabled, nor is it disabled when an application attempts to draw to the primary display surface. The following information applies to only Windows 7 and earlier systems.

In Windows 8, Desktop Window Manager (DWM) is always ON and cannot be disabled by end users and apps.

In Windows 8, DWM desktop composition is a core operating system component and cannot be disabled. With a few exceptions, desktop composition is always on; it’s started before the user logon and remains active for the duration of a session.

All of the options for disabling desktop composition that exist in Window 7 are removed

Apps cannot use DwmEnableComposition to disable desktop composition. In order to maintain backward compatibility, a call to this API will return success; however, desktop composition is not disabled.

So, try run code without or remove this line (if use Windows 8 or later):

Code:
DwmIsCompositionEnabled(Ver)

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
blankTM
Cheater
Reputation: 1

Joined: 03 May 2020
Posts: 49

PostPosted: Fri May 08, 2020 4:43 pm    Post subject: Reply with quote

Corroder wrote:


As of Windows 8, the information in this section is no longer valid. DWM can no longer be programmatically disabled, nor is it disabled when an application attempts to draw to the primary display surface. The following information applies to only Windows 7 and earlier systems.

In Windows 8, Desktop Window Manager (DWM) is always ON and cannot be disabled by end users and apps.

In Windows 8, DWM desktop composition is a core operating system component and cannot be disabled. With a few exceptions, desktop composition is always on; it’s started before the user logon and remains active for the duration of a session.

All of the options for disabling desktop composition that exist in Window 7 are removed

Apps cannot use DwmEnableComposition to disable desktop composition. In order to maintain backward compatibility, a call to this API will return success; however, desktop composition is not disabled.

So, try run code without or remove this line (if use Windows 8 or later):

Code:
DwmIsCompositionEnabled(Ver)


Thank you! I try to use:
package.loadlib ("dwmapi.dll", '')
very successful!



QQ图片20200509063953.png
 Description:
 Filesize:  142.71 KB
 Viewed:  3223 Time(s)

QQ图片20200509063953.png


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