




已阅读5页,还剩12页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
C # windows API、AE、easy、expansion、applicationprogramminginterface、catalog、cwapi、1大约有1500多个。窗口和窗口进程、声音和音频控制、位图和位图处理、INI和注册表操作、窗口效果和管理类、字体相关、错误处理、常规对话框、压缩和加密控制、文件和目录操作、使用剪贴板、与绘图和图形相关、与游戏手柄和键盘相关、堆操作、与图标光标相关WINDOWS上有三个非常重要的基本DLL文件:KERNEL32。DLL、USER32。DLL和GDI32。存在DLL。其中KERNEL32 .DLL-主要包含管理内存、进程和线程的函数。USER32。DLL-包含执行用户界面操作(例如,将用户鼠标单击操作传送到窗口)的函数.GDI32。DLL-完整名称为GRAPHICALDEVICEINTERFACE。例如,要显示程序窗口,请调用函数以绘制和显示文本。WindowsAPI中的功能分类、文件系统:文件的基本操作包括创建、打开、读写、关闭、删除文件、更改文件属性、目录操作、磁盘卷分区操作和文件加密文件系统镜像。内存管理:主要包括内存分配、共享、释放等,包括虚拟内存管理、分页机制、堆管理等。进程线程模块:包括进程主(exe)、模块、动态链接库、线程创建、遍历、同步等任务、进程和权限。设备I/O、驱动程序控制:加载和卸载驱动程序、控制驱动程序、与驱动程序通信等。调试和错误处理:包括如何开发调试器、处理程序执行错误、日志记录和widows可执行文件的结构。Windows系统消息:包括注册表的操作、打开、读取、初始设置、键值对的创建和删除、系统日志、系统版本、计算机名称等系统默认消息的获取和设置。进程间通信:包括如何使用共享文件进行进程间通信、使用消息进行进程间通信:使用管道、共享内存等方法。计时器和消息机制:消息机制是几乎所有windows应用程序处理消息的windows系统上的重要机制。Windows的消息机制依赖计时器,因此了解消息机制对于学习windows开发至关重要。、2、WindowsapiReference,请参阅未管理的函数using system . runtime . interop services,以获取DllImportAttribute声明包含空方法,即方法体为空。dll import( user32 . dll )public stic extnreturntypefunctionname(type arg 1,typearg2,);使用字段dllimport (user32.dll ,entrypoint= findwindow ,calling convention=calling convention on . stcall,DLL mport,示例属性,1,2,3,4,EntryPoint:表示要调用的DLL入口点的名称或序列号。如果方法的名称与API函数的名称不相同,则显示此参数规格。CallingConvention:表示将方法参数传递到非托管实现时使用的CallingConvention值。CallingConvention。StdCall:调用程序清理堆栈。调用托管代码中不受管理的函数的默认规则。CharSet:标识函数调用是unicode还是ANSI版本。ExactSpelling=false:指示编译器使用unicode还是ANSI、chartset、CharSet控制调用函数的名称版本,并指示方法封送String参数。此字段设置为CharSet值之一。如果将CharSet字段设置为unicode,则在传递到非托管实现之前,所有字符串参数都将转换为unicode字符。这会导致在DLLEntryPoint名称中附加字母“w”。如果此字段设置为ANSI,则字符串将转换为Ansi字符串,并且DLLEntryPoint的名称中会附加字符“a”。大多数Win32API使用这些附加的“w”或“a”规则。此转换与CharSet设置为Auto时的平台相关(WindowsNT上为unicode,Windows98上为Ansi)。CharSet的默认值为Ansi。CharSet字段还用于确定要从指定DLL获取的函数版本。CharSet .Ansi和CharSet。Unicode的名称匹配规则非常不同。对于Ansi,如果EntryPoint设置为“MyMethod”,则返回“MyMethod”。如果DLL中没有“MyMethod”,但有“MyMethodA”,则返回“MyMethodA”。unicode则相反。如果EntryPoint设置为“MyMethod”,则返回“MyMethodW”。如果“MyMethodW”不在DLL中,但存在“MyMethod”,则返回“MyMethod”。使用Auto时,匹配规则与平台相关(WindowsNT使用unicode,Windows98使用Ansi)。如果ExactSpelling设置为true,则仅当 MyMethod 位于DLL中时才返回 MyMethod 。,Windows数据类型、密钥代码值、数据类型、3、iswindowsappicode、/锁定系统/dl import( ),/锁定键盘鼠标输入但不锁定CTR alt delete/dl limport( user32 . dll )privsatestationxternboolblockinput( user32 . dll )privevoidskinbutton 29 _ click(object sender,even targs e) bool result=block input(true);if(result=false) throw new win 32 exception(marshal . getlasttwina 32 error();,根据/鼠标位置信息,鼠标下表单的句柄值dl import( user32 . dll )privsatestationxternintptrwindowfpoint(pointp);dll import( user32 . dll )priatestationxternintgetlastsname(intn tr hwnd,stringbuildperpclassname,intpprivevoidskinbutton 21 _ click(object sender,even targe) pointp;GetCursorPos(outp);inth wnd=window frompoint(p(p);IntPtrhandle=(int ptr)hwnd;string builder sb=new string builder(256);Getlastname (handle,sb,sb . capacity);MessageBox。Show(sb .ToString();,/鼠标坐标设置基于屏幕的dll import( user32 . dll )privsatestationxternboolsetcursorpos(intx,inty);privevoidskinbutton 3 _ click(object sender,eventarge) setcursorpos (10,10);,dll import( user32 . dll )priatestationxternintptrgetactive ewindow();/获取当前活动的表单dll import( user32 . dll )public stic extnetforegrounddwindow(intp tr hwnd);/将表单设置为获得焦点dll import( user32 . dll )public stic extnintrptrgetforegrounddwindow();/获取当前具有焦点的窗口句柄DllImport(user32.dll)。第一个值为虚拟关键点值,第二个参数为0,未设置扫描,第三个数字为0,将关键点状态选项keydown设置为0,将keyup设置为KEYEVENT_KEYUP。第四个参数通常为0 publicstic extnvoidkeybd _ event(byte bvh、byte bscan、intdwflags、intdwextrinfo)。privatevoidskinbutton 10 _ click(object sender,event args e) int ptr revit=getactivewmindow();SetForegroundWindow(Revit);Keybd_event(0 x1B,0,0,0);Keybd_event(0 x1B,0,2,0);Keybd_event(0 x1B,0,0,0);Keybd_event(0 x1B,0,2,0);dll import( user32 . dll )priatestationxternintptrgetdesktopwindow();/获取桌面句柄,dll import( user32 . dll )public stic extceternintptrfindwindow(string class name,stringwindownamw)dll import( user32 . dll )public stic extnintgetwindowtext(inth wnd,stringbuildperptext,int ncount)dll import( user32 . dll )public stic exeternintensumwindows(callback call,intl param);publicdelegateboolcallback(inth wnd,intl param);dll import( user32 . dll )public stic extnernboolenumchildwindows(intp tr window,enumindowproccallback,)publicdelegateboolenumwindowsproc(intp tr hwnd,intp tr parameter);dll import( user32 . dll )public stic extnern intsendmessage(intp tr hwnd、intmsg、intptr wparam、intl paramdll import( user32 . dll )public stic textern intptrfindwindows(intptrhwndedarent,intptrhwnddchildafter,),class propertybutton dl import( user32 . dll )public stic extceternintptrfindwindow(string class name,)dll import( user32 . dll )public stic extnintgetwindowtext(inth wnd,stringbuildperptext,int ncount)dll import( user32 . dll )public stic exeternintensumwindows(callback call,intl param);publicdelegateboolcallback(inth wnd,intl param);dll import( user32 . dll )public stic extnernboolenumchildwindows(intp tr window,enumindowproccallback,)publicdelegateboolenumwindowsproc(intp tr hwnd,intp tr parameter);dll import( user32 . dll )public stic extnern intsendmessage(intp tr hwnd、intmsg、intptr w
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 合同能源管理中介合同
- 智能交通信号控制系统合同
- 电影版权侵权赔偿合同
- 装修抵房租合同
- 机电工程服务合同
- 成渝云签合同协议书
- 承包石场合同协议书
- 河堤承包合同
- 开口合同付款协议书
- 项目可行性评估报告服务合同(2025年版)
- 2024-2030年中国邮轮行业市场发展状况及发展前景与趋势研究报告
- 文言文二则 囊萤夜读 公开课一等奖创新教学设计+说课稿+(共25张)
- 2023年山东烟台中考满分作文《这一路风光真好》
- 第18课 科技文化成就 新授课课件-2024-2025学年统编版八年级历史下册
- 孵化器与产业园区协同发展
- 小学综合实践活动《来之不易的粮食》课件
- 毕业设计中期报告
- 呼和浩特市消防救援支队招聘政府专职消防员笔试真题2022
- 施工方案防火门卷帘门
- 畜牧兽医考试题库
- (高清版)JTG D81-2017 公路交通安全设施设计规范
评论
0/150
提交评论