文章分类 - API
摘要:class Win32 { [DllImport("user32.dll", EntryPoint = "SetWindowPos")] public static extern bool SetWindowPos( int hWnd, // window handle int hWndInsertAfter, // placement-order handle int X, // horiz...
阅读全文
摘要:using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Drawing;using System.Threading;namespace comboBoxApp...{ /*...
阅读全文
摘要:using System;using System.Collections.Generic;using System.Text;using System.Runtime.InteropServices;namespace MeshworkLinkMode{ class Program { static void Main(string[] args) { Console.WriteLine("使用...
阅读全文
摘要:由于以前做一个小程序,想把窗口置顶,其实这个技术已经不是难题了,以前在VB中也是借助于API函数。但在C#中没想用API函数,至今没找到好办法,最后还得借助于API函数。片断代如下: [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern int SetWindowPos(IntPtr hWnd, int hW...
阅读全文
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;usingSystem.Data;usingSystem.ServiceProcess;namespaceAdminZJC.DataBaseControl{///<summary>///数据库操...
阅读全文
摘要:主要是通过调用Windows API中的一些方法,找到目标窗口和进程之后把保存在数据库中的用户名密码自动填入输入框中,并登录。设计步骤:一、调用Windows API。 C#下调用Windows API方法如下: 1、引入命名空间:using System.Runtime.InteropServices; 2、引用需要使用的方法,格式:[DllImport("DLL文件")]方法的声明; [Dll...
阅读全文
摘要:public class User32API { private static Hashtable processWnd = null; public delegate bool WNDENUMPROC(IntPtr hwnd, uint lParam); static User32API() { if (processWnd == null) { processWnd = new Hashtab...
阅读全文
摘要:由于C#目前我还没有找到发送消息的类成员函数,所以只能采用通过调用WIN 32 API 的 SendMessage() 函数实现。由于 SendMessage的参数中需要得到窗体的句柄(handler) ,所以又要调用另一个API FindWindow(), 两者配合使用,达到在不同窗体之间的消息发送和接收功能。 另外一个要点是,需要通过重写(Override) 窗体的 DefWndProc()...
阅读全文
摘要:经常可以看到这样的程序,点了关闭按扭后程序并没有关闭,而是最小化到了系统拖盘处,就像网易泡泡,MSN之类的程序。实现这个其实很简单,捕捉窗体关闭时的消息就可以了。代码如下:protected override void WndProc(ref Message m){const int WM_SYSCOMMAND = 0x0112;const int SC_CLOSE = 0xF060;if (m....
阅读全文

浙公网安备 33010602011771号