Delphi-PRAXiS
Seite 4 von 4   « Erste     234   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Software-Projekte der Mitglieder (https://www.delphipraxis.net/26-software-projekte-der-mitglieder/)
-   -   Dimmed Sample (https://www.delphipraxis.net/167397-dimmed-sample.html)

EWeiss 31. Mär 2012 11:13

AW: Dimmed Sample
 
Managed Wrapper_DLL Dimmed_API Class für Dimmed C#
Code:
namespace Dimmed_Api
{
    using System;
    using System.Runtime.InteropServices;
    using System.Security;


    [SuppressUnmanagedCodeSecurity]
    public sealed class Fade
    {

        [DllImport("user32.dll", SetLastError = false)]
        public static extern IntPtr GetDesktopWindow();

        //Dimmed_GetVersion
        public static string Dimmed_GetVersion()
        {
            IntPtr ptr = Dimmed_GetVersionPtr();
            if (ptr != IntPtr.Zero)
            {
                return Marshal.PtrToStringAnsi(ptr);
            }
            return null;
        }       
        [DllImport("dimmed.dll", EntryPoint = "Dimmed_GetVersion", CharSet = CharSet.Auto)]
        private static extern IntPtr Dimmed_GetVersionPtr();      

        //FadeDestroy
        [DllImport("dimmed.dll", EntryPoint = "FadeDestroy", CharSet = CharSet.Auto)]
        public static extern void FadeDestroy();


        //FadeCreate
        [return: MarshalAs(UnmanagedType.Bool)]
        [DllImport("dimmed.dll", EntryPoint = "FadeCreate", CharSet = CharSet.Auto)]
        public static extern bool FadeCreate(IntPtr handle, int FadeTime, int clLight, int clDark);

    }
}
Dimmed Sample VB_NET
Code:
Option Explicit On

Imports Dimmed_Api

Public Class Form1

    Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed

        Fade.FadeDestroy()
    End Sub

    Private Sub cmdDimmMe_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDimmMe.Click

        Fade.FadeCreate(Me.Handle, 3500, RGB(255, 255, 255), RGB(0, 0, 0))
    End Sub

    Private Sub cmdDimmDesktop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDimmDesktop.Click

        Fade.FadeCreate(Fade.GetDesktopWindow, 3500, RGB(255, 255, 255), RGB(0, 0, 0))
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Me.Text = "Dimmed Sample " & "DLLVers. " & Fade.Dimmed_GetVersion
    End Sub

End Class
Dimmed Sample C#
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Dimmed_Api;

namespace WindowsFormsApplication1
{

    public partial class Form1 : Form
    {
       
        public Form1()
        {
            InitializeComponent();
        }

        private void cmdDimmMe_Click(object sender, EventArgs e)
        {
            Fade.FadeCreate(Handle, 3500, ColorTranslator.ToWin32(Color.FromArgb(255, 255, 255)),
                ColorTranslator.ToWin32(Color.FromArgb(0, 0, 0)));
        }

        private void cmdDimmDesktop_Click(object sender, EventArgs e)
        {
            Fade.FadeCreate(Fade.GetDesktopWindow(), 1500, ColorTranslator.ToWin32(Color.FromArgb(255, 255, 255)),
                ColorTranslator.ToWin32(Color.FromArgb(0, 0, 0)));
        }

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            Fade.FadeDestroy();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Text = "Dimmed Sample " + "DLLVers. " + Fade.Dimmed_GetVersion();
        }
    }
}

gruss

EWeiss 31. Mär 2012 22:04

AW: Dimmed Sample
 
Neue Version.. Finale und fertig!
Siehe History

gruss

himitsu 31. Mär 2012 22:39

AW: Dimmed Sample
 
Wobei Windows auch schon sowas Ähnliches integriert hat.
http://www.delphipraxis.net/1159461-post2.html (siehe Link)

EWeiss 31. Mär 2012 22:54

AW: Dimmed Sample
 
Zitat:

Zitat von himitsu (Beitrag 1159606)
Wobei Windows auch schon sowas Ähnliches integriert hat.
http://www.delphipraxis.net/1159461-post2.html (siehe Link)

Ja aber hier geht es um den Ghost Effekt wenn eine Anwendung hängt. :)
Ähnliches .. jup.

Ich möchte hingegen so wie in Winamp meine Farbschemas in meinem MediaPlayer verändern können
und das geht über eine DLL(Delphi) um einiges Fixer als in VB.

PS:
Dafür wird diese (privat) noch etwas verändert.
Sollte es jemand brauchen OK.. ansonsten auch egal ;)
Habe es für jemanden hier im Forum gemacht der danach gefragt hat.

Gruss


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:29 Uhr.
Seite 4 von 4   « Erste     234   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz