shell32.odin 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #+build windows
  2. package sys_windows
  3. foreign import shell32 "system:Shell32.lib"
  4. @(default_calling_convention="system")
  5. foreign shell32 {
  6. CommandLineToArgvW :: proc(cmd_list: wstring, num_args: ^c_int) -> [^]wstring ---
  7. ShellExecuteW :: proc(
  8. hwnd: HWND,
  9. lpOperation: LPCWSTR,
  10. lpFile: LPCWSTR,
  11. lpParameters: LPCWSTR,
  12. lpDirectory: LPCWSTR,
  13. nShowCmd: INT,
  14. ) -> HINSTANCE ---
  15. ShellExecuteExW :: proc(pExecInfo: ^SHELLEXECUTEINFOW) -> BOOL ---
  16. SHCreateDirectoryExW :: proc(
  17. hwnd: HWND,
  18. pszPath: LPCWSTR,
  19. psa: ^SECURITY_ATTRIBUTES,
  20. ) -> c_int ---
  21. SHFileOperationW :: proc(lpFileOp: LPSHFILEOPSTRUCTW) -> c_int ---
  22. SHGetFolderPathW :: proc(hwnd: HWND, csidl: c_int, hToken: HANDLE, dwFlags: DWORD, pszPath: LPWSTR) -> HRESULT ---
  23. SHAppBarMessage :: proc(dwMessage: DWORD, pData: PAPPBARDATA) -> UINT_PTR ---
  24. Shell_NotifyIconW :: proc(dwMessage: DWORD, lpData: ^NOTIFYICONDATAW) -> BOOL ---
  25. SHChangeNotify :: proc(wEventId: LONG, uFlags: UINT, dwItem1: LPCVOID, dwItem2: LPCVOID) ---
  26. SHGetKnownFolderIDList :: proc(rfid: REFKNOWNFOLDERID, dwFlags: /* KNOWN_FOLDER_FLAG */ DWORD, hToken: HANDLE, ppidl: rawptr) -> HRESULT ---
  27. SHSetKnownFolderPath :: proc(rfid: REFKNOWNFOLDERID, dwFlags: /* KNOWN_FOLDER_FLAG */ DWORD, hToken: HANDLE, pszPath: PCWSTR ) -> HRESULT ---
  28. SHGetKnownFolderPath :: proc(rfid: REFKNOWNFOLDERID, dwFlags: /* KNOWN_FOLDER_FLAG */ DWORD, hToken: HANDLE, ppszPath: ^LPWSTR) -> HRESULT ---
  29. ExtractIconExW :: proc(pszFile: LPCWSTR, nIconIndex: INT, phiconLarge: ^HICON, phiconSmall: ^HICON, nIcons: UINT) -> UINT ---
  30. DragAcceptFiles :: proc(hWnd: HWND, fAccept: BOOL) ---
  31. DragQueryPoint :: proc(hDrop: HDROP, ppt: ^POINT) -> BOOL ---
  32. DragQueryFileW :: proc(hDrop: HDROP, iFile: UINT, lpszFile: LPWSTR, cch: UINT) -> UINT ---
  33. DragFinish :: proc(hDrop: HDROP) --- // @New
  34. }
  35. APPBARDATA :: struct {
  36. cbSize: DWORD,
  37. hWnd: HWND,
  38. uCallbackMessage: UINT,
  39. uEdge: UINT,
  40. rc: RECT,
  41. lParam: LPARAM,
  42. }
  43. PAPPBARDATA :: ^APPBARDATA
  44. ABM_NEW :: 0x00000000
  45. ABM_REMOVE :: 0x00000001
  46. ABM_QUERYPOS :: 0x00000002
  47. ABM_SETPOS :: 0x00000003
  48. ABM_GETSTATE :: 0x00000004
  49. ABM_GETTASKBARPOS :: 0x00000005
  50. ABM_ACTIVATE :: 0x00000006
  51. ABM_GETAUTOHIDEBAR :: 0x00000007
  52. ABM_SETAUTOHIDEBAR :: 0x00000008
  53. ABM_WINDOWPOSCHANGED :: 0x0000009
  54. ABM_SETSTATE :: 0x0000000a
  55. ABN_STATECHANGE :: 0x0000000
  56. ABN_POSCHANGED :: 0x0000001
  57. ABN_FULLSCREENAPP :: 0x0000002
  58. ABN_WINDOWARRANGE :: 0x0000003
  59. ABS_AUTOHIDE :: 0x0000001
  60. ABS_ALWAYSONTOP :: 0x0000002
  61. ABE_LEFT :: 0
  62. ABE_TOP :: 1
  63. ABE_RIGHT :: 2
  64. ABE_BOTTOM :: 3
  65. KNOWNFOLDERID :: GUID
  66. REFKNOWNFOLDERID :: ^KNOWNFOLDERID
  67. HDROP :: HANDLE
  68. KNOWN_FOLDER_FLAG :: enum u32 {
  69. DEFAULT = 0x00000000,
  70. // if NTDDI_VERSION >= NTDDI_WIN10_RS3
  71. FORCE_APP_DATA_REDIRECTION = 0x00080000,
  72. // if NTDDI_VERSION >= NTDDI_WIN10_RS2
  73. RETURN_FILTER_REDIRECTION_TARGET = 0x00040000,
  74. FORCE_PACKAGE_REDIRECTION = 0x00020000,
  75. NO_PACKAGE_REDIRECTION = 0x00010000,
  76. FORCE_APPCONTAINER_REDIRECTION = 0x00020000,
  77. // if NTDDI_VERSION >= NTDDI_WIN7
  78. NO_APPCONTAINER_REDIRECTION = 0x00010000,
  79. CREATE = 0x00008000,
  80. DONT_VERIFY = 0x00004000,
  81. DONT_UNEXPAND = 0x00002000,
  82. NO_ALIAS = 0x00001000,
  83. INIT = 0x00000800,
  84. DEFAULT_PATH = 0x00000400,
  85. NOT_PARENT_RELATIVE = 0x00000200,
  86. SIMPLE_IDLIST = 0x00000100,
  87. ALIAS_ONLY = 0x80000000,
  88. }
  89. SHCNRF_InterruptLevel :: 0x0001
  90. SHCNRF_ShellLevel :: 0x0002
  91. SHCNRF_RecursiveInterrupt :: 0x1000
  92. SHCNRF_NewDelivery :: 0x8000
  93. SHCNE_RENAMEITEM :: 0x00000001
  94. SHCNE_CREATE :: 0x00000002
  95. SHCNE_DELETE :: 0x00000004
  96. SHCNE_MKDIR :: 0x00000008
  97. SHCNE_RMDIR :: 0x00000010
  98. SHCNE_MEDIAINSERTED :: 0x00000020
  99. SHCNE_MEDIAREMOVED :: 0x00000040
  100. SHCNE_DRIVEREMOVED :: 0x00000080
  101. SHCNE_DRIVEADD :: 0x00000100
  102. SHCNE_NETSHARE :: 0x00000200
  103. SHCNE_NETUNSHARE :: 0x00000400
  104. SHCNE_ATTRIBUTES :: 0x00000800
  105. SHCNE_UPDATEDIR :: 0x00001000
  106. SHCNE_UPDATEITEM :: 0x00002000
  107. SHCNE_SERVERDISCONNECT :: 0x00004000
  108. SHCNE_UPDATEIMAGE :: 0x00008000
  109. SHCNE_DRIVEADDGUI :: 0x00010000
  110. SHCNE_RENAMEFOLDER :: 0x00020000
  111. SHCNE_FREESPACE :: 0x00040000
  112. SHCNE_EXTENDED_EVENT :: 0x04000000
  113. SHCNE_ASSOCCHANGED :: 0x08000000
  114. SHCNE_DISKEVENTS :: 0x0002381F
  115. SHCNE_GLOBALEVENTS :: 0x0C0581E0
  116. SHCNE_ALLEVENTS :: 0x7FFFFFFF
  117. SHCNE_INTERRUPT :: 0x80000000
  118. SHCNEE_ORDERCHANGED :: 2
  119. SHCNEE_MSI_CHANGE :: 4
  120. SHCNEE_MSI_UNINSTALL :: 5
  121. SHCNF_IDLIST :: 0x0000
  122. SHCNF_PATHA :: 0x0001
  123. SHCNF_PRINTERA :: 0x0002
  124. SHCNF_DWORD :: 0x0003
  125. SHCNF_PATHW :: 0x0005
  126. SHCNF_PRINTERW :: 0x0006
  127. SHCNF_TYPE :: 0x00FF
  128. SHCNF_FLUSH :: 0x1000
  129. SHCNF_FLUSHNOWAIT :: 0x3000
  130. SHCNF_NOTIFYRECURSIVE :: 0x10000