实例介绍
【实例简介】整理的C#调用winapi的静态方法..无错版
附件中有一个枚举类不存在,请自行在核心代码中查找
【实例截图】【核心代码】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 | #region CPU public struct CPUInformation { public uint core; public string type; public uint level2; public uint masterfrequency; } #endregion #region Memory public struct MemoryInformation { public double AvailablePageFile; public double AvailablePhysicalMemory; public double AvailableVirtualMemory; public uint SizeofStructure; public double MemoryInUse; public double TotalPageSize; public double TotalPhysicalMemory; public double TotalVirtualMemory; } #endregion #region RECT [Serializable, StructLayout(LayoutKind.Sequential)] public struct RECT { public int left; public int top; public int right; public int bottom; } #endregion #region SYSTEMTIME public struct SYSTEMTIME { public ushort wYear; public ushort wMonth; public ushort wDayOfWeek; public ushort wDay; public ushort wHour; public ushort wMinute; public ushort wSecond; public ushort wMilliseconds; } #endregion #region WINDOWPLACEMENT [StructLayout(LayoutKind.Sequential)] public struct WINDOWPLACEMENT { public int length; public int flags; public int showCmd; public Point ptMinPosition; public Point ptMaxPosition; public RECT rcNormalPosition; //public int ptMinPosition_x; //public int ptMinPosition_y; //public int ptMaxPosition_x; //public int ptMaxPosition_y; //public int rcNormalPosition_left; //public int rcNormalPosition_top; //public int rcNormalPosition_right; //public int rcNormalPosition_bottom; } #endregion #region OFSTRUCT [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct OFSTRUCT { public byte cBytes; public byte fFixedDisk; public UInt16 nErrCode; public UInt16 Reserved1; public UInt16 Reserved2; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)] public string szPathName; } #endregion #region _SHFILEOPSTRUCT [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public class _SHFILEOPSTRUCT { public IntPtr hwnd; public UInt32 wFunc; public string pFrom; public string pTo; public UInt16 fFlags; public Int32 fAnyOperationsAborted; public IntPtr hNameMappings; public string lpszProgressTitle; } #endregion #region COPYDATASTRUCT public struct COPYDATASTRUCT { public IntPtr dwData; public int cbData; [MarshalAs(UnmanagedType.LPStr)] public string lpData; } #endregion #region WindowInfo public struct WindowInfo { public IntPtr hWnd; public string szWindowName; public string szClassName; } public struct WINDOWINFO { public int cbSize; public RECT rcWindow; public RECT rcClient; public int dwStyle; public int dwExStyle; public int dwWindowStatus; public uint cxWindowBorders; public uint cyWindowBorders; public int atomWindowType; public int wCreatorVersion; public IntPtr hWnd; public string szWindowName; public string szClassName; public string szExePath; } #endregion #region SYSTEM_INFO [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } #endregion #region MEMORYSTATUS //struct 收集内存情况 [StructLayout(LayoutKind.Sequential)] public struct MEMORYSTATUS { public uint dwLength; public uint dwMemoryLoad; public uint dwTotalPhys; public uint dwAvailPhys; public uint dwTotalPageFile; public uint dwAvailPageFile; public uint dwTotalVirtual; public uint dwAvailVirtual; } #endregion #region TokPriv1Luid [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct TokPriv1Luid { public int Count; public long Luid; public int Attr; } #endregion #region DEVMODE [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct DEVMODE { //[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] //public string dmDeviceName; //public short dmSpecVersion; //public short dmDriverVersion; //public short dmSize; //public short dmDriverExtra; //public int dmFields; //public int dmPositionX; //public int dmPositionY; //public DMDO dmDisplayOrientation; //public int dmDisplayFixedOutput; //public short dmColor; //public short dmDuplex; //public short dmYResolution; //public short dmTTOption; //public short dmCollate; //[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] //public string dmFormName; //public short dmLogPixels; //public int dmBitsPerPel; //public int dmPelsWidth; //public int dmPelsHeight; //public int dmDisplayFlags; //public int dmDisplayFrequency; //public int dmICMMethod; //public int dmICMIntent; //public int dmMediaType; //public int dmDitherType; //public int dmReserved1; //public int dmReserved2; //public int dmPanningWidth; //public int dmPanningHeight; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string dmDeviceName; public int dmSpecVersion; public int dmDriverVersion; public int dmSize; public int dmDriverExtra; public int dmFields; public short dmOrientation; public short dmPaperSize; public short dmPaperLength; public short dmPaperWidth; public short dmScale; public short dmCopies; public short dmDefaultSource; public short dmPrintQuality; public Point dmPosition; public int dmDisplayOrientation; public int dmDisplayFixedOutput; public short dmColor; public short dmDuplex; public short dmYResolution; public short dmTTOption; public short dmCollate; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string dmFormName; public int dmLogPixels; public int dmBitsPerPel; public int dmPelsWidth; public int dmPelsHeight; public int dmDisplayFlags; public int dmNup; public int dmDisplayFrequency; public int dmICMMethod; public int dmICMIntent; public int dmMediaType; public int dmDitherType; public int dmReserved1; public int dmReserved2; public int dmPanningWidth; public int dmPanningHeight; } #endregion #region COMBOBOXINFO public struct COMBOBOXINFO { public int cbSize; public RECT rcItem; public RECT rcButton; public int stateButton; public IntPtr hwndCombo; public IntPtr hwndItem; public IntPtr hwndList; } #endregion #region SHELLEXECUTEINFO [StructLayout(LayoutKind.Sequential)] public struct SHELLEXECUTEINFO //用于ShellExecuteEx { public int cbSize; public int fMask; public IntPtr hwnd; public string lpVerb; public string lpFile; public string lpParameters; public string lpDirectory; public int nShow; public IntPtr hInstApp; public IntPtr lpIDList; public string lpClass; public IntPtr hkeyClass; public int dwHotKey; public IntPtr hIcon; public IntPtr hProcess; } #endregion #region WIN32_FIND_DATA [Serializable, StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto), BestFitMapping( false )] public struct WIN32_FIND_DATA { public int dwFileAttributes; public int ftCreationTime_dwLowDateTime; public int ftCreationTime_dwHighDateTime; public int ftLastAccessTime_dwLowDateTime; public int ftLastAccessTime_dwHighDateTime; public int ftLastWriteTime_dwLowDateTime; public int ftLastWriteTime_dwHighDateTime; public int nFileSizeHigh; public int nFileSizeLow; public int dwReserved0; public int dwReserved1; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string cFileName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] public string cAlternateFileName; } #endregion #region OSVERSIONINFO [StructLayout(LayoutKind.Sequential)] public struct OSVERSIONINFO { public int dwOSVersionInfoSize; public int dwMajorVersion; public int dwMinorVersion; public int dwBuildNumber; public int dwPlatformId; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string szCSDVersion; } #endregion #region OSVERSIONINFOEX [StructLayout(LayoutKind.Sequential)] public struct OSVERSIONINFOEX { public int dwOSVersionInfoSize; public int dwMajorVersion; public int dwMinorVersion; public int dwBuildNumber; public int dwPlatformId; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string szCSDVersion; public Int16 wServicePackMajor; public Int16 wServicePackMinor; public Int16 wSuiteMask; public Byte wProductType; public Byte wReserved; } #endregion #region OPENFILENAME [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public class OPENFILENAME { public int structSize = 0; public IntPtr dlgOwner = IntPtr.Zero; public IntPtr instance = IntPtr.Zero; public String filter = null ; public String customFilter = null ; public int maxCustFilter = 0; public int filterIndex = 0; public String file = null ; public int maxFile = 0; public String fileTitle = null ; public int maxFileTitle = 0; public String initialDir = null ; public String title = null ; public int flags = 0; public short fileOffset = 0; public short fileExtension = 0; public String defExt = null ; public IntPtr custData = IntPtr.Zero; public IntPtr hook = IntPtr.Zero; public String templateName = null ; public IntPtr reservedPtr = IntPtr.Zero; public int reservedInt = 0; public int flagsEx = 0; } #endregion #region STARTUPINFO [StructLayout(LayoutKind.Sequential)] public struct STARTUPINFO { public int cb; public string lpReserved; public string lpDesktop; public string lpTitle; public int dwX; public int dwY; public int dwXSize; public int dwYSize; public int dwXCountChars; public int dwYCountChars; public int dwFillAttribute; public int dwFlags; public int wShowWindow; public int cbReserved2; public byte lpReserved2; public IntPtr hStdInput; public IntPtr htdOutput; public IntPtr hStdError; } #endregion #region _FILETIME public struct _FILETIME { public int dwLowDateTime; public int dwHighDateTime; } #endregion #region INTERNET_CACHE_ENTRY_INFO [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct INTERNET_CACHE_ENTRY_INFO { public int dwStructSize; public IntPtr lpszSourceUrlName; public IntPtr lpszLocalFileName; public int CacheEntryType; public int dwUseCount; public int dwHitRate; public int dwSizeLow; public int dwSizeHigh; public _FILETIME LastModifiedTime; public _FILETIME ExpireTime; public _FILETIME LastAccessTime; public _FILETIME LastSyncTime; public IntPtr lpHeaderInfo; public int dwHeaderInfoSize; public IntPtr lpszFileExtension; public int dwExemptDelta; } #endregion #region PROCESS_INFORMATION [StructLayout(LayoutKind.Sequential)] public struct PROCESS_INFORMATION { public IntPtr hProcess; public IntPtr hThread; public uint dwProcessId; public uint dwThreadId; } #endregion #region SECURITY_ATTRIBUTES [StructLayout(LayoutKind.Sequential)] public class SECURITY_ATTRIBUTES { public int nLength; public string lpSecurityDescriptor; public bool bInheritHandle; } #endregion #region MODULEENTRY32 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct MODULEENTRY32 { public int dwSize; public int th32ModuleID; public int th32ProcessID; public int GlblcntUsage; public int ProccntUsage; public byte modBaseAddr; public int modBaseSize; public IntPtr hModule; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string szModule; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szExePath; } #endregion #region SCROLLINFO public struct SCROLLINFO { public uint cbSize; public uint fMask; public int nMin; public int nMax; public uint nPage; public int nPos; public int nTrackPos; } #endregion #region DISPLAY_DEVICE public struct DISPLAY_DEVICE { public int cb; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string DeviceName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string DeviceString; public int StateFlags; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string DeviceID; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string DeviceKey; } #endregion #region SHFILEINFO public struct SHFILEINFO { public IntPtr hIcon; public int iIcon; public int dwAttributes; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szDisplayName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] public string szTypeName; } #endregion #region FLASHWINFO public struct FLASHWINFO { public uint cbSize; public IntPtr hwnd; public int dwFlags; public uint uCount; public int dwTimeout; } #endregion #region FINDREPLACE public delegate UInt32 FRHookProc(System.IntPtr hdlg, UInt32 uiMsg, UInt32 wParam, UInt32 lParam); [StructLayout(LayoutKind.Sequential)] public struct FINDREPLACE { public int lStructSize; public IntPtr hwndOwner; public IntPtr hInstance; public int Flags; public string lpstrFindWhat; public string lpstrReplaceWith; public UInt16 wFindWhatLen; public UInt16 wReplaceWithLen; public UInt32 lCustData; public FRHookProc lpfnHook; public string lpTemplateName; } #endregion #region CHOOSECOLOR //public delegate UInt32 CCHOOKPROC(IntPtr hdlg, UInt32 uiMsg, UInt32 wParam, UInt32 lParam); //[StructLayout(LayoutKind.Sequential)] //public struct CHOOSECOLOR //{ // public int lStructSize; // public IntPtr hwndOwner; // public IntPtr hInstance; // public int rgbResult; // public int lpCustColors; // public int Flags; // public CCHOOKPROC lCustData; // public long lpfnHook; // public string lpTemplateName; //} public delegate IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public class CHOOSECOLOR { public int lStructSize = Marshal.SizeOf( typeof (CHOOSECOLOR)); public IntPtr hwndOwner; public IntPtr hInstance; public int rgbResult; public IntPtr lpCustColors; public int Flags; public IntPtr lCustData = IntPtr.Zero; public WndProc lpfnHook; public string lpTemplateName; } #endregion #region CHOOSEFONT //public delegate UInt32 CFHOOKPROC(); //[StructLayout(LayoutKind.Sequential)] //public struct CHOOSEFONT //{ // public int lStructSize; // public IntPtr hwndOwner; // public IntPtr hDC; // public LOGFONT lpLogFont; // public int iPointSize; // public long Flags; // public int rgbColors; // public UInt32 lCustData; // public CFHOOKPROC lpfnHook; // public string lpTemplateName; // public IntPtr hInstance; // public string lpszStyle; // public int nFontType; // public int nSizeMin; // public int nSizeMax; //} [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public class CHOOSEFONT { public int lStructSize = Marshal.SizeOf( typeof (CHOOSEFONT)); public IntPtr hwndOwner; public IntPtr hDC; public IntPtr lpLogFont; public int iPointSize; public int Flags; public int rgbColors; public IntPtr lCustData = IntPtr.Zero; public WndProc lpfnHook; public string lpTemplateName; public IntPtr hInstance; public string lpszStyle; public short nFontType; public short ___MISSING_ALIGNMENT__; public int nSizeMin; public int nSizeMax; } #endregion #region LOGFONT //public struct LOGFONT //{ // public long lfHeight; // public long lfWidth; // public long lfEscapement; // public long lfOrientation; // public long lfWeight; // public byte lfItalic; // public byte lfUnderline; // public byte lfStrikeOut; // public byte lfCharSet; // public byte lfOutPrecision; // public byte lfClipPrecision; // public byte lfQuality; // public byte lfPitchAndFamily; // [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] // public string lfFaceName; //} [StructLayout(LayoutKind.Sequential)] public class LOGFONT { public const int LF_FACESIZE = 32; public int lfHeight; public int lfWidth; public int lfEscapement; public int lfOrientation; public int lfWeight; public byte lfItalic; public byte lfUnderline; public byte lfStrikeOut; public byte lfCharSet; public byte lfOutPrecision; public byte lfClipPrecision; public byte lfQuality; public byte lfPitchAndFamily; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = LF_FACESIZE)] public string lfFaceName; } #endregion #region MENUINFO public struct MENUINFO { public int cbSize; public int fMask; public int dwStyle; public int cyMax; public IntPtr hbrBack; public int dwContextHelpID; public int dwMenuData; } #endregion #region MENUITEMINFO [StructLayout(LayoutKind.Sequential)] public struct MENUITEMINFO { public uint cbSize; public uint fMask; public uint fType; public uint fState; public int wID; public int hSubMenu; public int hbmpChecked; public int hbmpUnchecked; public int dwItemData; public IntPtr dwTypeData; public uint cch; } //[StructLayout(LayoutKind.Sequential)] //public struct MENUITEMINFO //{ // public uint cbSize; // public uint fMask; // public uint fType; // public uint fState; // public int wID; // public int /**//*HMENU*/ hSubMenu; // public int /**//*HBITMAP*/ hbmpChecked; // public int /**//*HBITMAP*/ hbmpUnchecked; // public int /**//*ULONG_PTR*/ dwItemData; // public IntPtr dwTypeData; // public uint cch; // public int /**//*HBITMAP*/ hbmpItem; //} #endregion #region MSG public struct MSG { public IntPtr hwnd; public uint message; public int wParam; public int lParam; public int time; public Point pt; } #endregion #region WNDCLASS public delegate string CallBack(IntPtr hwnd, int lParam); public delegate int WNDPROC(IntPtr hwnd, uint uMsg, int wParam, int lParam); [StructLayout(LayoutKind.Sequential)] public struct WNDCLASS { public uint style; public WNDPROC lpfnWndProc; public int cbClsExtra; public int cbWndExtra; public IntPtr hInstance; public IntPtr hIcon; public IntPtr hCursor; public IntPtr hbrBackground; public string lpszMenuName; public string lpszClassName; } #endregion #region NOTIFYICONDATA [StructLayout(LayoutKind.Sequential)] public struct NOTIFYICONDATA { public int cbSize; public IntPtr hWnd; public uint uID; public uint uFlags; public uint uCallbackMessage; public IntPtr hIcon; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string szTip; public int dwState; public int dwStateMask; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string szInfo; public uint uTimeout; public uint uVersion; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szInfoTitle; public int dwInfoFlags; } #endregion #region BY_HANDLE_FILE_INFORMATION public struct BY_HANDLE_FILE_INFORMATION { public int dwFileAttributes; public _FILETIME ftCreationTime; public _FILETIME ftLastAccessTime; public _FILETIME ftLastWriteTime; public int dwVolumeSerialNumber; public int nFileSizeHigh; public int nFileSizeLow; public int nNumberOfLinks; public int nFileIndexHigh; public int nFileIndexLow; public int dwOID; } #endregion #region ProcessInfo public struct ProcessInfo { public IntPtr hwnd; public string ClassName; public string WindowText; public string path; public int processsize; public Point location; public Size wsize; public Size csize; public DateTime starttime; public string runtime; public IntPtr phwnd; public int id; public string text; public int dwStyle; public int dwExStyle; public uint cxWindowBorders; public uint cyWindowBorders; } #endregion #region MODULEINFO public struct MODULEINFO { public IntPtr lpBaseOfDll; public int SizeOfImage; public IntPtr EntryPoint; } #endregion #region ServiceEnumInfo public struct ServiceEnumInfo { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 6)] public string szPrefix; public string szDllName; public IntPtr hServiceHandle; public int dwServiceState; } #endregion #region TIME_ZONE_INFORMATION [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct TIME_ZONE_INFORMATION { public long Bias; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string StandardName; public SYSTEMTIME StandardDate; public long StandardBias; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string DaylightName; SYSTEMTIME DaylightDate; public long DaylightBias; } #endregion #region ICONINFO public struct ICONINFO { public bool fIcon; public int xHotspot; public int yHotspot; public IntPtr hbmMask; public IntPtr hbmColor; } #endregion #region MONITORINFO public struct MONITORINFO { public int cbSize; public RECT rcMonitor; public RECT rcWork; public int dwFlags; } #endregion #region MONITORINFOEX public struct MONITORINFOEX { public int cbSize; public RECT rcMonitor; public RECT rcWork; public int dwFlags; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)] public string szDevice; } #endregion #region INPUT [StructLayout(LayoutKind.Explicit)] public struct INPUT { [System.Runtime.InteropServices.FieldOffset(0)] public int type; [System.Runtime.InteropServices.FieldOffset(4)] public MOUSEINPUT mi; [System.Runtime.InteropServices.FieldOffset(4)] public KEYBDINPUT ki; [System.Runtime.InteropServices.FieldOffset(4)] public HARDWAREINPUT hi; } #endregion #region KEYBDINPUT [StructLayout(LayoutKind.Sequential)] public struct KEYBDINPUT { public short wVk; public short wScan; public int dwFlags; public int time; public IntPtr dwExtraInfo; } #endregion #region MOUSEINPUT [StructLayout(LayoutKind.Sequential)] public struct MOUSEINPUT { public int dx; public int dy; public int mouseData; public int dwFlags; public int time; public IntPtr dwExtraInfo; } #endregion #region HARDWAREINPUT [StructLayout(LayoutKind.Sequential)] public struct HARDWAREINPUT { public int uMsg; public short wParamL; public short wParamH; } #endregion #region DRAWTEXTPARAMS public struct DRAWTEXTPARAMS { public uint cbSize; public int iTabLength; public int iLeftMargin; public int iRightMargin; public uint uiLengthDrawn; } #endregion #endregion #region API_const /// <summary> /// Windows API 常数 /// </summary> public class CommonConst { #region GENERIC public const uint GENERIC_READ = 0x80000000; public const uint GENERIC_WRITE = 0x40000000; #endregion #region CREATEOPEN public const int CREATE_NEW = 1; public const int CREATE_ALWAYS = 2; public const int OPEN_EXISTING = 3; public const int OPEN_ALWAYS = 4; #endregion #region FILE_SHARE public const int FILE_SHARE_READ = 0x1; public const int FILE_SHARE_WRITE = 0x2; public const uint FILE_FLAG_NO_BUFFERING = 0x20000000; public const uint FILE_FLAG_WRITE_THROUGH = 0x80000000; #endregion #region FO public const int FO_MOVE = 0x01; public const int FO_COPY = 0x02; public const int FO_DELETE = 0x03; public const int FO_RENAME = 0x04; #endregion #region FOF public const int FOF_MULTIDESTFILES = 0x01; public const int FOF_CONFIRMMOUSE = 0x02; public const int FOF_SILENT = 0x04; public const int FOF_RENAMEONCOLLISION = 0x08; public const int FOF_NOCONFIRMATION = 0x10; public const int FOF_WANTMAPPINGHANDLE = 0x20; public const int FOF_ALLOWUNDO = 0x40; public const int FOF_FILESONLY = 0x80; public const int FOF_SIMPLEPROGRESS = 0x0100; public const int FOF_NOCONFIRMMKDIR = 0x0200; #endregion #region WS public const int WS_OVERLAPPED = 0x0; public const uint WS_POPUP = 0x80000000; public const int WS_CHILD = 0x40000000; public const int WS_MINIMIZE = 0x20000000; public const int WS_VISIBLE = 0x10000000; public const int WS_DISABLED = 0x8000000; public const int WS_CLIPSIBLINGS = 0x4000000; public const int WS_CLIPCHILDREN = 0x2000000; public const int WS_MAXIMIZE = 0x1000000; public const int WS_CAPTION = 0xC00000; public const int WS_BORDER = 0x800000; public const int WS_DLGFRAME = 0x400000; public const int WS_VSCROLL = 0x200000; public const int WS_HSCROLL = 0x100000; public const int WS_SYSMENU = 0x80000; public const int WS_THICKFRAME = 0x40000; public const int WS_GROUP = 0x20000; public const int WS_TABSTOP = 0x10000; public const int WS_MINIMIZEBOX = 0x20000; public const int WS_MAXIMIZEBOX = 0x10000; public const int WS_TILED = WS_OVERLAPPED; public const int WS_ICONIC = WS_MINIMIZE; public const int WS_SIZEBOX = WS_THICKFRAME; public const int WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX); public const int WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW; public const uint WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU); public const int WS_CHILDWINDOW = (WS_CHILD); public const int WS_EX_WINDOWEDGE = 0x100; //窗口具有凸起的3D边框 public const int WS_EX_CLIENTEDGE = 0x200; //窗口具有阴影边界 public const int WS_EX_TOOLWINDOW = 0x80; //小标题工具窗口 public const int WS_EX_TOPMOST = 0x8; //窗口总在顶层 public const int WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE); //WS_EX-CLIENTEDGE和WS_EX_WINDOWEDGE的组合 public const int WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST); //WS_EX_WINDOWEDGE和WS_EX_TOOLWINDOW和WS_EX_TOPMOST的组合 public const int WS_EX_DLGMODALFRAME = 0x1; //带双边的窗口 public const int WS_EX_NOPARENTNOTIFY = 0x4; //窗口在创建和销毁时不向父窗口发送WM_PARENTNOTIFY消息 public const int WS_EX_TRANSPARENT = 0x20; //窗口透眀 public const int WS_EX_MDICHILD = 0x40; //MDI子窗口 public const int WS_EX_CONTEXTHELP = 0x400; //标题栏包含问号联机帮助按钮 public const int WS_EX_RIGHT = 0x1000; //窗口具有右对齐属性 public const int WS_EX_RTLREADING = 0x2000; //窗口文本自右向左显示 public const int WS_EX_LEFTSCROLLBAR = 0x4000; //标题栏在客户区的左边 public const int WS_EX_CONTROLPARENT = 0x10000; //允许用户使用Tab键在窗口的子窗口间搜索 public const int WS_EX_STATICEDGE = 0x20000; //为不接受用户输入的项创建一个三维边界风格 public const int WS_EX_APPWINDOW = 0x40000; //在任务栏上显示顶层窗口的标题按钮 public const int WS_EX_LAYERED = 0x80000; //窗口具有透眀属性(Win2000)以上 public const int WS_EX_NOINHERITLAYOUT = 0x100000; //窗口布局不传递给子窗口(Win2000)以上 public const int WS_EX_LAYOUTRTL = 0x400000; //水平起点在右边的窗口 public const int WS_EX_NOACTIVATE = 0x8000000; //窗口不会变成前台窗口(Win2000)以上 public const int WS_EX_LEFT = 0x0; //窗口具有左对齐属性 public const int WS_EX_LTRREADING = 0x0; //窗口文本自左向右显示 public const int WS_EX_RIGHTSCROLLBAR = 0x0; //垂直滚动条在窗口的右边界 public const int WS_EX_ACCEPTFILES = 0x10; //接受文件拖曳 public const int WS_EX_COMPOSITED = 0x2000000; //窗体所有子窗口使用双缓冲从低到高绘制(XP) #endregion #region WM public const int WM_NULL = 0x0000; public const int WM_CREATE = 0x0001; public const int WM_DESTROY = 0x0002; public const int WM_MOVE = 0x0003; public const int WM_SIZE = 0x0005; public const int WM_ACTIVATE = 0x0006; public const int WM_SETFOCUS = 0x0007; public const int WM_KILLFOCUS = 0x0008; public const int WM_ENABLE = 0x000A; public const int WM_SETREDRAW = 0x000B; public const int WM_SETTEXT = 0x000C; public const int WM_GETTEXT = 0x000D; public const int WM_GETTEXTLENGTH = 0x000E; public const int WM_PAINT = 0x000F; public const int WM_CLOSE = 0x0010; public const int WM_QUERYENDSESSION = 0x0011; public const int WM_QUIT = 0x0012; public const int WM_QUERYOPEN = 0x0013; public const int WM_ERASEBKGND = 0x0014; public const int WM_SYSCOLORCHANGE = 0x0015; public const int WM_ENDSESSION = 0x0016; public const int WM_SYSTEMERROR = 0x0017; public const int WM_SHOWWINDOW = 0x0018; public const int WM_CTLCOLOR = 0x0019; public const int WM_WININICHANGE = 0x001A; public const int WM_SETTINGCHANGE = WM_WININICHANGE; public const int WM_DEVMODECHANGE = 0x001B; public const int WM_ACTIVATEAPP = 0x001C; public const int WM_FONTCHANGE = 0x001D; public const int WM_TIMECHANGE = 0x001E; public const int WM_CANCELMODE = 0x001F; public const int WM_SETCURSOR = 0x0020; public const int WM_MOUSEACTIVATE = 0x0021; public const int WM_CHILDACTIVATE = 0x0022; public const int WM_QUEUESYNC = 0x0023; public const int WM_GETMINMAXINFO = 0x0024; public const int WM_PAINTICON = 0x0026; public const int WM_ICONERASEBKGND = 0x0027; public const int WM_NEXTDLGCTL = 0x0028; public const int WM_SPOOLERSTATUS = 0x002A; public const int WM_DRAWITEM = 0x002B; public const int WM_MEASUREITEM = 0x002C; public const int WM_DELETEITEM = 0x002D; public const int WM_VKEYTOITEM = 0x002E; public const int WM_CHARTOITEM = 0x002F; public const int WM_SETFONT = 0x0030; public const int WM_GETFONT = 0x0031; public const int WM_SETHOTKEY = 0x0032; public const int WM_GETHOTKEY = 0x0033; public const int WM_QUERYDRAGICON = 0x0037; public const int WM_COMPAREITEM = 0x0039; public const int WM_GETOBJECT = 0x003D; public const int WM_COMPACTING = 0x0041; public const int WM_COMMNOTIFY = 0x0044; public const int WM_WINDOWPOSCHANGING = 0x0046; public const int WM_WINDOWPOSCHANGED = 0x0047; public const int WM_POWER = 0x0048; public const int WM_COPYDATA = 0x004A; public const int WM_CANCELJOURNAL = 0x004B; public const int WM_NOTIFY = 0x004E; public const int WM_INPUTLANGCHANGEREQUEST = 0x0050; public const int WM_INPUTLANGCHANGE = 0x0051; public const int WM_TCARD = 0x0052; public const int WM_HELP = 0x0053; public const int WM_USERCHANGED = 0x0054; public const int WM_NOTIFYFORMAT = 0x0055; public const int WM_CONTEXTMENU = 0x007B; public const int WM_STYLECHANGING = 0x007C; public const int WM_STYLECHANGED = 0x007D; public const int WM_DISPLAYCHANGE = 0x007E; public const int WM_GETICON = 0x007F; public const int WM_SETICON = 0x0080; public const int WM_NCCREATE = 0x0081; public const int WM_NCDESTROY = 0x0082; public const int WM_NCCALCSIZE = 0x0083; public const int WM_NCHITTEST = 0x0084; public const int WM_NCPAINT = 0x0085; public const int WM_NCACTIVATE = 0x0086; public const int WM_GETDLGCODE = 0x0087; public const int WM_NCMOUSEMOVE = 0x00A0; public const int WM_NCLBUTTONDOWN = 0x00A1; public const int WM_NCLBUTTONUP = 0x00A2; public const int WM_NCLBUTTONDBLCLK = 0x00A3; public const int WM_NCRBUTTONDOWN = 0x00A4; public const int WM_NCRBUTTONUP = 0x00A5; public const int WM_NCRBUTTONDBLCLK = 0x00A6; public const int WM_NCMBUTTONDOWN = 0x00A7; public const int WM_NCMBUTTONUP = 0x00A8; public const int WM_NCMBUTTONDBLCLK = 0x00A9; public const int WM_NCXBUTTONDOWN = 0x00AB; public const int WM_NCXBUTTONUP = 0x00AC; public const int WM_NCXBUTTONDBLCLK = 0x00AD; public const int WM_INPUT = 0x00FF; public const int WM_KEYFIRST = 0x0100; public const int WM_KEYDOWN = 0x0100; public const int WM_KEYUP = 0x0101; public const int WM_CHAR = 0x0102; public const int WM_DEADCHAR = 0x0103; public const int WM_SYSKEYDOWN = 0x0104; public const int WM_SYSKEYUP = 0x0105; public const int WM_SYSCHAR = 0x0106; public const int WM_SYSDEADCHAR = 0x0107; public const int WM_UNICHAR = 0x0109; public const int WM_KEYLAST = 0x0109; public const int WM_INITDIALOG = 0x0110; public const int WM_COMMAND = 0x0111; public const int WM_SYSCOMMAND = 0x0112; public const int WM_TIMER = 0x0113; public const int WM_HSCROLL = 0x0114; public const int WM_VSCROLL = 0x0115; public const int WM_INITMENU = 0x0116; public const int WM_INITMENUPOPUP = 0x0117; public const int WM_MENUSELECT = 0x011F; public const int WM_MENUCHAR = 0x0120; public const int WM_ENTERIDLE = 0x0121; public const int WM_MENURBUTTONUP = 0x0122; public const int WM_MENUDRAG = 0x0123; public const int WM_MENUGETOBJECT = 0x0124; public const int WM_UNINITMENUPOPUP = 0x0125; public const int WM_MENUCOMMAND = 0x0126; public const int WM_CHANGEUISTATE = 0x0127; public const int WM_UPDATEUISTATE = 0x0128; public const int WM_QUERYUISTATE = 0x0129; public const int WM_CTLCOLORMSGBOX = 0x0132; public const int WM_CTLCOLOREDIT = 0x0133; public const int WM_CTLCOLORLISTBOX = 0x0134; public const int WM_CTLCOLORBTN = 0x0135; public const int WM_CTLCOLORDLG = 0x0136; public const int WM_CTLCOLORSCROLLBAR = 0x0137; public const int WM_CTLCOLORSTATIC = 0x0138; public const int WM_MOUSEFIRST = 0x0200; public const int WM_MOUSEMOVE = 0x0200; public const int WM_LBUTTONDOWN = 0x0201; public const int WM_LBUTTONUP = 0x0202; public const int WM_LBUTTONDBLCLK = 0x0203; public const int WM_RBUTTONDOWN = 0x0204; public const int WM_RBUTTONUP = 0x0205; public const int WM_RBUTTONDBLCLK = 0x0206; public const int WM_MBUTTONDOWN = 0x0207; public const int WM_MBUTTONUP = 0x0208; public const int WM_MBUTTONDBLCLK = 0x0209; public const int WM_MOUSEWHEEL = 0x020A; public const int WM_MOUSELAST = 0x020A; public const int WM_PARENTNOTIFY = 0x0210; public const int WM_ENTERMENULOOP = 0x0211; public const int WM_EXITMENULOOP = 0x0212; public const int WM_NEXTMENU = 0x0213; public const int WM_SIZING = 532; public const int WM_CAPTURECHANGED = 533; public const int WM_MOVING = 534; public const int WM_POWERBROADCAST = 536; public const int WM_DEVICECHANGE = 537; public const int WM_IME_STARTCOMPOSITION = 0x010D; public const int WM_IME_ENDCOMPOSITION = 0x010E; public const int WM_IME_COMPOSITION = 0x010F; public const int WM_IME_KEYLAST = 0x010F; public const int WM_IME_SETCONTEXT = 0x0281; public const int WM_IME_NOTIFY = 0x0282; public const int WM_IME_CONTROL = 0x0283; public const int WM_IME_COMPOSITIONFULL = 0x0284; public const int WM_IME_SELECT = 0x0285; public const int WM_IME_CHAR = 0x0286; public const int WM_IME_REQUEST = 0x0288; public const int WM_IME_KEYDOWN = 0x0290; public const int WM_IME_KEYUP = 0x0291; public const int WM_MDICREATE = 0x0220; public const int WM_MDIDESTROY = 0x0221; public const int WM_MDIACTIVATE = 0x0222; public const int WM_MDIRESTORE = 0x0223; public const int WM_MDINEXT = 0x0224; public const int WM_MDIMAXIMIZE = 0x0225; public const int WM_MDITILE = 0x0226; public const int WM_MDICASCADE = 0x0227; public const int WM_MDIICONARRANGE = 0x0228; public const int WM_MDIGETACTIVE = 0x0229; public const int WM_MDISETMENU = 0x0230; public const int WM_ENTERSIZEMOVE = 0x0231; public const int WM_EXITSIZEMOVE = 0x0232; public const int WM_DROPFILES = 0x0233; public const int WM_MDIREFRESHMENU = 0x0234; public const int WM_MOUSEHOVER = 0x02A1; public const int WM_MOUSELEAVE = 0x02A3; public const int WM_NCMOUSEHOVER = 0x02A0; public const int WM_NCMOUSELEAVE = 0x02A2; public const int WM_WTSSESSION_CHANGE = 0x02B1; public const int WM_TABLET_FIRST = 0x02C0; public const int WM_TABLET_LAST = 0x02DF; public const int WM_CUT = 0x0300; public const int WM_COPY = 0x0301; public const int WM_PASTE = 0x0302; public const int WM_CLEAR = 0x0303; public const int WM_UNDO = 0x0304; public const int WM_RENDERFORMAT = 0x0305; public const int WM_RENDERALLFORMATS = 0x0306; public const int WM_DESTROYCLIPBOARD = 0x0307; public const int WM_DRAWCLIPBOARD = 0x0308; public const int WM_PAINTCLIPBOARD = 0x0309; public const int WM_VSCROLLCLIPBOARD = 0x030A; public const int WM_SIZECLIPBOARD = 0x030B; public const int WM_ASKCBFORMATNAME = 0x030C; public const int WM_CHANGECBCHAIN = 0x030D; public const int WM_HSCROLLCLIPBOARD = 0x030E; public const int WM_QUERYNEWPALETTE = 0x030F; public const int WM_PALETTEISCHANGING = 0x0310; public const int WM_PALETTECHANGED = 0x0311; public const int WM_HOTKEY = 0x0312; public const int WM_PRINT = 791; public const int WM_PRINTCLIENT = 792; public const int WM_APPCOMMAND = 0x0319; public const int WM_THEMECHANGED = 0x031A; public const int WM_HANDHELDFIRST = 856; public const int WM_HANDHELDLAST = 863; public const int WM_PENWINFIRST = 0x0380; public const int WM_PENWINLAST = 0x038F; public const int WM_COALESCE_FIRST = 0x0390; public const int WM_COALESCE_LAST = 0x039F; public const int WM_DDE_FIRST = 0x03E0; public const int WM_DWMCOMPOSITIONCHANGED = 0x031E; public const int WM_DWMNCRENDERINGCHANGED = 0x031F; public const int WM_DWMCOLORIZATIONCOLORCHANGED = 0x0320; public const int WM_DWMWINDOWMAXIMIZEDCHANGE = 0x0321; public const int WM_APP = 0x8000; public const int WM_USER = 0x0400; #endregion #region SW public const int SW_HIDE = 0; public const int SW_SHOWNORMAL = 1; public const int SW_NORMAL = 1; public const int SW_SHOWMINIMIZED = 2; public const int SW_SHOWMAXIMIZED = 3; public const int SW_MAXIMIZE = 3; public const int SW_SHOWNOACTIVATE = 4; public const int SW_SHOW = 5; public const int SW_MINIMIZE = 6; public const int SW_SHOWMINNOACTIVE = 7; public const int SW_SHOWNA = 8; public const int SW_RESTORE = 9; public const int SW_SHOWDEFAULT = 10; public const int SW_FORCEMINIMIZE = 11; public const int SW_MAX = 11; #endregion #region OF public const int OF_READ = 0x00000000; public const int OF_WRITE = 0x00000001; public const int OF_READWRITE = 0x00000002; public const int OF_SHARE_COMPAT = 0x00000000; public const int OF_SHARE_EXCLUSIVE = 0x00000010; public const int OF_SHARE_DENY_WRITE = 0x00000020; public const int OF_SHARE_DENY_READ = 0x00000030; public const int OF_SHARE_DENY_NONE = 0x00000040; public const int OF_PARSE = 0x00000100; public const int OF_DELETE = 0x00000200; public const int OF_VERIFY = 0x00000400; public const int OF_CANCEL = 0x00000800; public const int OF_CREATE = 0x00001000; public const int OF_PROMPT = 0x00002000; public const int OF_EXIST = 0x00004000; public const int OF_REOPEN = 0x00008000; #endregion #region SWP public const int SWP_DRAWFRAME = 0x0020; //围绕窗口画一个框 public const int SWP_HIDEWINDOW = 0x0080; //隐藏窗口 public const int SWP_NOACTIVATE = 0x0010; //不激活窗口 public const int SWP_NOMOVE = 0x0002; //保持当前位置(x和y设定将被忽略) public const int SWP_NOREDRAW = 0x0008; //窗口不自动重画 public const int SWP_NOSIZE = 0x0001; //保持当前大小(cx和cy会被忽略) public const int SWP_NOZORDER = 0x0004; //保持窗口在列表的当前位置(hWndInsertAfter将被忽略) public const int SWP_SHOWWINDOW = 0x0040; //显示窗口 public const int SWP_FRAMECHANGED = 0x0020; //强迫一条WM_NCCALCSIZE消息进入窗口,即使窗口的大小没有改变 #endregion #region HWND public const int HWND_TOP = 0; public const int HWND_BOTTOM = 1; public const int HWND_TOPMOST = -1; public const int HWND_NOTTOPMOST = -2; #endregion #region PROCESSOR //处理器类型 public const int PROCESSOR_INTEL_386 = 386; public const int PROCESSOR_INTEL_486 = 486; public const int PROCESSOR_INTEL_PENTIUM = 586; public const int PROCESSOR_MIPS_R4000 = 4000; public const int PROCESSOR_ALPHA_21064 = 21064; #endregion #region EWX public const int SE_PRIVILEGE_ENABLED = 0x00000002; public const int TOKEN_QUERY = 0x00000008; public const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; public const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege" ; public const int EWX_LOGOFF = 0x00000000; public const int EWX_SHUTDOWN = 0x00000001; public const int EWX_REBOOT = 0x00000002; public const int EWX_FORCE = 0x00000004; public const int EWX_POWEROFF = 0x00000008; public const int EWX_FORCEIFHUNG = 0x00000010; #endregion #region VK public const int VK_LBUTTON = 0x1; public const int VK_RBUTTON = 0x2; public const int VK_CANCEL = 0x3; public const int VK_MBUTTON = 0x4; public const int VK_BACK = 0x8; public const int VK_TAB = 0x9; public const int VK_CLEAR = 0xC; public const int VK_RETURN = 0xD; public const int VK_SHIFT = 0x10; public const int VK_CONTROL = 0x11; public const int VK_MENU = 0x12; public const int VK_PAUSE = 0x13; public const int VK_CAPITAL = 0x14; public const int VK_ESCAPE = 0x1B; public const int VK_SPACE = 0x20; public const int VK_PRIOR = 0x21; public const int VK_NEXT = 0x22; public const int VK_END = 0x23; public const int VK_HOME = 0x24; public const int VK_LEFT = 0x25; public const int VK_UP = 0x26; public const int VK_RIGHT = 0x27; public const int VK_DOWN = 0x28; public const int VK_SELECT = 0x29; public const int VK_PRINT = 0x2A; public const int VK_EXECUTE = 0x2B; public const int VK_SNAPSHOT = 0x2C; public const int VK_INSERT = 0x2D; public const int VK_DELETE = 0x2E; public const int VK_HELP = 0x2F; public const int VK_NUMPAD0 = 0x60; public const int VK_NUMPAD1 = 0x61; public const int VK_NUMPAD2 = 0x62; public const int VK_NUMPAD3 = 0x63; public const int VK_NUMPAD4 = 0x64; public const int VK_NUMPAD5 = 0x65; public const int VK_NUMPAD6 = 0x66; public const int VK_NUMPAD7 = 0x67; public const int VK_NUMPAD8 = 0x68; public const int VK_NUMPAD9 = 0x69; public const int VK_MULTIPLY = 0x6A; public const int VK_ADD = 0x6B; public const int VK_SEPARATOR = 0x6C; public const int VK_SUBTRACT = 0x6D; public const int VK_DECIMAL = 0x6E; public const int VK_DIVIDE = 0x6F; public const int VK_F1 = 0x70; public const int VK_F2 = 0x71; public const int VK_F3 = 0x72; public const int VK_F4 = 0x73; public const int VK_F5 = 0x74; public const int VK_F6 = 0x75; public const int VK_F7 = 0x76; public const int VK_F8 = 0x77; public const int VK_F9 = 0x78; public const int VK_F10 = 0x79; public const int VK_F11 = 0x7A; public const int VK_F12 = 0x7B; public const int VK_F13 = 0x7C; public const int VK_F14 = 0x7D; public const int VK_F15 = 0x7E; public const int VK_F16 = 0x7F; public const int VK_F17 = 0x80; public const int VK_F18 = 0x81; public const int VK_F19 = 0x82; public const int VK_F20 = 0x83; public const int VK_F21 = 0x84; public const int VK_F22 = 0x85; public const int VK_F23 = 0x86; public const int VK_F24 = 0x87; public const int VK_NUMLOCK = 0x90; public const int VK_SCROLL = 0x91; public const int VK_LSHIFT = 0xA0; public const int VK_RSHIFT = 0xA1; public const int VK_LCONTROL = 0xA2; public const int VK_RCONTROL = 0xA3; public const int VK_LMENU = 0xA4; public const int VK_RMENU = 0xA5; public const int VK_ATTN = 0xF6; public const int VK_CRSEL = 0xF7; public const int VK_EXSEL = 0xF8; public const int VK_EREOF = 0xF9; public const int VK_PLAY = 0xFA; public const int VK_ZOOM = 0xFB; public const int VK_NONAME = 0xFC; public const int VK_PA1 = 0xFD; public const int VK_OEM_CLEAR = 0xFE; #endregion #region SC public const int SC_SIZE = 0xF000; public const int SC_MOVE = 0xF010; public const int SC_MINIMIZE = 0xF020; public const int SC_MAXIMIZE = 0xF030; public const int SC_NEXTWINDOW = 0xF040; public const int SC_PREVWINDOW = 0xF050; public const int SC_CLOSE = 0xF060; public const int SC_VSCROLL = 0xF070; public const int SC_HSCROLL = 0xF080; public const int SC_MOUSEMENU = 0xF090; public const int SC_KEYMENU = 0xF100; public const int SC_ARRANGE = 0xF110; public const int SC_RESTORE = 0xF120; public const int SC_TASKLIST = 0xF130; public const int SC_SCREENSAVE = 0xF140; public const int SC_HOTKEY = 0xF150; public const int SC_DEFAULT = 0xF160; public const int SC_MONITORPOWER = 0xF170; public const int SC_CONTEXTHELP = 0xF180; public const int SC_SEPARATOR = 0xF00F; public const int SC_ICON = SC_MINIMIZE; public const int SC_ZOOM = SC_MAXIMIZE; #endregion #region MF public const int MF_INSERT = 0x00000000; public const int MF_CHANGE = 0x00000080; public const int MF_APPEND = 0x00000100; public const int MF_DELETE = 0x00000200; public const int MF_REMOVE = 0x00001000; public const int MF_BYCOMMAND = 0x00000000; public const int MF_BYPOSITION = 0x00000400; public const int MF_SEPARATOR = 0x00000800; public const int MF_ENABLED = 0x00000000; public const int MF_GRAYED = 0x00000001; public const int MF_DISABLED = 0x00000002; public const int MF_UNCHECKED = 0x00000000; public const int MF_CHECKED = 0x00000008; public const int MF_USECHECKBITMAPS = 0x00000200; public const int MF_STRING = 0x00000000; public const int MF_BITMAP = 0x00000004; public const int MF_OWNERDRAW = 0x00000100; public const int MF_POPUP = 0x00000010; public const int MF_MENUBARBREAK = 0x00000020; public const int MF_MENUBREAK = 0x00000040; public const int MF_UNHILITE = 0x00000000; public const int MF_HILITE = 0x00000080; public const int MF_DEFAULT = 0x00001000; public const int MF_SYSMENU = 0x00002000; public const int MF_HELP = 0x00004000; public const int MF_RIGHTJUSTIFY = 0x00004000; public const int MF_MOUSESELECT = 0x00008000; public const int MF_END = 0x00000080; #endregion #region SE public const int SE_ERR_ACCESSDENIED = 5; //拒绝访问 public const int SE_ERR_ASSOCINCOMPLETE = 27; // 文件关联信息不完整 public const int SE_ERR_DDEBUSY = 30; // DDE繁忙 public const int SE_ERR_DDEFAIL = 29; // DDE操作失败 public const int SE_ERR_DDETIMEOUT = 28; // DDE操作超时 public const int SE_ERR_DLLNOTFOUND = 32; // 没有找到动态链接库 public const int SE_ERR_FNF = 2; // 没有找到文件 public const int SE_ERR_NOASSOC = 31; // 没有找到文件关联 public const int SE_ERR_OOM = 8; // 内存不足 public const int SE_ERR_PNF = 3; // 没有找到路径 public const int SE_ERR_SHARE = 26; // 不能操作一个以打开的文件 #endregion [Flags] enumMouseEventFlag : uint { Move = 0x001, LeftDown = 0x0002, LeftUP = 0x0004, RightDown = 0x0008, RightUp = 0x0010, MiddleDown = 0x0020, MiddleUP = 0x0040, Absolut = 0x8000, xDown = 0x0080, xUp = 0x0100, wheel = 0x0800, virtualDesk = 0x4000 } |
网友评论
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
支持(0) 盖楼(回复)