Beiträge von Desire

    It's not work.


    API.cs
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Diagnostics;

    API.cs
    namespace SAMP_API
    {
    public class API
    {

    API.cs
    [DllImport("API.dll", EntryPoint = "API_IsChatOpen", CallingConvention = CallingConvention.Cdecl)]
    public static extern Boolean IsChatOpen();

    API.cs
    [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
    public static extern IntPtr GetForegroundWindow();

    API.cs
    public static string ToHexValueRGB(Color color)
    {
    return "" + color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2");
    }
    public static string ToHexValueARGB(Color color)
    {
    return "" + color.A.ToString("X2") + color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2");
    }
    public static Boolean IsGTARunning(String gtaprocname)
    {
    Process[] list = Process.GetProcessesByName(gtaprocname);
    foreach (Process p in list)
    {
    if (p.MainWindowHandle == GetForegroundWindow())
    return true;
    }
    return false;
    }
    }
    }




    Form1.cs
    using SAMP_API;

    Form1.cs
    namespace UniBinder
    {
    public partial class Form1 : Form
    {
    public void event()
    {
    if ( SAMP_API.API.IsChatOpen() )
    MessageBox.Show("Open");
    }
    }
    }



    And when event() started - my program has been crashed ;(