Results 1 to 8 of 8

Thread: [RESOLVED] How do i "disable desktop composition" for my application automatically?

  1. #1

    Thread Starter
    Fanatic Member alexandros's Avatar
    Join Date
    Oct 2002
    Location
    Milky Way Galaxy
    Posts
    694

    Resolved [RESOLVED] How do i "disable desktop composition" for my application automatically?

    Hello , do you know how can i "disable desktop composition" for my application automatically?
    Do i have to attach a specific manifest file ? Or something else ?

    Thank you !

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: How do i "disable desktop composition" for my application automatically?

    What you mean by that?

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    Fanatic Member alexandros's Avatar
    Join Date
    Oct 2002
    Location
    Milky Way Galaxy
    Posts
    694

    Re: How do i "disable desktop composition" for my application automatically?

    I mean when you right click on a executable file in windows and select properties
    there is a tab in the screen that opens that is named "Compatibility".
    There you can check "Disable Desktop Composition".
    I want that my application does that automatically without the need for the user to do that by hand.

  4. #4
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: How do i "disable desktop composition" for my application automatically?

    I think it's not possible to do that with a specific code, because there are many OS also in different versions. Anyway, thanks for explaining it. But don't worry, wait for some time, so that others may help you. Best wishes...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  5. #5
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: How do i "disable desktop composition" for my application automatically?

    I suspect that the only way to do this is to have your installer merge a Compatibility Database during installation. I'm not really saying this is the only way, just the way that I have seen recommended.

    I believe you use the Application Compatibility Toolkit (5.0) to create the new SDB. Then you script a custom action in your MSI package that looks something like (Microsoft example):
    Code:
    'InstallSDB.vbs
    
    Function Install
    Dim WshShell
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run "sdbinst.exe -q " & CHR(34) & "%ProgramFiles%\MyOrganizationSDB\MyOrg.sdb" & CHR(34), 0, true
    WshShell.Run "cmd.exe /c " & CHR(34) & "del " & CHR(34) & "%ProgramFiles%\MyOrganizationSDB\MyOrg.sdb" & CHR(34) & CHR(34), 0
    WshShell.Run "reg.exe delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{guidFromMyOrgsSdb}.sdb /f", 0
    End Function
    
    Function UnInstall
    Dim WshShell
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run "sdbinst.exe -q -u -g {guidFromMyOrgsSdb}", 0
    End Function
    Being sure to specify "no impersonate" when you define the MSI VBScript custom action.

    If you use a legacy installer such as the PDW you'd need to customize Setup1 to perform these actions. Other legacy packaging and deployment tools offer ways to perform custom actions as well.

    Any way you do it, the script above must run elevated. Note that the entry for your program probably includes the checksum of your EXE so you'd need to make a new one each time unless you exclude the checksum as part of the matching attributes Windows uses to apply compatibility.

    Caveat: I haven't done this myself, I just did some reasearch into it a year ago.

  6. #6
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: How do i "disable desktop composition" for my application automatically?

    Just to clarify:

    No, sadly there is nothing as easy as a manifest entry that will do this.

  7. #7

    Thread Starter
    Fanatic Member alexandros's Avatar
    Join Date
    Oct 2002
    Location
    Milky Way Galaxy
    Posts
    694

    Re: How do i "disable desktop composition" for my application automatically?

    I found it...

    Code:
    Les valeurs d'entrees sont
    Private Const DWM_EC_DISABLECOMPOSITION As Long = 0
    Private Const DWM_EC_ENABLECOMPOSITION As Long = 1
     
    'La declaration en VB6 semble etre:
    Private Declare Function DwmEnableComposition Lib "dwmapi" (uCompositionAction As Long) As Long
     
    'Pour un HRESULT, il faut tester le retour sur SUCCEEDED, comme suite;
    Private Function SUCCEEDED(hr As Long) As Boolean
        SUCCEEDED = (hr >= 0)
    End Function
    Private Function FAILED(hr As Long) As Boolean
        FAILED = (hr < 0)
    End Function
     
    Private Sub Form_Load()
        If SUCCEEDED(DwmEnableComposition(DWM_EC_DISABLECOMPOSITION)) Then
            MsgBox "Vista Aero est Desactive"
        Else
            MsgBox "Vista Aero n'a pas pu etre Desactive"
        End If
     
    End Sub
     
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        MsgBox Cancel
        MsgBox UnloadMode
        If SUCCEEDED(DwmEnableComposition(DWM_EC_ENABLECOMPOSITION)) Then
            MsgBox "Vista Aero est Active"
        Else
            MsgBox "Vista Aero n'a pas pu etre active"
        End If
     
    End Sub

  8. #8
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: [RESOLVED] How do i "disable desktop composition" for my application automatically?

    Nice find!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width