GuiListView.au3 216 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728
  1. #include-once
  2. #include "Array.au3"
  3. #include "GuiHeader.au3"
  4. #include "ListViewConstants.au3"
  5. #include "Memory.au3"
  6. #include "SendMessage.au3"
  7. #include "StructureConstants.au3"
  8. #include "UDFGlobalID.au3"
  9. #include "WinAPIConv.au3"
  10. #include "WinAPIGdi.au3"
  11. #include "WinAPIMisc.au3"
  12. #include "WinAPIRes.au3"
  13. ; #INDEX# =======================================================================================================================
  14. ; Title .........: ListView
  15. ; AutoIt Version : 3.3.14.5
  16. ; Language ......: English
  17. ; Description ...: Functions that assist with ListView control management.
  18. ; A ListView control is a window that displays a collection of items; each item consists of an icon and a label.
  19. ; ListView controls provide several ways to arrange and display items. For example, additional information about
  20. ; each item can be displayed in columns to the right of the icon and label.
  21. ; Author(s) .....: Paul Campbell (PaulIA)
  22. ; ===============================================================================================================================
  23. ; #VARIABLES# ===================================================================================================================
  24. Global $__g_hLVLastWnd
  25. ; for use with the sort call back functions
  26. Global Const $__LISTVIEWCONSTANT_SORTINFOSIZE = 11
  27. Global $__g_aListViewSortInfo[1][$__LISTVIEWCONSTANT_SORTINFOSIZE]
  28. ; ===============================================================================================================================
  29. ; #CONSTANTS# ===================================================================================================================
  30. Global Const $__LISTVIEWCONSTANT_ClassName = "SysListView32"
  31. Global Const $__LISTVIEWCONSTANT_WS_MAXIMIZEBOX = 0x00010000
  32. Global Const $__LISTVIEWCONSTANT_WS_MINIMIZEBOX = 0x00020000
  33. Global Const $__LISTVIEWCONSTANT_GUI_RUNDEFMSG = 'GUI_RUNDEFMSG'
  34. Global Const $__LISTVIEWCONSTANT_WM_SETREDRAW = 0x000B
  35. Global Const $__LISTVIEWCONSTANT_WM_SETFONT = 0x0030
  36. Global Const $__LISTVIEWCONSTANT_WM_NOTIFY = 0x004E
  37. Global Const $__LISTVIEWCONSTANT_DEFAULT_GUI_FONT = 17
  38. Global Const $__LISTVIEWCONSTANT_ILD_TRANSPARENT = 0x00000001
  39. Global Const $__LISTVIEWCONSTANT_ILD_BLEND25 = 0x00000002
  40. Global Const $__LISTVIEWCONSTANT_ILD_BLEND50 = 0x00000004
  41. Global Const $__LISTVIEWCONSTANT_ILD_MASK = 0x00000010
  42. Global Const $__LISTVIEWCONSTANT_VK_DOWN = 0x28
  43. Global Const $__LISTVIEWCONSTANT_VK_END = 0x23
  44. Global Const $__LISTVIEWCONSTANT_VK_HOME = 0x24
  45. Global Const $__LISTVIEWCONSTANT_VK_LEFT = 0x25
  46. Global Const $__LISTVIEWCONSTANT_VK_NEXT = 0x22
  47. Global Const $__LISTVIEWCONSTANT_VK_PRIOR = 0x21
  48. Global Const $__LISTVIEWCONSTANT_VK_RIGHT = 0x27
  49. Global Const $__LISTVIEWCONSTANT_VK_UP = 0x26
  50. ; ===============================================================================================================================
  51. ; #NO_DOC_FUNCTION# =============================================================================================================
  52. ; Not working/documented/implemented at this time
  53. ;
  54. ; _GUICtrlListView_GetEmptyText
  55. ; _GUICtrlListView_GetGroupState
  56. ; _GUICtrlListView_GetInsertMark
  57. ; _GUICtrlListView_GetInsertMarkColor
  58. ; _GUICtrlListView_GetInsertMarkRect
  59. ; _GUICtrlListView_InsertMarkHitTest
  60. ; _GUICtrlListView_IsItemVisible
  61. ; _GUICtrlListView_MoveGroup
  62. ; _GUICtrlListView_SetHotCursor
  63. ; _GUICtrlListView_SetInfoTip
  64. ; _GUICtrlListView_SetInsertMark
  65. ; _GUICtrlListView_SetInsertMarkColor
  66. ; ===============================================================================================================================
  67. ; #CURRENT# =====================================================================================================================
  68. ; _GUICtrlListView_AddArray
  69. ; _GUICtrlListView_AddColumn
  70. ; _GUICtrlListView_AddItem
  71. ; _GUICtrlListView_AddSubItem
  72. ; _GUICtrlListView_ApproximateViewHeight
  73. ; _GUICtrlListView_ApproximateViewRect
  74. ; _GUICtrlListView_ApproximateViewWidth
  75. ; _GUICtrlListView_Arrange
  76. ; _GUICtrlListView_BeginUpdate
  77. ; _GUICtrlListView_CancelEditLabel
  78. ; _GUICtrlListView_ClickItem
  79. ; _GUICtrlListView_CopyItems
  80. ; _GUICtrlListView_Create
  81. ; _GUICtrlListView_CreateDragImage
  82. ; _GUICtrlListView_CreateSolidBitMap
  83. ; _GUICtrlListView_DeleteAllItems
  84. ; _GUICtrlListView_DeleteColumn
  85. ; _GUICtrlListView_DeleteItem
  86. ; _GUICtrlListView_DeleteItemsSelected
  87. ; _GUICtrlListView_Destroy
  88. ; _GUICtrlListView_DrawDragImage
  89. ; _GUICtrlListView_EditLabel
  90. ; _GUICtrlListView_EnableGroupView
  91. ; _GUICtrlListView_EndUpdate
  92. ; _GUICtrlListView_EnsureVisible
  93. ; _GUICtrlListView_FindInText
  94. ; _GUICtrlListView_FindItem
  95. ; _GUICtrlListView_FindNearest
  96. ; _GUICtrlListView_FindParam
  97. ; _GUICtrlListView_FindText
  98. ; _GUICtrlListView_GetBkColor
  99. ; _GUICtrlListView_GetBkImage
  100. ; _GUICtrlListView_GetCallbackMask
  101. ; _GUICtrlListView_GetColumn
  102. ; _GUICtrlListView_GetColumnCount
  103. ; _GUICtrlListView_GetColumnOrder
  104. ; _GUICtrlListView_GetColumnOrderArray
  105. ; _GUICtrlListView_GetColumnWidth
  106. ; _GUICtrlListView_GetCounterPage
  107. ; _GUICtrlListView_GetEditControl
  108. ; _GUICtrlListView_GetExtendedListViewStyle
  109. ; _GUICtrlListView_GetFocusedGroup
  110. ; _GUICtrlListView_GetGroupCount
  111. ; _GUICtrlListView_GetGroupInfo
  112. ; _GUICtrlListView_GetGroupInfoByIndex
  113. ; _GUICtrlListView_GetGroupRect
  114. ; _GUICtrlListView_GetGroupViewEnabled
  115. ; _GUICtrlListView_GetHeader
  116. ; _GUICtrlListView_GetHotCursor
  117. ; _GUICtrlListView_GetHotItem
  118. ; _GUICtrlListView_GetHoverTime
  119. ; _GUICtrlListView_GetImageList
  120. ; _GUICtrlListView_GetISearchString
  121. ; _GUICtrlListView_GetItem
  122. ; _GUICtrlListView_GetItemChecked
  123. ; _GUICtrlListView_GetItemCount
  124. ; _GUICtrlListView_GetItemCut
  125. ; _GUICtrlListView_GetItemDropHilited
  126. ; _GUICtrlListView_GetItemEx
  127. ; _GUICtrlListView_GetItemFocused
  128. ; _GUICtrlListView_GetItemGroupID
  129. ; _GUICtrlListView_GetItemImage
  130. ; _GUICtrlListView_GetItemIndent
  131. ; _GUICtrlListView_GetItemParam
  132. ; _GUICtrlListView_GetItemPosition
  133. ; _GUICtrlListView_GetItemPositionX
  134. ; _GUICtrlListView_GetItemPositionY
  135. ; _GUICtrlListView_GetItemRect
  136. ; _GUICtrlListView_GetItemRectEx
  137. ; _GUICtrlListView_GetItemSelected
  138. ; _GUICtrlListView_GetItemSpacing
  139. ; _GUICtrlListView_GetItemSpacingX
  140. ; _GUICtrlListView_GetItemSpacingY
  141. ; _GUICtrlListView_GetItemState
  142. ; _GUICtrlListView_GetItemStateImage
  143. ; _GUICtrlListView_GetItemText
  144. ; _GUICtrlListView_GetItemTextArray
  145. ; _GUICtrlListView_GetItemTextString
  146. ; _GUICtrlListView_GetNextItem
  147. ; _GUICtrlListView_GetNumberOfWorkAreas
  148. ; _GUICtrlListView_GetOrigin
  149. ; _GUICtrlListView_GetOriginX
  150. ; _GUICtrlListView_GetOriginY
  151. ; _GUICtrlListView_GetOutlineColor
  152. ; _GUICtrlListView_GetSelectedColumn
  153. ; _GUICtrlListView_GetSelectedCount
  154. ; _GUICtrlListView_GetSelectedIndices
  155. ; _GUICtrlListView_GetSelectionMark
  156. ; _GUICtrlListView_GetStringWidth
  157. ; _GUICtrlListView_GetSubItemRect
  158. ; _GUICtrlListView_GetTextBkColor
  159. ; _GUICtrlListView_GetTextColor
  160. ; _GUICtrlListView_GetToolTips
  161. ; _GUICtrlListView_GetTopIndex
  162. ; _GUICtrlListView_GetUnicodeFormat
  163. ; _GUICtrlListView_GetView
  164. ; _GUICtrlListView_GetViewDetails
  165. ; _GUICtrlListView_GetViewLarge
  166. ; _GUICtrlListView_GetViewList
  167. ; _GUICtrlListView_GetViewSmall
  168. ; _GUICtrlListView_GetViewTile
  169. ; _GUICtrlListView_GetViewRect
  170. ; _GUICtrlListView_HideColumn
  171. ; _GUICtrlListView_HitTest
  172. ; _GUICtrlListView_InsertColumn
  173. ; _GUICtrlListView_InsertGroup
  174. ; _GUICtrlListView_InsertItem
  175. ; _GUICtrlListView_JustifyColumn
  176. ; _GUICtrlListView_MapIDToIndex
  177. ; _GUICtrlListView_MapIndexToID
  178. ; _GUICtrlListView_RedrawItems
  179. ; _GUICtrlListView_RegisterSortCallBack
  180. ; _GUICtrlListView_RemoveAllGroups
  181. ; _GUICtrlListView_RemoveGroup
  182. ; _GUICtrlListView_Scroll
  183. ; _GUICtrlListView_SetBkColor
  184. ; _GUICtrlListView_SetBkImage
  185. ; _GUICtrlListView_SetCallBackMask
  186. ; _GUICtrlListView_SetColumn
  187. ; _GUICtrlListView_SetColumnOrder
  188. ; _GUICtrlListView_SetColumnOrderArray
  189. ; _GUICtrlListView_SetColumnWidth
  190. ; _GUICtrlListView_SetExtendedListViewStyle
  191. ; _GUICtrlListView_SetGroupInfo
  192. ; _GUICtrlListView_SetHotItem
  193. ; _GUICtrlListView_SetHoverTime
  194. ; _GUICtrlListView_SetIconSpacing
  195. ; _GUICtrlListView_SetImageList
  196. ; _GUICtrlListView_SetItem
  197. ; _GUICtrlListView_SetItemChecked
  198. ; _GUICtrlListView_SetItemCount
  199. ; _GUICtrlListView_SetItemCut
  200. ; _GUICtrlListView_SetItemDropHilited
  201. ; _GUICtrlListView_SetItemEx
  202. ; _GUICtrlListView_SetItemFocused
  203. ; _GUICtrlListView_SetItemGroupID
  204. ; _GUICtrlListView_SetItemImage
  205. ; _GUICtrlListView_SetItemIndent
  206. ; _GUICtrlListView_SetItemParam
  207. ; _GUICtrlListView_SetItemPosition
  208. ; _GUICtrlListView_SetItemPosition32
  209. ; _GUICtrlListView_SetItemSelected
  210. ; _GUICtrlListView_SetItemState
  211. ; _GUICtrlListView_SetItemStateImage
  212. ; _GUICtrlListView_SetItemText
  213. ; _GUICtrlListView_SetOutlineColor
  214. ; _GUICtrlListView_SetSelectedColumn
  215. ; _GUICtrlListView_SetSelectionMark
  216. ; _GUICtrlListView_SetTextBkColor
  217. ; _GUICtrlListView_SetTextColor
  218. ; _GUICtrlListView_SetToolTips
  219. ; _GUICtrlListView_SetUnicodeFormat
  220. ; _GUICtrlListView_SetView
  221. ; _GUICtrlListView_SetWorkAreas
  222. ; _GUICtrlListView_SimpleSort
  223. ; _GUICtrlListView_SortItems
  224. ; _GUICtrlListView_SubItemHitTest
  225. ; _GUICtrlListView_UnRegisterSortCallBack
  226. ; ===============================================================================================================================
  227. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  228. ; $tagLVBKIMAGE
  229. ; $tagLVCOLUMN
  230. ; $tagLVGROUP
  231. ; $tagLVINSERTMARK
  232. ; $tagLVSETINFOTIP
  233. ; __GUICtrlListView_ArrayDelete
  234. ; __GUICtrlListView_Draw
  235. ; __GUICtrlListView_GetGroupInfoEx
  236. ; __GUICtrlListView_GetItemOverlayImage
  237. ; __GUICtrlListView_IndexToOverlayImageMask
  238. ; __GUICtrlListView_IndexToStateImageMask
  239. ; __GUICtrlListView_OverlayImageMaskToIndex
  240. ; __GUICtrlListView_SetItemOverlayImage
  241. ; __GUICtrlListView_Sort
  242. ; __GUICtrlListView_StateImageMaskToIndex
  243. ; __GUICtrlListView_ReverseColorOrder
  244. ; ===============================================================================================================================
  245. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  246. ; Name...........: $tagLVBKIMAGE
  247. ; Description ...: Contains information about the background image of a list-view control
  248. ; Fields ........: Flags - This member may be one or more of the following flags. You can use the LVBKIF_SOURCE_MASK value
  249. ; +to mask off all but the source flags. You can use the LVBKIF_STYLE_MASK value to mask off all but the style
  250. ; +flags.
  251. ; |$LVBKIF_SOURCE_NONE - The control has no background image
  252. ; |$LVBKIF_SOURCE_URL - The Image member contains the URL of the background image
  253. ; |$LVBKIF_STYLE_NORMAL - The background image is displayed normally
  254. ; |$LVBKIF_STYLE_TILE - The background image will be tiled to fill the entire background of the control
  255. ; |$LVBKIF_FLAG_TILEOFFSET - You use this flag to specify the coordinates of the first tile. This flag is valid
  256. ; +only if the $LVBKIF_STYLE_TILE flag is also specified. If this flag is not specified the first tile begins at
  257. ; +the upper-left corner of the client area.
  258. ; hBmp - Not used
  259. ; Image - Address of a string that contains the URL of the background image. This member is only valid if
  260. ; +the $LVBKIF_SOURCE_URL flag is set in Flags. This member must be initialized to point to the buffer that
  261. ; +contains or receives the text before sending the message.
  262. ; ImageMax - Size of the buffer at the address in Image. If information is being sent to the control, this
  263. ; +member is ignored.
  264. ; XOffPercent - Percentage of the client area that the image should be offset horizontally. For example, at 0
  265. ; +percent, the image will be displayed against the left edge of the control's client area. At 50 percent, the
  266. ; +image will be displayed horizontally centered in the control's client area. At 100 percent, the image will be
  267. ; +displayed against the right edge of the control's client area. This member is only valid when the
  268. ; +$LVBKIF_STYLE_NORMAL is specified in Flags. If both $LVBKIF_FLAG_TILEOFFSET and $LVBKIF_STYLE_TILE are
  269. ; +specified in Flags, then the value specifies the pixel, not percentage offset, of the first tile. Otherwise,
  270. ; +the value is ignored.
  271. ; YOffPercent - Percentage of the control's client area that the image should be offset vertically. For example
  272. ; +at 0 percent, the image will be displayed against the top edge of the control's client area. At 50 percent,
  273. ; +the image will be displayed vertically centered in the control's client area. At 100 percent, the image will
  274. ; +be displayed against the bottom edge of the control's client area. This member is only valid when the
  275. ; +$LVBKIF_STYLE_NORMAL is specified in Flags. If both $LVBKIF_FLAG_TILEOFFSET and $LVBKIF_STYLE_TILE are
  276. ; +specified in Flags, then the value specifies the pixel, not percentage offset, of the first tile. Otherwise,
  277. ; +the value is ignored.
  278. ; Author ........: Paul Campbell (PaulIA)
  279. ; Remarks .......:
  280. ; ===============================================================================================================================
  281. Global Const $tagLVBKIMAGE = "ulong Flags;hwnd hBmp;ptr Image;uint ImageMax;int XOffPercent;int YOffPercent"
  282. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  283. ; Name...........: $tagLVCOLUMN
  284. ; Description ...: Contains information about a column in report view
  285. ; Fields ........: Mask - Variable specifying which members contain valid information. This member can be zero, or one or
  286. ; +more of the following values:
  287. ; |LVCF_FMT - The Fmt member is valid
  288. ; |LVCF_WIDTH - The CX member is valid
  289. ; |LVCF_TEXT - The Text member is valid
  290. ; |LVCF_SUBITEM - The SubItem member is valid
  291. ; |LVCF_IMAGE - The Image member is valid
  292. ; |LVCF_ORDER - The Order member is valid.
  293. ; Fmt - Alignment of the column header and the subitem text in the column. This member can be one of the
  294. ; +following values. The alignment of the leftmost column is always left-justified; it cannot be changed:
  295. ; |LVCFMT_LEFT - Text is left-aligned
  296. ; |LVCFMT_RIGHT - Text is right-aligned
  297. ; |LVCFMT_CENTER - Text is centered
  298. ; |LVCFMT_JUSTIFYMASK - A bitmask used to select those bits of Fmt that control field justification
  299. ; |LVCFMT_IMAGE - The item displays an image from an image list
  300. ; |LVCFMT_BITMAP_ON_RIGHT - The bitmap appears to the right of text
  301. ; |LVCFMT_COL_HAS_IMAGES - The header item contains an image in the image list.
  302. ; CX - Width of the column, in pixels
  303. ; Text - If column information is being set, this member is the address of a string that contains the column
  304. ; +header text. If the structure is receiving information about a column, this member specifies the address of
  305. ; +the buffer that receives the column header text.
  306. ; TextMax - Size of the buffer pointed to by the Text member. If the structure is not receiving information
  307. ; +about a column, this member is ignored.
  308. ; SubItem - Index of subitem associated with the column
  309. ; Image - Zero based index of an image within the image list
  310. ; Order - Zero-based column offset. Column offset is in left-to-right order.
  311. ; Microsoft Windows Vista or later
  312. ; cxMin; // min snap point
  313. ; cxDefault; // default snap point
  314. ; cxIdeal; // read only. ideal may not eqaul current width if auto sized (LVS_EX_AUTOSIZECOLUMNS) to a lesser width.
  315. ; Author ........: Paul Campbell (PaulIA)
  316. ; Modified ......: jpm
  317. ; Remarks .......:
  318. ; ===============================================================================================================================
  319. Global Const $tagLVCOLUMN = "uint Mask;int Fmt;int CX;ptr Text;int TextMax;int SubItem;int Image;int Order;int cxMin;int cxDefault;int cxIdeal"
  320. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  321. ; Name...........: $tagLVGROUP
  322. ; Description ...: Used to set and retrieve groups
  323. ; Fields ........: Size - Size of this structure, in bytes
  324. ; Mask - Mask that specifies which members of the structure are valid input. Can be one or more of the
  325. ; +following values:
  326. ; |$LVGF_NONE - No other items are valid
  327. ; |$LVGF_HEADER - Header and HeaderMax members are valid
  328. ; |$LVGF_FOOTER - Reserved
  329. ; |$LVGF_STATE - Reserved
  330. ; |$LVGF_ALIGN - Align member is valid
  331. ; |$LVGF_GROUPID - GroupId member is valid
  332. ; Header - Pointer to a string that contains the header text when item information is being set. If group
  333. ; +information is being retrieved this member specifies the address of the buffer that receives the header text.
  334. ; HeaderMax - Size of the buffer pointed to by the Header member. If the structure is not receiving information
  335. ; +about a group, this member is ignored.
  336. ; Footer - Reserved
  337. ; FooterMax - Reserved
  338. ; GroupID - ID of the group
  339. ; StateMask - Reserved
  340. ; State - Reserved
  341. ; Align - Indicates the alignment of the header text. It can have one or more of the following values. Use
  342. ; +one of the header flags.
  343. ; |LVGA_HEADER_CENTER - Header text is centered horizontally in the window
  344. ; |LVGA_HEADER_LEFT - Header text is aligned at the left of the window
  345. ; |LVGA_HEADER_RIGHT - Header text is aligned at the right of the window.
  346. ; Microsoft Windows Vista or later
  347. ; pszSubtitle;
  348. ; cchSubtitle;
  349. ; pszTask;
  350. ; cchTask;
  351. ; pszDescriptionTop;
  352. ; cchDescriptionTop;
  353. ; pszDescriptionBottom;
  354. ; cchDescriptionBottom;
  355. ; iTitleImage;
  356. ; iExtendedImage;
  357. ; iFirstItem; // Read only
  358. ; cItems; // Read only
  359. ; pszSubsetTitle; // NULL if group is not subset
  360. ; cchSubsetTitle;
  361. ; Author ........: Paul Campbell (PaulIA)
  362. ; Modified ......: jpm
  363. ; Remarks .......:
  364. ; ===============================================================================================================================
  365. Global Const $tagLVGROUP = "uint Size;uint Mask;ptr Header;int HeaderMax;ptr Footer;int FooterMax;int GroupID;uint StateMask;uint State;uint Align;" & _
  366. "ptr pszSubtitle;uint cchSubtitle;ptr pszTask;uint cchTask;ptr pszDescriptionTop;uint cchDescriptionTop;ptr pszDescriptionBottom;" & _
  367. "uint cchDescriptionBottom;int iTitleImage;int iExtendedImage;int iFirstItem;uint cItems;ptr pszSubsetTitle;uint cchSubsetTitle"
  368. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  369. ; Name...........: $tagLVINSERTMARK
  370. ; Description ...: Used to describe insertion points
  371. ; Fields ........: Size - Size of this structure, in bytes
  372. ; Flags - Flag that specifies where the insertion point should appear:
  373. ; |$LVIM_AFTER - The insertion point appears after the item specified if the $LVIM_AFTER flag is set; otherwise
  374. ; +it appears before the specified item.
  375. ; Item - Item next to which the insertion point appears. If -1, there is no insertion point.
  376. ; Reserved - Reserved. Must be set to 0.
  377. ; Author ........: Paul Campbell (PaulIA)
  378. ; Remarks .......:
  379. ; ===============================================================================================================================
  380. Global Const $tagLVINSERTMARK = "uint Size;dword Flags;int Item;dword Reserved"
  381. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  382. ; Name...........: $tagLVSETINFOTIP
  383. ; Description ...: Provides information about tooltip text that is to be set
  384. ; Fields ........: Size - Size of this structure, in bytes
  385. ; Flags - Flag that specifies how the text should be set. Set to zero.
  386. ; Text - Pointer to a Unicode string that contains the tooltip text
  387. ; Item - Contains the zero based index of the item to which this structure refers
  388. ; SubItem - Contains the one based index of the subitem to which this structure refers
  389. ; Author ........: Paul Campbell (PaulIA)
  390. ; Remarks .......:
  391. ; ===============================================================================================================================
  392. Global Const $tagLVSETINFOTIP = "uint Size;dword Flags;ptr Text;int Item;int SubItem"
  393. ; #FUNCTION# ====================================================================================================================
  394. ; Author ........: Paul Campbell (PaulIA)
  395. ; Modified.......: Gary Frost (gafrost)
  396. ; ===============================================================================================================================
  397. Func _GUICtrlListView_AddArray($hWnd, ByRef $aItems)
  398. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  399. Local $tItem = DllStructCreate($tagLVITEM)
  400. Local $tBuffer
  401. If $bUnicode Then
  402. $tBuffer = DllStructCreate("wchar Text[4096]")
  403. Else
  404. $tBuffer = DllStructCreate("char Text[4096]")
  405. EndIf
  406. DllStructSetData($tItem, "Mask", $LVIF_TEXT)
  407. DllStructSetData($tItem, "Text", DllStructGetPtr($tBuffer))
  408. DllStructSetData($tItem, "TextMax", 4096)
  409. Local $iLastItem = _GUICtrlListView_GetItemCount($hWnd)
  410. _GUICtrlListView_BeginUpdate($hWnd)
  411. If IsHWnd($hWnd) Then
  412. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  413. For $iI = 0 To UBound($aItems) - 1
  414. DllStructSetData($tItem, "Item", $iI)
  415. DllStructSetData($tItem, "SubItem", 0)
  416. DllStructSetData($tBuffer, "Text", $aItems[$iI][0])
  417. _SendMessage($hWnd, $LVM_INSERTITEMW, 0, $tItem, 0, "wparam", "struct*")
  418. For $iJ = 1 To UBound($aItems, $UBOUND_COLUMNS) - 1
  419. DllStructSetData($tItem, "SubItem", $iJ)
  420. DllStructSetData($tBuffer, "Text", $aItems[$iI][$iJ])
  421. _SendMessage($hWnd, $LVM_SETITEMW, 0, $tItem, 0, "wparam", "struct*")
  422. Next
  423. Next
  424. Else
  425. Local $iBuffer = DllStructGetSize($tBuffer)
  426. Local $iItem = DllStructGetSize($tItem)
  427. Local $tMemMap
  428. Local $pMemory = _MemInit($hWnd, $iItem + $iBuffer, $tMemMap)
  429. Local $pText = $pMemory + $iItem
  430. DllStructSetData($tItem, "Text", $pText)
  431. For $iI = 0 To UBound($aItems) - 1
  432. DllStructSetData($tItem, "Item", $iI + $iLastItem)
  433. DllStructSetData($tItem, "SubItem", 0)
  434. DllStructSetData($tBuffer, "Text", $aItems[$iI][0])
  435. _MemWrite($tMemMap, $tItem, $pMemory, $iItem)
  436. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  437. If $bUnicode Then
  438. _SendMessage($hWnd, $LVM_INSERTITEMW, 0, $pMemory, 0, "wparam", "ptr")
  439. Else
  440. _SendMessage($hWnd, $LVM_INSERTITEMA, 0, $pMemory, 0, "wparam", "ptr")
  441. EndIf
  442. For $iJ = 1 To UBound($aItems, $UBOUND_COLUMNS) - 1
  443. DllStructSetData($tItem, "SubItem", $iJ)
  444. DllStructSetData($tBuffer, "Text", $aItems[$iI][$iJ])
  445. _MemWrite($tMemMap, $tItem, $pMemory, $iItem)
  446. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  447. If $bUnicode Then
  448. _SendMessage($hWnd, $LVM_SETITEMW, 0, $pMemory, 0, "wparam", "ptr")
  449. Else
  450. _SendMessage($hWnd, $LVM_SETITEMA, 0, $pMemory, 0, "wparam", "ptr")
  451. EndIf
  452. Next
  453. Next
  454. _MemFree($tMemMap)
  455. EndIf
  456. Else
  457. Local $pItem = DllStructGetPtr($tItem)
  458. For $iI = 0 To UBound($aItems) - 1
  459. DllStructSetData($tItem, "Item", $iI + $iLastItem)
  460. DllStructSetData($tItem, "SubItem", 0)
  461. DllStructSetData($tBuffer, "Text", $aItems[$iI][0])
  462. If $bUnicode Then
  463. GUICtrlSendMsg($hWnd, $LVM_INSERTITEMW, 0, $pItem)
  464. Else
  465. GUICtrlSendMsg($hWnd, $LVM_INSERTITEMA, 0, $pItem)
  466. EndIf
  467. For $iJ = 1 To UBound($aItems, $UBOUND_COLUMNS) - 1
  468. DllStructSetData($tItem, "SubItem", $iJ)
  469. DllStructSetData($tBuffer, "Text", $aItems[$iI][$iJ])
  470. If $bUnicode Then
  471. GUICtrlSendMsg($hWnd, $LVM_SETITEMW, 0, $pItem)
  472. Else
  473. GUICtrlSendMsg($hWnd, $LVM_SETITEMA, 0, $pItem)
  474. EndIf
  475. Next
  476. Next
  477. EndIf
  478. _GUICtrlListView_EndUpdate($hWnd)
  479. EndFunc ;==>_GUICtrlListView_AddArray
  480. ; #FUNCTION# ====================================================================================================================
  481. ; Author ........: Paul Campbell (PaulIA)
  482. ; Modified.......:
  483. ; ===============================================================================================================================
  484. Func _GUICtrlListView_AddColumn($hWnd, $sText, $iWidth = 50, $iAlign = -1, $iImage = -1, $bOnRight = False)
  485. Return _GUICtrlListView_InsertColumn($hWnd, _GUICtrlListView_GetColumnCount($hWnd), $sText, $iWidth, $iAlign, $iImage, $bOnRight)
  486. EndFunc ;==>_GUICtrlListView_AddColumn
  487. ; #FUNCTION# ====================================================================================================================
  488. ; Author ........: Paul Campbell (PaulIA)
  489. ; Modified.......:
  490. ; ===============================================================================================================================
  491. Func _GUICtrlListView_AddItem($hWnd, $sText, $iImage = -1, $iParam = 0)
  492. Return _GUICtrlListView_InsertItem($hWnd, $sText, -1, $iImage, $iParam)
  493. EndFunc ;==>_GUICtrlListView_AddItem
  494. ; #FUNCTION# ====================================================================================================================
  495. ; Author ........: Paul Campbell (PaulIA)
  496. ; Modified.......: Gary Frost (gafrost)
  497. ; ===============================================================================================================================
  498. Func _GUICtrlListView_AddSubItem($hWnd, $iIndex, $sText, $iSubItem, $iImage = -1)
  499. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  500. Local $iBuffer = StringLen($sText) + 1
  501. Local $tBuffer
  502. If $bUnicode Then
  503. $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  504. $iBuffer *= 2
  505. Else
  506. $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
  507. EndIf
  508. Local $pBuffer = DllStructGetPtr($tBuffer)
  509. Local $tItem = DllStructCreate($tagLVITEM)
  510. Local $iMask = $LVIF_TEXT
  511. If $iImage <> -1 Then $iMask = BitOR($iMask, $LVIF_IMAGE)
  512. DllStructSetData($tBuffer, "Text", $sText)
  513. DllStructSetData($tItem, "Mask", $iMask)
  514. DllStructSetData($tItem, "Item", $iIndex)
  515. DllStructSetData($tItem, "SubItem", $iSubItem)
  516. DllStructSetData($tItem, "Image", $iImage)
  517. Local $iRet
  518. If IsHWnd($hWnd) Then
  519. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  520. DllStructSetData($tItem, "Text", $pBuffer)
  521. $iRet = _SendMessage($hWnd, $LVM_SETITEMW, 0, $tItem, 0, "wparam", "struct*")
  522. Else
  523. Local $iItem = DllStructGetSize($tItem)
  524. Local $tMemMap
  525. Local $pMemory = _MemInit($hWnd, $iItem + $iBuffer, $tMemMap)
  526. Local $pText = $pMemory + $iItem
  527. DllStructSetData($tItem, "Text", $pText)
  528. _MemWrite($tMemMap, $tItem, $pMemory, $iItem)
  529. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  530. If $bUnicode Then
  531. $iRet = _SendMessage($hWnd, $LVM_SETITEMW, 0, $pMemory, 0, "wparam", "ptr")
  532. Else
  533. $iRet = _SendMessage($hWnd, $LVM_SETITEMA, 0, $pMemory, 0, "wparam", "ptr")
  534. EndIf
  535. _MemFree($tMemMap)
  536. EndIf
  537. Else
  538. Local $pItem = DllStructGetPtr($tItem)
  539. DllStructSetData($tItem, "Text", $pBuffer)
  540. If $bUnicode Then
  541. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETITEMW, 0, $pItem)
  542. Else
  543. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETITEMA, 0, $pItem)
  544. EndIf
  545. EndIf
  546. Return $iRet <> 0
  547. EndFunc ;==>_GUICtrlListView_AddSubItem
  548. ; #FUNCTION# ====================================================================================================================
  549. ; Author ........: Paul Campbell (PaulIA)
  550. ; Modified.......: Gary Frost (gafrost)
  551. ; ===============================================================================================================================
  552. Func _GUICtrlListView_ApproximateViewHeight($hWnd, $iCount = -1, $iCX = -1, $iCY = -1)
  553. If IsHWnd($hWnd) Then
  554. Return BitShift((_SendMessage($hWnd, $LVM_APPROXIMATEVIEWRECT, $iCount, _WinAPI_MakeLong($iCX, $iCY))), 16)
  555. Else
  556. Return BitShift((GUICtrlSendMsg($hWnd, $LVM_APPROXIMATEVIEWRECT, $iCount, _WinAPI_MakeLong($iCX, $iCY))), 16)
  557. EndIf
  558. EndFunc ;==>_GUICtrlListView_ApproximateViewHeight
  559. ; #FUNCTION# ====================================================================================================================
  560. ; Author ........: Paul Campbell (PaulIA)
  561. ; Modified.......: Gary Frost (gafrost)
  562. ; ===============================================================================================================================
  563. Func _GUICtrlListView_ApproximateViewRect($hWnd, $iCount = -1, $iCX = -1, $iCY = -1)
  564. Local $iView
  565. If IsHWnd($hWnd) Then
  566. $iView = _SendMessage($hWnd, $LVM_APPROXIMATEVIEWRECT, $iCount, _WinAPI_MakeLong($iCX, $iCY))
  567. Else
  568. $iView = GUICtrlSendMsg($hWnd, $LVM_APPROXIMATEVIEWRECT, $iCount, _WinAPI_MakeLong($iCX, $iCY))
  569. EndIf
  570. Local $aView[2]
  571. $aView[0] = BitAND($iView, 0xFFFF)
  572. $aView[1] = BitShift($iView, 16)
  573. Return $aView
  574. EndFunc ;==>_GUICtrlListView_ApproximateViewRect
  575. ; #FUNCTION# ====================================================================================================================
  576. ; Author ........: Paul Campbell (PaulIA)
  577. ; Modified.......: Gary Frost (gafrost)
  578. ; ===============================================================================================================================
  579. Func _GUICtrlListView_ApproximateViewWidth($hWnd, $iCount = -1, $iCX = -1, $iCY = -1)
  580. If IsHWnd($hWnd) Then
  581. Return BitAND((_SendMessage($hWnd, $LVM_APPROXIMATEVIEWRECT, $iCount, _WinAPI_MakeLong($iCX, $iCY))), 0xFFFF)
  582. Else
  583. Return BitAND((GUICtrlSendMsg($hWnd, $LVM_APPROXIMATEVIEWRECT, $iCount, _WinAPI_MakeLong($iCX, $iCY))), 0xFFFF)
  584. EndIf
  585. EndFunc ;==>_GUICtrlListView_ApproximateViewWidth
  586. ; #FUNCTION# ====================================================================================================================
  587. ; Author ........: Paul Campbell (PaulIA)
  588. ; Modified.......: Gary Frost (gafrost)
  589. ; ===============================================================================================================================
  590. Func _GUICtrlListView_Arrange($hWnd, $iArrange = 0)
  591. Local $aArrange[4] = [$LVA_DEFAULT, $LVA_ALIGNLEFT, $LVA_ALIGNTOP, $LVA_SNAPTOGRID]
  592. If IsHWnd($hWnd) Then
  593. Return _SendMessage($hWnd, $LVM_ARRANGE, $aArrange[$iArrange]) <> 0
  594. Else
  595. Return GUICtrlSendMsg($hWnd, $LVM_ARRANGE, $aArrange[$iArrange], 0) <> 0
  596. EndIf
  597. EndFunc ;==>_GUICtrlListView_Arrange
  598. ; #INTERNAL_USE_ONLY#==============================================================================
  599. ; Name...........: __GUICtrlListView_ArrayDelete
  600. ; Description ...: Deletes the specified element from the given array, returning the adjusted array.
  601. ; Syntax.........: __GUICtrlListView_ArrayDelete ( ByRef $avArray, $iElement )
  602. ; Parameters ....: $avArray - The array from which an element is to be deleted
  603. ; $iElement - The index of the element to be deleted
  604. ; Return values .: Success - Returns 1 and the original Array is updated
  605. ; Failure - Returns 0 and the original Array
  606. ; Author ........: Cephas <cephas at clergy dot net>
  607. ; Modified.......: Array is passed via ByRef - Jos van der zande, for exclusive use with listview sort - GaryFrost
  608. ; Remarks .......: For Internal Use Only
  609. ; Related .......:
  610. ; Link ..........:
  611. ; Example .......:
  612. ; ===============================================================================================================================
  613. Func __GUICtrlListView_ArrayDelete(ByRef $avArray, $iElement)
  614. If Not IsArray($avArray) Then Return SetError(1, 0, "")
  615. ; We have to define this here so that we're sure that $avArray is an array
  616. ; before we get it's size.
  617. Local $iUpper = UBound($avArray) ; Size of original array
  618. ; If the array is only 1 element in size then we can't delete the 1 element.
  619. If $iUpper = 1 Then
  620. SetError(2)
  621. Return ""
  622. EndIf
  623. Local $avNewArray[$iUpper - 1][$__LISTVIEWCONSTANT_SORTINFOSIZE]
  624. $avNewArray[0][0] = $avArray[0][0]
  625. If $iElement < 0 Then
  626. $iElement = 0
  627. EndIf
  628. If $iElement > ($iUpper - 1) Then
  629. $iElement = ($iUpper - 1)
  630. EndIf
  631. If $iElement > 0 Then
  632. For $iCntr = 0 To $iElement - 1
  633. For $x = 1 To $__LISTVIEWCONSTANT_SORTINFOSIZE - 1
  634. $avNewArray[$iCntr][$x] = $avArray[$iCntr][$x]
  635. Next
  636. Next
  637. EndIf
  638. If $iElement < ($iUpper - 1) Then
  639. For $iCntr = ($iElement + 1) To ($iUpper - 1)
  640. For $x = 1 To $__LISTVIEWCONSTANT_SORTINFOSIZE - 1
  641. $avNewArray[$iCntr - 1][$x] = $avArray[$iCntr][$x]
  642. Next
  643. Next
  644. EndIf
  645. $avArray = $avNewArray
  646. SetError(0)
  647. Return 1
  648. EndFunc ;==>__GUICtrlListView_ArrayDelete
  649. ; #FUNCTION# ====================================================================================================================
  650. ; Author ........: Paul Campbell (PaulIA)
  651. ; Modified.......: Gary Frost (gafrost)
  652. ; ===============================================================================================================================
  653. Func _GUICtrlListView_BeginUpdate($hWnd)
  654. If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
  655. Return _SendMessage($hWnd, $__LISTVIEWCONSTANT_WM_SETREDRAW, False) = 0
  656. EndFunc ;==>_GUICtrlListView_BeginUpdate
  657. ; #FUNCTION# ====================================================================================================================
  658. ; Author ........: Paul Campbell (PaulIA)
  659. ; Modified.......: Gary Frost (gafrost)
  660. ; ===============================================================================================================================
  661. Func _GUICtrlListView_CancelEditLabel($hWnd)
  662. If IsHWnd($hWnd) Then
  663. _SendMessage($hWnd, $LVM_CANCELEDITLABEL)
  664. Else
  665. GUICtrlSendMsg($hWnd, $LVM_CANCELEDITLABEL, 0, 0)
  666. EndIf
  667. EndFunc ;==>_GUICtrlListView_CancelEditLabel
  668. ; #FUNCTION# ====================================================================================================================
  669. ; Author ........: Paul Campbell (PaulIA)
  670. ; Modified.......: Gary Frost
  671. ; ===============================================================================================================================
  672. Func _GUICtrlListView_ClickItem($hWnd, $iIndex, $sButton = "left", $bMove = False, $iClicks = 1, $iSpeed = 1)
  673. If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
  674. _GUICtrlListView_EnsureVisible($hWnd, $iIndex, False)
  675. Local $tRECT = _GUICtrlListView_GetItemRectEx($hWnd, $iIndex, $LVIR_LABEL)
  676. Local $tPoint = _WinAPI_PointFromRect($tRECT, True)
  677. $tPoint = _WinAPI_ClientToScreen($hWnd, $tPoint)
  678. Local $iX, $iY
  679. _WinAPI_GetXYFromPoint($tPoint, $iX, $iY)
  680. Local $iMode = Opt("MouseCoordMode", 1)
  681. If Not $bMove Then
  682. Local $aPos = MouseGetPos()
  683. _WinAPI_ShowCursor(False)
  684. MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed)
  685. MouseMove($aPos[0], $aPos[1], 0)
  686. _WinAPI_ShowCursor(True)
  687. Else
  688. MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed)
  689. EndIf
  690. Opt("MouseCoordMode", $iMode)
  691. EndFunc ;==>_GUICtrlListView_ClickItem
  692. ; #FUNCTION# ====================================================================================================================
  693. ; Author ........: Gary Frost (gafrost)
  694. ; Modified.......:
  695. ; ===============================================================================================================================
  696. Func _GUICtrlListView_CopyItems($hWnd_Source, $hWnd_Destination, $bDelFlag = False)
  697. Local $a_Indices, $tItem = DllStructCreate($tagLVITEM), $iIndex
  698. Local $iCols = _GUICtrlListView_GetColumnCount($hWnd_Source)
  699. Local $iItems = _GUICtrlListView_GetItemCount($hWnd_Source)
  700. _GUICtrlListView_BeginUpdate($hWnd_Source)
  701. _GUICtrlListView_BeginUpdate($hWnd_Destination)
  702. If BitAND(_GUICtrlListView_GetExtendedListViewStyle($hWnd_Source), $LVS_EX_CHECKBOXES) == $LVS_EX_CHECKBOXES Then
  703. For $i = 0 To $iItems - 1
  704. If (_GUICtrlListView_GetItemChecked($hWnd_Source, $i)) Then
  705. If IsArray($a_Indices) Then
  706. ReDim $a_Indices[UBound($a_Indices) + 1]
  707. Else
  708. Local $a_Indices[2]
  709. EndIf
  710. $a_Indices[0] = $a_Indices[0] + 1
  711. $a_Indices[UBound($a_Indices) - 1] = $i
  712. EndIf
  713. Next
  714. If (IsArray($a_Indices)) Then
  715. For $i = 1 To $a_Indices[0]
  716. DllStructSetData($tItem, "Mask", BitOR($LVIF_GROUPID, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_STATE))
  717. DllStructSetData($tItem, "Item", $a_Indices[$i])
  718. DllStructSetData($tItem, "SubItem", 0)
  719. DllStructSetData($tItem, "StateMask", -1)
  720. _GUICtrlListView_GetItemEx($hWnd_Source, $tItem)
  721. $iIndex = _GUICtrlListView_AddItem($hWnd_Destination, _GUICtrlListView_GetItemText($hWnd_Source, $a_Indices[$i], 0), DllStructGetData($tItem, "Image"))
  722. _GUICtrlListView_SetItemChecked($hWnd_Destination, $iIndex)
  723. For $x = 1 To $iCols - 1
  724. DllStructSetData($tItem, "Item", $a_Indices[$i])
  725. DllStructSetData($tItem, "SubItem", $x)
  726. _GUICtrlListView_GetItemEx($hWnd_Source, $tItem)
  727. _GUICtrlListView_AddSubItem($hWnd_Destination, $iIndex, _GUICtrlListView_GetItemText($hWnd_Source, $a_Indices[$i], $x), $x, DllStructGetData($tItem, "Image"))
  728. Next
  729. ;_GUICtrlListView_SetItemChecked($hWnd_Source, $a_Indices[$i], False)
  730. Next
  731. If $bDelFlag Then
  732. For $i = $a_Indices[0] To 1 Step -1
  733. _GUICtrlListView_DeleteItem($hWnd_Source, $a_Indices[$i])
  734. Next
  735. EndIf
  736. EndIf
  737. EndIf
  738. If (_GUICtrlListView_GetSelectedCount($hWnd_Source)) Then
  739. $a_Indices = _GUICtrlListView_GetSelectedIndices($hWnd_Source, 1)
  740. For $i = 1 To $a_Indices[0]
  741. DllStructSetData($tItem, "Mask", BitOR($LVIF_GROUPID, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_STATE))
  742. DllStructSetData($tItem, "Item", $a_Indices[$i])
  743. DllStructSetData($tItem, "SubItem", 0)
  744. DllStructSetData($tItem, "StateMask", -1)
  745. _GUICtrlListView_GetItemEx($hWnd_Source, $tItem)
  746. $iIndex = _GUICtrlListView_AddItem($hWnd_Destination, _GUICtrlListView_GetItemText($hWnd_Source, $a_Indices[$i], 0), DllStructGetData($tItem, "Image"))
  747. For $x = 1 To $iCols - 1
  748. DllStructSetData($tItem, "Item", $a_Indices[$i])
  749. DllStructSetData($tItem, "SubItem", $x)
  750. _GUICtrlListView_GetItemEx($hWnd_Source, $tItem)
  751. _GUICtrlListView_AddSubItem($hWnd_Destination, $iIndex, _GUICtrlListView_GetItemText($hWnd_Source, $a_Indices[$i], $x), $x, DllStructGetData($tItem, "Image"))
  752. Next
  753. Next
  754. _GUICtrlListView_SetItemSelected($hWnd_Source, -1, False)
  755. If $bDelFlag Then
  756. For $i = $a_Indices[0] To 1 Step -1
  757. _GUICtrlListView_DeleteItem($hWnd_Source, $a_Indices[$i])
  758. Next
  759. EndIf
  760. EndIf
  761. _GUICtrlListView_EndUpdate($hWnd_Source)
  762. _GUICtrlListView_EndUpdate($hWnd_Destination)
  763. EndFunc ;==>_GUICtrlListView_CopyItems
  764. ; #FUNCTION# ====================================================================================================================
  765. ; Author ........: Paul Campbell (PaulIA)
  766. ; Modified.......: Gary Frost
  767. ; ===============================================================================================================================
  768. Func _GUICtrlListView_Create($hWnd, $sHeaderText, $iX, $iY, $iWidth = 150, $iHeight = 150, $iStyle = 0x0000000D, $iExStyle = 0x00000000, $bCoInit = False)
  769. If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0) ; Invalid Window handle for _GUICtrlListViewCreate 1st parameter
  770. If Not IsString($sHeaderText) Then Return SetError(2, 0, 0) ; 2nd parameter not a string for _GUICtrlListViewCreate
  771. If $iWidth = -1 Then $iWidth = 150
  772. If $iHeight = -1 Then $iHeight = 150
  773. If $iStyle = -1 Then $iStyle = $LVS_DEFAULT
  774. If $iExStyle = -1 Then $iExStyle = 0x00000000
  775. Local Const $S_OK = 0x0
  776. Local Const $S_FALSE = 0x1
  777. Local Const $RPC_E_CHANGED_MODE = 0x80010106
  778. Local Const $E_INVALIDARG = 0x80070057
  779. Local Const $E_OUTOFMEMORY = 0x8007000E
  780. Local Const $E_UNEXPECTED = 0x8000FFFF
  781. Local $sSeparatorChar = Opt('GUIDataSeparatorChar')
  782. ;======================================
  783. Local Const $COINIT_APARTMENTTHREADED = 0x02
  784. ;======================================
  785. Local $iStr_len = StringLen($sHeaderText)
  786. If $iStr_len Then $sHeaderText = StringSplit($sHeaderText, $sSeparatorChar)
  787. $iStyle = BitOR($__UDFGUICONSTANT_WS_CHILD, $__UDFGUICONSTANT_WS_VISIBLE, $iStyle)
  788. ;=========================================================================================================
  789. If $bCoInit Then
  790. Local $aResult = DllCall('ole32.dll', 'long', 'CoInitializeEx', 'ptr', 0, 'dword', $COINIT_APARTMENTTHREADED)
  791. If @error Then Return SetError(@error, @extended, 0)
  792. Switch $aResult[0]
  793. Case $S_OK
  794. Case $S_FALSE
  795. Case $RPC_E_CHANGED_MODE
  796. ; "-->or the thread that called CoInitializeEx currently belongs to the neutral threaded apartment.")
  797. Case $E_INVALIDARG
  798. Case $E_OUTOFMEMORY
  799. Case $E_UNEXPECTED
  800. EndSwitch
  801. EndIf
  802. ;=========================================================================================================
  803. Local $nCtrlID = __UDF_GetNextGlobalID($hWnd)
  804. If @error Then Return SetError(@error, @extended, 0)
  805. Local $hList = _WinAPI_CreateWindowEx($iExStyle, $__LISTVIEWCONSTANT_ClassName, "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $nCtrlID)
  806. _SendMessage($hList, $__LISTVIEWCONSTANT_WM_SETFONT, _WinAPI_GetStockObject($__LISTVIEWCONSTANT_DEFAULT_GUI_FONT), True)
  807. If $iStr_len Then
  808. For $x = 1 To $sHeaderText[0]
  809. _GUICtrlListView_InsertColumn($hList, $x - 1, $sHeaderText[$x], 75)
  810. Next
  811. EndIf
  812. Return $hList
  813. EndFunc ;==>_GUICtrlListView_Create
  814. ; #FUNCTION# ====================================================================================================================
  815. ; Author ........: Paul Campbell (PaulIA)
  816. ; Modified.......: Gary Frost (gafrost)
  817. ; ===============================================================================================================================
  818. Func _GUICtrlListView_CreateDragImage($hWnd, $iIndex)
  819. Local $aDrag[3]
  820. Local $tPoint = DllStructCreate($tagPOINT)
  821. If IsHWnd($hWnd) Then
  822. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  823. $aDrag[0] = _SendMessage($hWnd, $LVM_CREATEDRAGIMAGE, $iIndex, $tPoint, 0, "wparam", "struct*", "handle")
  824. Else
  825. Local $iPoint = DllStructGetSize($tPoint)
  826. Local $tMemMap
  827. Local $pMemory = _MemInit($hWnd, $iPoint, $tMemMap)
  828. $aDrag[0] = _SendMessage($hWnd, $LVM_CREATEDRAGIMAGE, $iIndex, $pMemory, 0, "wparam", "ptr", "handle")
  829. _MemRead($tMemMap, $pMemory, $tPoint, $iPoint)
  830. _MemFree($tMemMap)
  831. EndIf
  832. Else
  833. $aDrag[0] = Ptr(GUICtrlSendMsg($hWnd, $LVM_CREATEDRAGIMAGE, $iIndex, DllStructGetPtr($tPoint)))
  834. EndIf
  835. $aDrag[1] = DllStructGetData($tPoint, "X")
  836. $aDrag[2] = DllStructGetData($tPoint, "Y")
  837. Return $aDrag
  838. EndFunc ;==>_GUICtrlListView_CreateDragImage
  839. ; #FUNCTION# ====================================================================================================================
  840. ; Author ........: Gary Frost (gafrost)
  841. ; Modified.......:
  842. ; ===============================================================================================================================
  843. Func _GUICtrlListView_CreateSolidBitMap($hWnd, $iColor, $iWidth, $iHeight)
  844. If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
  845. Return _WinAPI_CreateSolidBitmap($hWnd, $iColor, $iWidth, $iHeight)
  846. EndFunc ;==>_GUICtrlListView_CreateSolidBitMap
  847. ; #FUNCTION# ====================================================================================================================
  848. ; Author ........: Gary Frost (gafrost)
  849. ; Modified.......: Melba23
  850. ; ===============================================================================================================================
  851. Func _GUICtrlListView_DeleteAllItems($hWnd)
  852. ; Check if deletion necessary
  853. If _GUICtrlListView_GetItemCount($hWnd) = 0 Then Return True
  854. ; Determine ListView type
  855. Local $vCID = 0
  856. If IsHWnd($hWnd) Then
  857. ; Check ListView ControlID to detect UDF control
  858. $vCID = _WinAPI_GetDlgCtrlID($hWnd)
  859. Else
  860. $vCID = $hWnd
  861. ; Get ListView handle
  862. $hWnd = GUICtrlGetHandle($hWnd)
  863. EndIf
  864. ; If native ListView - could be either type of item
  865. If $vCID < $_UDF_STARTID Then
  866. ; Try deleting as native items
  867. Local $iParam = 0
  868. For $iIndex = _GUICtrlListView_GetItemCount($hWnd) - 1 To 0 Step -1
  869. $iParam = _GUICtrlListView_GetItemParam($hWnd, $iIndex)
  870. ; Check if LV item
  871. If GUICtrlGetState($iParam) > 0 And GUICtrlGetHandle($iParam) = 0 Then
  872. GUICtrlDelete($iParam)
  873. EndIf
  874. Next
  875. ; Return if no items left
  876. If _GUICtrlListView_GetItemCount($hWnd) = 0 Then Return True
  877. EndIf
  878. ; Has to be UDF Listview and/or UDF items
  879. Return _SendMessage($hWnd, $LVM_DELETEALLITEMS) <> 0
  880. EndFunc ;==>_GUICtrlListView_DeleteAllItems
  881. ; #FUNCTION# ====================================================================================================================
  882. ; Author ........: Gary Frost (gafrost)
  883. ; Modified.......:
  884. ; ===============================================================================================================================
  885. Func _GUICtrlListView_DeleteColumn($hWnd, $iCol)
  886. If IsHWnd($hWnd) Then
  887. Return _SendMessage($hWnd, $LVM_DELETECOLUMN, $iCol) <> 0
  888. Else
  889. Return GUICtrlSendMsg($hWnd, $LVM_DELETECOLUMN, $iCol, 0) <> 0
  890. EndIf
  891. EndFunc ;==>_GUICtrlListView_DeleteColumn
  892. ; #FUNCTION# ====================================================================================================================
  893. ; Author ........: Gary Frost (gafrost)
  894. ; Modified.......: Melba23
  895. ; ===============================================================================================================================
  896. Func _GUICtrlListView_DeleteItem($hWnd, $iIndex)
  897. ; Determine ListView type
  898. Local $vCID = 0
  899. If IsHWnd($hWnd) Then
  900. ; Check if the ListView has a ControlID
  901. $vCID = _WinAPI_GetDlgCtrlID($hWnd)
  902. Else
  903. $vCID = $hWnd
  904. ; Get ListView handle
  905. $hWnd = GUICtrlGetHandle($hWnd)
  906. EndIf
  907. ; If native ListView - could be either type of item
  908. If $vCID < $_UDF_STARTID Then
  909. ; Try deleting as native item
  910. Local $iParam = _GUICtrlListView_GetItemParam($hWnd, $iIndex)
  911. ; Check if LV item
  912. If GUICtrlGetState($iParam) > 0 And GUICtrlGetHandle($iParam) = 0 Then
  913. If GUICtrlDelete($iParam) Then
  914. Return True
  915. EndIf
  916. EndIf
  917. EndIf
  918. ; Has to be UDF Listview and/or UDF item
  919. Return _SendMessage($hWnd, $LVM_DELETEITEM, $iIndex) <> 0
  920. EndFunc ;==>_GUICtrlListView_DeleteItem
  921. ; #FUNCTION# ====================================================================================================================
  922. ; Author ........: Gary Frost (gafrost)
  923. ; Modified.......: Melba23
  924. ; ===============================================================================================================================
  925. Func _GUICtrlListView_DeleteItemsSelected($hWnd)
  926. Local $iItemCount = _GUICtrlListView_GetItemCount($hWnd)
  927. ; Delete all?
  928. If _GUICtrlListView_GetSelectedCount($hWnd) = $iItemCount Then
  929. Return _GUICtrlListView_DeleteAllItems($hWnd)
  930. Else
  931. Local $aSelected = _GUICtrlListView_GetSelectedIndices($hWnd, True)
  932. If Not IsArray($aSelected) Then Return SetError($LV_ERR, $LV_ERR, 0)
  933. ; Unselect all items
  934. _GUICtrlListView_SetItemSelected($hWnd, -1, False)
  935. ; Determine ListView type
  936. Local $vCID = 0, $iNative_Delete, $iUDF_Delete
  937. If IsHWnd($hWnd) Then
  938. ; Check if the ListView has a ControlID
  939. $vCID = _WinAPI_GetDlgCtrlID($hWnd)
  940. Else
  941. $vCID = $hWnd
  942. ; Get ListView handle
  943. $hWnd = GUICtrlGetHandle($hWnd)
  944. EndIf
  945. ; Loop through items
  946. For $iIndex = $aSelected[0] To 1 Step -1
  947. ; If native ListView - could be either type of item
  948. If $vCID < $_UDF_STARTID Then
  949. ; Try deleting as native item
  950. Local $iParam = _GUICtrlListView_GetItemParam($hWnd, $aSelected[$iIndex])
  951. ; Check if LV item
  952. If GUICtrlGetState($iParam) > 0 And GUICtrlGetHandle($iParam) = 0 Then
  953. ; Delete native item
  954. $iNative_Delete = GUICtrlDelete($iParam)
  955. ; If deletion successful move to next
  956. If $iNative_Delete Then ContinueLoop
  957. EndIf
  958. EndIf
  959. ; Has to be UDF Listview and/or UDF item
  960. $iUDF_Delete = _SendMessage($hWnd, $LVM_DELETEITEM, $aSelected[$iIndex])
  961. ; Check for failed deletion
  962. If $iNative_Delete + $iUDF_Delete = 0 Then
  963. ; $iIndex will be > 0
  964. ExitLoop
  965. EndIf
  966. Next
  967. ; If all deleted return True; else return False
  968. Return Not $iIndex
  969. EndIf
  970. EndFunc ;==>_GUICtrlListView_DeleteItemsSelected
  971. ; #FUNCTION# ====================================================================================================================
  972. ; Author ........: Gary Frost (gafrost)
  973. ; Modified.......:
  974. ; ===============================================================================================================================
  975. Func _GUICtrlListView_Destroy(ByRef $hWnd)
  976. If Not _WinAPI_IsClassName($hWnd, $__LISTVIEWCONSTANT_ClassName) Then Return SetError(2, 2, False)
  977. Local $iDestroyed = 0
  978. If IsHWnd($hWnd) Then
  979. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  980. Local $nCtrlID = _WinAPI_GetDlgCtrlID($hWnd)
  981. Local $hParent = _WinAPI_GetParent($hWnd)
  982. $iDestroyed = _WinAPI_DestroyWindow($hWnd)
  983. Local $iRet = __UDF_FreeGlobalID($hParent, $nCtrlID)
  984. If Not $iRet Then
  985. ; can check for errors here if needed, for debug
  986. EndIf
  987. Else
  988. ; Not Allowed to Destroy Other Applications Control(s)
  989. Return SetError(1, 1, False)
  990. EndIf
  991. Else
  992. $iDestroyed = GUICtrlDelete($hWnd)
  993. EndIf
  994. If $iDestroyed Then $hWnd = 0
  995. Return $iDestroyed <> 0
  996. EndFunc ;==>_GUICtrlListView_Destroy
  997. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  998. ; Name...........: __GUICtrlListView_Draw
  999. ; Description ...: Draws an image list item in the specified device context
  1000. ; Syntax.........: __GUICtrlListView_Draw ($hWnd, $iIndex, $hDC, $iX, $iY [, $iStyle=0] )
  1001. ; Parameters ....: $hWnd - Handle to the control
  1002. ; $iIndex - Zero based index of the image to draw
  1003. ; $hDC - Handle to the destination device context
  1004. ; $iX - X coordinate where the image will be drawn
  1005. ; $iY - Y coordinate where the image will be drawn
  1006. ; $iStyle - Drawing style and overlay image:
  1007. ; |1 - Draws the image transparently using the mask, regardless of the background color
  1008. ; |2 - Draws the image, blending 25 percent with the system highlight color
  1009. ; |4 - Draws the image, blending 50 percent with the system highlight color
  1010. ; |8 - Draws the mask
  1011. ; Return values .: Success - True
  1012. ; Failure - False
  1013. ; Author ........: Paul Campbell (PaulIA)
  1014. ; Modified.......:
  1015. ; Remarks .......:
  1016. ; Related .......:
  1017. ; Link ..........:
  1018. ; Example .......: Yes
  1019. ; ===============================================================================================================================
  1020. Func __GUICtrlListView_Draw($hWnd, $iIndex, $hDC, $iX, $iY, $iStyle = 0)
  1021. Local $iFlags = 0
  1022. If BitAND($iStyle, 1) <> 0 Then $iFlags = BitOR($iFlags, $__LISTVIEWCONSTANT_ILD_TRANSPARENT)
  1023. If BitAND($iStyle, 2) <> 0 Then $iFlags = BitOR($iFlags, $__LISTVIEWCONSTANT_ILD_BLEND25)
  1024. If BitAND($iStyle, 4) <> 0 Then $iFlags = BitOR($iFlags, $__LISTVIEWCONSTANT_ILD_BLEND50)
  1025. If BitAND($iStyle, 8) <> 0 Then $iFlags = BitOR($iFlags, $__LISTVIEWCONSTANT_ILD_MASK)
  1026. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_Draw", "handle", $hWnd, "int", $iIndex, "handle", $hDC, "int", $iX, "int", $iY, "uint", $iFlags)
  1027. If @error Then Return SetError(@error, @extended, False)
  1028. Return $aResult[0]
  1029. EndFunc ;==>__GUICtrlListView_Draw
  1030. ; #FUNCTION# ====================================================================================================================
  1031. ; Author ........: Paul Campbell (PaulIA)
  1032. ; Modified.......: Gary Frost (gafrost)
  1033. ; ===============================================================================================================================
  1034. Func _GUICtrlListView_DrawDragImage(ByRef $hWnd, ByRef $aDrag)
  1035. Local $hDC = _WinAPI_GetWindowDC($hWnd)
  1036. Local $tPoint = _WinAPI_GetMousePos(True, $hWnd)
  1037. _WinAPI_InvalidateRect($hWnd)
  1038. __GUICtrlListView_Draw($aDrag[0], 0, $hDC, DllStructGetData($tPoint, "X"), DllStructGetData($tPoint, "Y"))
  1039. _WinAPI_ReleaseDC($hWnd, $hDC)
  1040. EndFunc ;==>_GUICtrlListView_DrawDragImage
  1041. ; #FUNCTION# ====================================================================================================================
  1042. ; Author ........: Paul Campbell (PaulIA)
  1043. ; Modified.......: Gary Frost (gafrost)
  1044. ; ===============================================================================================================================
  1045. Func _GUICtrlListView_EditLabel($hWnd, $iIndex)
  1046. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  1047. Local $aResult
  1048. If IsHWnd($hWnd) Then
  1049. $aResult = DllCall("user32.dll", "hwnd", "SetFocus", "hwnd", $hWnd)
  1050. If @error Then Return SetError(@error, @extended, 0)
  1051. If $aResult = 0 Then Return 0
  1052. If $bUnicode Then
  1053. Return _SendMessage($hWnd, $LVM_EDITLABELW, $iIndex, 0, 0, "wparam", "lparam", "hwnd")
  1054. Else
  1055. Return _SendMessage($hWnd, $LVM_EDITLABEL, $iIndex, 0, 0, "wparam", "lparam", "hwnd")
  1056. EndIf
  1057. Else
  1058. $aResult = DllCall("user32.dll", "hwnd", "SetFocus", "hwnd", GUICtrlGetHandle($hWnd))
  1059. If @error Then Return SetError(@error, @extended, 0)
  1060. If $aResult = 0 Then Return 0
  1061. If $bUnicode Then
  1062. Return HWnd(GUICtrlSendMsg($hWnd, $LVM_EDITLABELW, $iIndex, 0))
  1063. Else
  1064. Return HWnd(GUICtrlSendMsg($hWnd, $LVM_EDITLABEL, $iIndex, 0))
  1065. EndIf
  1066. EndIf
  1067. EndFunc ;==>_GUICtrlListView_EditLabel
  1068. ; #FUNCTION# ====================================================================================================================
  1069. ; Author ........: Paul Campbell (PaulIA)
  1070. ; Modified.......: Gary Frost (gafrost)
  1071. ; ===============================================================================================================================
  1072. Func _GUICtrlListView_EnableGroupView($hWnd, $bEnable = True)
  1073. If IsHWnd($hWnd) Then
  1074. Return _SendMessage($hWnd, $LVM_ENABLEGROUPVIEW, $bEnable)
  1075. Else
  1076. Return GUICtrlSendMsg($hWnd, $LVM_ENABLEGROUPVIEW, $bEnable, 0)
  1077. EndIf
  1078. EndFunc ;==>_GUICtrlListView_EnableGroupView
  1079. ; #FUNCTION# ====================================================================================================================
  1080. ; Author ........: Paul Campbell (PaulIA)
  1081. ; Modified.......: Gary Frost (gafrost)
  1082. ; ===============================================================================================================================
  1083. Func _GUICtrlListView_EndUpdate($hWnd)
  1084. If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
  1085. Return _SendMessage($hWnd, $__LISTVIEWCONSTANT_WM_SETREDRAW, True) = 0
  1086. EndFunc ;==>_GUICtrlListView_EndUpdate
  1087. ; #FUNCTION# ====================================================================================================================
  1088. ; Author ........: Gary Frost (gafrost)
  1089. ; Modified.......:
  1090. ; ===============================================================================================================================
  1091. Func _GUICtrlListView_EnsureVisible($hWnd, $iIndex, $bPartialOK = False)
  1092. If IsHWnd($hWnd) Then
  1093. Return _SendMessage($hWnd, $LVM_ENSUREVISIBLE, $iIndex, $bPartialOK)
  1094. Else
  1095. Return GUICtrlSendMsg($hWnd, $LVM_ENSUREVISIBLE, $iIndex, $bPartialOK)
  1096. EndIf
  1097. EndFunc ;==>_GUICtrlListView_EnsureVisible
  1098. ; #FUNCTION# ====================================================================================================================
  1099. ; Author ........: Paul Campbell (PaulIA)
  1100. ; Modified.......: Gary Frost (added reverse search)
  1101. ; ===============================================================================================================================
  1102. Func _GUICtrlListView_FindInText($hWnd, $sText, $iStart = -1, $bWrapOK = True, $bReverse = False)
  1103. Local $iCount = _GUICtrlListView_GetItemCount($hWnd)
  1104. Local $iColumns = _GUICtrlListView_GetColumnCount($hWnd)
  1105. If $iColumns = 0 Then $iColumns = 1
  1106. If $bReverse And $iStart = -1 Then Return -1
  1107. Local $sList
  1108. If $bReverse Then
  1109. For $iI = $iStart - 1 To 0 Step -1
  1110. For $iJ = 0 To $iColumns - 1
  1111. $sList = _GUICtrlListView_GetItemText($hWnd, $iI, $iJ)
  1112. If StringInStr($sList, $sText) Then Return $iI
  1113. Next
  1114. Next
  1115. Else
  1116. For $iI = $iStart + 1 To $iCount - 1
  1117. For $iJ = 0 To $iColumns - 1
  1118. $sList = _GUICtrlListView_GetItemText($hWnd, $iI, $iJ)
  1119. If StringInStr($sList, $sText) Then Return $iI
  1120. Next
  1121. Next
  1122. EndIf
  1123. If (($iStart = -1) Or Not $bWrapOK) And Not $bReverse Then Return -1
  1124. If $bReverse And $bWrapOK Then
  1125. For $iI = $iCount - 1 To $iStart + 1 Step -1
  1126. For $iJ = 0 To $iColumns - 1
  1127. $sList = _GUICtrlListView_GetItemText($hWnd, $iI, $iJ)
  1128. If StringInStr($sList, $sText) Then Return $iI
  1129. Next
  1130. Next
  1131. Else
  1132. For $iI = 0 To $iStart - 1
  1133. For $iJ = 0 To $iColumns - 1
  1134. $sList = _GUICtrlListView_GetItemText($hWnd, $iI, $iJ)
  1135. If StringInStr($sList, $sText) Then Return $iI
  1136. Next
  1137. Next
  1138. EndIf
  1139. Return -1
  1140. EndFunc ;==>_GUICtrlListView_FindInText
  1141. ; #FUNCTION# ====================================================================================================================
  1142. ; Author ........: Paul Campbell (PaulIA)
  1143. ; Modified.......: Gary Frost (gafrost)
  1144. ; ===============================================================================================================================
  1145. Func _GUICtrlListView_FindItem($hWnd, $iStart, ByRef $tFindInfo, $sText = "")
  1146. Local $iBuffer = StringLen($sText) + 1
  1147. Local $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
  1148. Local $pBuffer = DllStructGetPtr($tBuffer)
  1149. DllStructSetData($tBuffer, "Text", $sText)
  1150. Local $iRet
  1151. If IsHWnd($hWnd) Then
  1152. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1153. DllStructSetData($tFindInfo, "Text", $pBuffer)
  1154. $iRet = _SendMessage($hWnd, $LVM_FINDITEM, $iStart, $tFindInfo, 0, "wparam", "struct*")
  1155. Else
  1156. Local $iFindInfo = DllStructGetSize($tFindInfo)
  1157. Local $tMemMap
  1158. Local $pMemory = _MemInit($hWnd, $iFindInfo + $iBuffer, $tMemMap)
  1159. Local $pText = $pMemory + $iFindInfo
  1160. DllStructSetData($tFindInfo, "Text", $pText)
  1161. _MemWrite($tMemMap, $tFindInfo, $pMemory, $iFindInfo)
  1162. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  1163. $iRet = _SendMessage($hWnd, $LVM_FINDITEM, $iStart, $pMemory, 0, "wparam", "ptr")
  1164. _MemFree($tMemMap)
  1165. EndIf
  1166. Else
  1167. DllStructSetData($tFindInfo, "Text", $pBuffer)
  1168. $iRet = GUICtrlSendMsg($hWnd, $LVM_FINDITEM, $iStart, DllStructGetPtr($tFindInfo))
  1169. EndIf
  1170. Return $iRet
  1171. EndFunc ;==>_GUICtrlListView_FindItem
  1172. ; #FUNCTION# ====================================================================================================================
  1173. ; Author ........: Paul Campbell (PaulIA)
  1174. ; Modified.......:
  1175. ; ===============================================================================================================================
  1176. Func _GUICtrlListView_FindNearest($hWnd, $iX, $iY, $iDir = 0, $iStart = -1, $bWrapOK = True)
  1177. Local $aDir[8] = [$__LISTVIEWCONSTANT_VK_LEFT, $__LISTVIEWCONSTANT_VK_RIGHT, $__LISTVIEWCONSTANT_VK_UP, $__LISTVIEWCONSTANT_VK_DOWN, $__LISTVIEWCONSTANT_VK_HOME, $__LISTVIEWCONSTANT_VK_END, $__LISTVIEWCONSTANT_VK_PRIOR, $__LISTVIEWCONSTANT_VK_NEXT]
  1178. Local $tFindInfo = DllStructCreate($tagLVFINDINFO)
  1179. Local $iFlags = $LVFI_NEARESTXY
  1180. If $bWrapOK Then $iFlags = BitOR($iFlags, $LVFI_WRAP)
  1181. DllStructSetData($tFindInfo, "Flags", $iFlags)
  1182. DllStructSetData($tFindInfo, "X", $iX)
  1183. DllStructSetData($tFindInfo, "Y", $iY)
  1184. DllStructSetData($tFindInfo, "Direction", $aDir[$iDir])
  1185. Return _GUICtrlListView_FindItem($hWnd, $iStart, $tFindInfo)
  1186. EndFunc ;==>_GUICtrlListView_FindNearest
  1187. ; #FUNCTION# ====================================================================================================================
  1188. ; Author ........: Paul Campbell (PaulIA)
  1189. ; Modified.......:
  1190. ; ===============================================================================================================================
  1191. Func _GUICtrlListView_FindParam($hWnd, $iParam, $iStart = -1)
  1192. Local $tFindInfo = DllStructCreate($tagLVFINDINFO)
  1193. DllStructSetData($tFindInfo, "Flags", $LVFI_PARAM)
  1194. DllStructSetData($tFindInfo, "Param", $iParam)
  1195. Return _GUICtrlListView_FindItem($hWnd, $iStart, $tFindInfo)
  1196. EndFunc ;==>_GUICtrlListView_FindParam
  1197. ; #FUNCTION# ====================================================================================================================
  1198. ; Author ........: Paul Campbell (PaulIA)
  1199. ; Modified.......:
  1200. ; ===============================================================================================================================
  1201. Func _GUICtrlListView_FindText($hWnd, $sText, $iStart = -1, $bPartialOK = True, $bWrapOK = True)
  1202. Local $tFindInfo = DllStructCreate($tagLVFINDINFO)
  1203. Local $iFlags = $LVFI_STRING
  1204. If $bPartialOK Then $iFlags = BitOR($iFlags, $LVFI_PARTIAL)
  1205. If $bWrapOK Then $iFlags = BitOR($iFlags, $LVFI_WRAP)
  1206. DllStructSetData($tFindInfo, "Flags", $iFlags)
  1207. Return _GUICtrlListView_FindItem($hWnd, $iStart, $tFindInfo, $sText)
  1208. EndFunc ;==>_GUICtrlListView_FindText
  1209. ; #FUNCTION# ====================================================================================================================
  1210. ; Author ........: Gary Frost (gafrost)
  1211. ; Modified.......:
  1212. ; ===============================================================================================================================
  1213. Func _GUICtrlListView_GetBkColor($hWnd)
  1214. Local $i_Color
  1215. If IsHWnd($hWnd) Then
  1216. $i_Color = _SendMessage($hWnd, $LVM_GETBKCOLOR)
  1217. Else
  1218. $i_Color = GUICtrlSendMsg($hWnd, $LVM_GETBKCOLOR, 0, 0)
  1219. EndIf
  1220. Return __GUICtrlListView_ReverseColorOrder($i_Color)
  1221. EndFunc ;==>_GUICtrlListView_GetBkColor
  1222. ; #FUNCTION# ====================================================================================================================
  1223. ; Author ........: Paul Campbell (PaulIA)
  1224. ; Modified.......: Gary Frost (gafrost)
  1225. ; ===============================================================================================================================
  1226. Func _GUICtrlListView_GetBkImage($hWnd)
  1227. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  1228. Local $tBuffer
  1229. If $bUnicode Then
  1230. $tBuffer = DllStructCreate("wchar Text[4096]")
  1231. Else
  1232. $tBuffer = DllStructCreate("char Text[4096]")
  1233. EndIf
  1234. Local $pBuffer = DllStructGetPtr($tBuffer)
  1235. Local $tImage = DllStructCreate($tagLVBKIMAGE)
  1236. DllStructSetData($tImage, "ImageMax", 4096)
  1237. Local $iRet
  1238. If IsHWnd($hWnd) Then
  1239. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1240. DllStructSetData($tImage, "Image", $pBuffer)
  1241. $iRet = _SendMessage($hWnd, $LVM_GETBKIMAGEW, 0, $tImage, 0, "wparam", "struct*")
  1242. Else
  1243. Local $iBuffer = DllStructGetSize($tBuffer)
  1244. Local $iImage = DllStructGetSize($tImage)
  1245. Local $tMemMap
  1246. Local $pMemory = _MemInit($hWnd, $iImage + $iBuffer, $tMemMap)
  1247. Local $pText = $pMemory + $iImage
  1248. DllStructSetData($tImage, "Image", $pText)
  1249. _MemWrite($tMemMap, $tImage, $pMemory, $iImage)
  1250. If $bUnicode Then
  1251. $iRet = _SendMessage($hWnd, $LVM_GETBKIMAGEW, 0, $pMemory, 0, "wparam", "ptr")
  1252. Else
  1253. $iRet = _SendMessage($hWnd, $LVM_GETBKIMAGEA, 0, $pMemory, 0, "wparam", "ptr")
  1254. EndIf
  1255. _MemRead($tMemMap, $pMemory, $tImage, $iImage)
  1256. _MemRead($tMemMap, $pText, $tBuffer, $iBuffer)
  1257. _MemFree($tMemMap)
  1258. EndIf
  1259. Else
  1260. Local $pImage = DllStructGetPtr($tImage)
  1261. DllStructSetData($tImage, "Image", $pBuffer)
  1262. If $bUnicode Then
  1263. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETBKIMAGEW, 0, $pImage)
  1264. Else
  1265. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETBKIMAGEA, 0, $pImage)
  1266. EndIf
  1267. EndIf
  1268. Local $aImage[4]
  1269. Switch BitAND(DllStructGetData($tImage, "Flags"), $LVBKIF_SOURCE_MASK)
  1270. Case $LVBKIF_SOURCE_HBITMAP
  1271. $aImage[0] = 1
  1272. Case $LVBKIF_SOURCE_URL
  1273. $aImage[0] = 2
  1274. EndSwitch
  1275. $aImage[1] = DllStructGetData($tBuffer, "Text")
  1276. $aImage[2] = DllStructGetData($tImage, "XOffPercent")
  1277. $aImage[3] = DllStructGetData($tImage, "YOffPercent")
  1278. Return SetError($iRet <> 0, 0, $aImage)
  1279. EndFunc ;==>_GUICtrlListView_GetBkImage
  1280. ; #FUNCTION# ====================================================================================================================
  1281. ; Author ........: Paul Campbell (PaulIA)
  1282. ; Modified.......:
  1283. ; ===============================================================================================================================
  1284. Func _GUICtrlListView_GetCallbackMask($hWnd)
  1285. Local $iFlags = 0
  1286. Local $iMask = _SendMessage($hWnd, $LVM_GETCALLBACKMASK)
  1287. If BitAND($iMask, $LVIS_CUT) <> 0 Then $iFlags = BitOR($iFlags, 1)
  1288. If BitAND($iMask, $LVIS_DROPHILITED) <> 0 Then $iFlags = BitOR($iFlags, 2)
  1289. If BitAND($iMask, $LVIS_FOCUSED) <> 0 Then $iFlags = BitOR($iFlags, 4)
  1290. If BitAND($iMask, $LVIS_SELECTED) <> 0 Then $iFlags = BitOR($iFlags, 8)
  1291. If BitAND($iMask, $LVIS_OVERLAYMASK) <> 0 Then $iFlags = BitOR($iFlags, 16)
  1292. If BitAND($iMask, $LVIS_STATEIMAGEMASK) <> 0 Then $iFlags = BitOR($iFlags, 32)
  1293. Return $iFlags
  1294. EndFunc ;==>_GUICtrlListView_GetCallbackMask
  1295. ; #FUNCTION# ====================================================================================================================
  1296. ; Author ........: Paul Campbell (PaulIA)
  1297. ; Modified.......: Gary Frost (gafrost)
  1298. ; ===============================================================================================================================
  1299. Func _GUICtrlListView_GetColumn($hWnd, $iIndex)
  1300. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  1301. Local $tBuffer
  1302. If $bUnicode Then
  1303. $tBuffer = DllStructCreate("wchar Text[4096]")
  1304. Else
  1305. $tBuffer = DllStructCreate("char Text[4096]")
  1306. EndIf
  1307. Local $pBuffer = DllStructGetPtr($tBuffer)
  1308. Local $tColumn = DllStructCreate($tagLVCOLUMN)
  1309. DllStructSetData($tColumn, "Mask", $LVCF_ALLDATA)
  1310. DllStructSetData($tColumn, "TextMax", 4096)
  1311. Local $iRet
  1312. If IsHWnd($hWnd) Then
  1313. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1314. DllStructSetData($tColumn, "Text", $pBuffer)
  1315. $iRet = _SendMessage($hWnd, $LVM_GETCOLUMNW, $iIndex, $tColumn, 0, "wparam", "struct*")
  1316. Else
  1317. Local $iBuffer = DllStructGetSize($tBuffer)
  1318. Local $iColumn = DllStructGetSize($tColumn)
  1319. Local $tMemMap
  1320. Local $pMemory = _MemInit($hWnd, $iColumn + $iBuffer, $tMemMap)
  1321. Local $pText = $pMemory + $iColumn
  1322. DllStructSetData($tColumn, "Text", $pText)
  1323. _MemWrite($tMemMap, $tColumn, $pMemory, $iColumn)
  1324. If $bUnicode Then
  1325. $iRet = _SendMessage($hWnd, $LVM_GETCOLUMNW, $iIndex, $pMemory, 0, "wparam", "ptr")
  1326. Else
  1327. $iRet = _SendMessage($hWnd, $LVM_GETCOLUMNA, $iIndex, $pMemory, 0, "wparam", "ptr")
  1328. EndIf
  1329. _MemRead($tMemMap, $pMemory, $tColumn, $iColumn)
  1330. _MemRead($tMemMap, $pText, $tBuffer, $iBuffer)
  1331. _MemFree($tMemMap)
  1332. EndIf
  1333. Else
  1334. Local $pColumn = DllStructGetPtr($tColumn)
  1335. DllStructSetData($tColumn, "Text", $pBuffer)
  1336. If $bUnicode Then
  1337. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETCOLUMNW, $iIndex, $pColumn)
  1338. Else
  1339. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETCOLUMNA, $iIndex, $pColumn)
  1340. EndIf
  1341. EndIf
  1342. Local $aColumn[9]
  1343. Switch BitAND(DllStructGetData($tColumn, "Fmt"), $LVCFMT_JUSTIFYMASK)
  1344. Case $LVCFMT_RIGHT
  1345. $aColumn[0] = 1
  1346. Case $LVCFMT_CENTER
  1347. $aColumn[0] = 2
  1348. Case Else
  1349. $aColumn[0] = 0
  1350. EndSwitch
  1351. $aColumn[1] = BitAND(DllStructGetData($tColumn, "Fmt"), $LVCFMT_IMAGE) <> 0
  1352. $aColumn[2] = BitAND(DllStructGetData($tColumn, "Fmt"), $LVCFMT_BITMAP_ON_RIGHT) <> 0
  1353. $aColumn[3] = BitAND(DllStructGetData($tColumn, "Fmt"), $LVCFMT_COL_HAS_IMAGES) <> 0
  1354. $aColumn[4] = DllStructGetData($tColumn, "CX")
  1355. $aColumn[5] = DllStructGetData($tBuffer, "Text")
  1356. $aColumn[6] = DllStructGetData($tColumn, "SubItem")
  1357. $aColumn[7] = DllStructGetData($tColumn, "Image")
  1358. $aColumn[8] = DllStructGetData($tColumn, "Order")
  1359. Return SetError($iRet = 0, 0, $aColumn)
  1360. EndFunc ;==>_GUICtrlListView_GetColumn
  1361. ; #FUNCTION# ====================================================================================================================
  1362. ; Author ........: Gary Frost (gafrost)
  1363. ; Modified.......:
  1364. ; ===============================================================================================================================
  1365. Func _GUICtrlListView_GetColumnCount($hWnd)
  1366. ;Local Const $HDM_GETITEMCOUNT = 0x1200
  1367. Return _SendMessage(_GUICtrlListView_GetHeader($hWnd), 0x1200)
  1368. EndFunc ;==>_GUICtrlListView_GetColumnCount
  1369. ; #FUNCTION# ====================================================================================================================
  1370. ; Author ........: Gary Frost (gafrost)
  1371. ; Modified.......:
  1372. ; ===============================================================================================================================
  1373. Func _GUICtrlListView_GetColumnOrder($hWnd)
  1374. Local $a_Cols = _GUICtrlListView_GetColumnOrderArray($hWnd), $s_Cols = ""
  1375. Local $sSeparatorChar = Opt('GUIDataSeparatorChar')
  1376. For $i = 1 To $a_Cols[0]
  1377. $s_Cols &= $a_Cols[$i] & $sSeparatorChar
  1378. Next
  1379. $s_Cols = StringTrimRight($s_Cols, 1)
  1380. Return $s_Cols
  1381. EndFunc ;==>_GUICtrlListView_GetColumnOrder
  1382. ; #FUNCTION# ====================================================================================================================
  1383. ; Author ........: Paul Campbell (PaulIA)
  1384. ; Modified.......: Gary Frost (gafrost)
  1385. ; ===============================================================================================================================
  1386. Func _GUICtrlListView_GetColumnOrderArray($hWnd)
  1387. Local $iColumns = _GUICtrlListView_GetColumnCount($hWnd)
  1388. Local $tBuffer = DllStructCreate("int[" & $iColumns & "]")
  1389. If IsHWnd($hWnd) Then
  1390. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1391. _SendMessage($hWnd, $LVM_GETCOLUMNORDERARRAY, $iColumns, $tBuffer, 0, "wparam", "struct*")
  1392. Else
  1393. Local $iBuffer = DllStructGetSize($tBuffer)
  1394. Local $tMemMap
  1395. Local $pMemory = _MemInit($hWnd, $iBuffer, $tMemMap)
  1396. _SendMessage($hWnd, $LVM_GETCOLUMNORDERARRAY, $iColumns, $pMemory, 0, "wparam", "ptr")
  1397. _MemRead($tMemMap, $pMemory, $tBuffer, $iBuffer)
  1398. _MemFree($tMemMap)
  1399. EndIf
  1400. Else
  1401. GUICtrlSendMsg($hWnd, $LVM_GETCOLUMNORDERARRAY, $iColumns, DllStructGetPtr($tBuffer))
  1402. EndIf
  1403. Local $aBuffer[$iColumns + 1]
  1404. $aBuffer[0] = $iColumns
  1405. For $iI = 1 To $iColumns
  1406. $aBuffer[$iI] = DllStructGetData($tBuffer, 1, $iI)
  1407. Next
  1408. Return $aBuffer
  1409. EndFunc ;==>_GUICtrlListView_GetColumnOrderArray
  1410. ; #FUNCTION# ====================================================================================================================
  1411. ; Author ........: Gary Frost (gafrost)
  1412. ; Modified.......:
  1413. ; ===============================================================================================================================
  1414. Func _GUICtrlListView_GetColumnWidth($hWnd, $iCol)
  1415. If IsHWnd($hWnd) Then
  1416. Return _SendMessage($hWnd, $LVM_GETCOLUMNWIDTH, $iCol)
  1417. Else
  1418. Return GUICtrlSendMsg($hWnd, $LVM_GETCOLUMNWIDTH, $iCol, 0)
  1419. EndIf
  1420. EndFunc ;==>_GUICtrlListView_GetColumnWidth
  1421. ; #FUNCTION# ====================================================================================================================
  1422. ; Author ........: Gary Frost (gafrost)
  1423. ; Modified.......:
  1424. ; ===============================================================================================================================
  1425. Func _GUICtrlListView_GetCounterPage($hWnd)
  1426. If IsHWnd($hWnd) Then
  1427. Return _SendMessage($hWnd, $LVM_GETCOUNTPERPAGE)
  1428. Else
  1429. Return GUICtrlSendMsg($hWnd, $LVM_GETCOUNTPERPAGE, 0, 0)
  1430. EndIf
  1431. EndFunc ;==>_GUICtrlListView_GetCounterPage
  1432. ; #FUNCTION# ====================================================================================================================
  1433. ; Author ........: Paul Campbell (PaulIA)
  1434. ; Modified.......: Gary Frost (gafrost)
  1435. ; ===============================================================================================================================
  1436. Func _GUICtrlListView_GetEditControl($hWnd)
  1437. If IsHWnd($hWnd) Then
  1438. Return HWnd(_SendMessage($hWnd, $LVM_GETEDITCONTROL))
  1439. Else
  1440. Return HWnd(GUICtrlSendMsg($hWnd, $LVM_GETEDITCONTROL, 0, 0))
  1441. EndIf
  1442. EndFunc ;==>_GUICtrlListView_GetEditControl
  1443. ; #NO_DOC_FUNCTION# =============================================================================================================
  1444. ; Name...........: _GUICtrlListView_GetEmptyText
  1445. ; Description ...: Gets the text meant for display when the list-view control appears empty
  1446. ; Syntax.........: _GUICtrlListView_GetEmptyText ( $hWnd )
  1447. ; Parameters ....: $hWnd - Handle to the control
  1448. ; Return values .: Success - Text meant for display when the list-view control appears emtpy
  1449. ; Failure - ""
  1450. ; Author ........: Gary Frost (gafrost)
  1451. ; Modified.......:
  1452. ; Remarks .......: Minimum OS: Windows Vista
  1453. ; Related .......:
  1454. ; Link ..........: @@MsdnLink@@ LVM_GETEMPTYTEXT
  1455. ; Example .......: Yes
  1456. ; ===============================================================================================================================
  1457. Func _GUICtrlListView_GetEmptyText($hWnd)
  1458. Local $tText = DllStructCreate("char[4096]")
  1459. Local $iRet
  1460. If IsHWnd($hWnd) Then
  1461. Local $iText = DllStructGetSize($tText)
  1462. Local $tMemMap
  1463. Local $pMemory = _MemInit($hWnd, $iText + 4096, $tMemMap)
  1464. Local $pText = $pMemory + $iText
  1465. DllStructSetData($tText, "Text", $pText)
  1466. _MemWrite($tMemMap, $pText, $pMemory, $iText)
  1467. $iRet = _SendMessage($hWnd, $LVM_GETEMPTYTEXT, 4096, $pMemory)
  1468. _MemRead($tMemMap, $pText, $tText, 4096)
  1469. _MemFree($tMemMap)
  1470. If $iRet = 0 Then Return SetError(-1, 0, "")
  1471. Return DllStructGetData($tText, 1)
  1472. Else
  1473. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETEMPTYTEXT, 4096, DllStructGetPtr($tText))
  1474. If $iRet = 0 Then Return SetError(-1, 0, "")
  1475. Return DllStructGetData($tText, 1)
  1476. EndIf
  1477. EndFunc ;==>_GUICtrlListView_GetEmptyText
  1478. ; #FUNCTION# ====================================================================================================================
  1479. ; Author ........: Gary Frost (gafrost)
  1480. ; Modified.......:
  1481. ; ===============================================================================================================================
  1482. Func _GUICtrlListView_GetExtendedListViewStyle($hWnd)
  1483. If IsHWnd($hWnd) Then
  1484. Return _SendMessage($hWnd, $LVM_GETEXTENDEDLISTVIEWSTYLE)
  1485. Else
  1486. Return GUICtrlSendMsg($hWnd, $LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
  1487. EndIf
  1488. EndFunc ;==>_GUICtrlListView_GetExtendedListViewStyle
  1489. ; #FUNCTION# ====================================================================================================================
  1490. ; Author ........: Gary Frost (gafrost)
  1491. ; Modified.......:
  1492. ; ===============================================================================================================================
  1493. Func _GUICtrlListView_GetFocusedGroup($hWnd)
  1494. If IsHWnd($hWnd) Then
  1495. Return _SendMessage($hWnd, $LVM_GETFOCUSEDGROUP)
  1496. Else
  1497. Return GUICtrlSendMsg($hWnd, $LVM_GETFOCUSEDGROUP, 0, 0)
  1498. EndIf
  1499. EndFunc ;==>_GUICtrlListView_GetFocusedGroup
  1500. ; #FUNCTION# ====================================================================================================================
  1501. ; Author ........: Gary Frost (gafrost)
  1502. ; Modified.......:
  1503. ; ===============================================================================================================================
  1504. Func _GUICtrlListView_GetGroupCount($hWnd)
  1505. If IsHWnd($hWnd) Then
  1506. Return _SendMessage($hWnd, $LVM_GETGROUPCOUNT)
  1507. Else
  1508. Return GUICtrlSendMsg($hWnd, $LVM_GETGROUPCOUNT, 0, 0)
  1509. EndIf
  1510. EndFunc ;==>_GUICtrlListView_GetGroupCount
  1511. ; #FUNCTION# ====================================================================================================================
  1512. ; Author ........: Paul Campbell (PaulIA)
  1513. ; Modified.......: Gary Frost (gafrost), guinness - Replaced retrieving the header and alignment code with __GUICtrlListView_GetGroupInfoEx.
  1514. ; ===============================================================================================================================
  1515. Func _GUICtrlListView_GetGroupInfo($hWnd, $iGroupID)
  1516. Local $tGroup = __GUICtrlListView_GetGroupInfoEx($hWnd, $iGroupID, BitOR($LVGF_HEADER, $LVGF_ALIGN))
  1517. Local $iErr = @error
  1518. Local $aGroup[2]
  1519. $aGroup[0] = _WinAPI_WideCharToMultiByte(DllStructGetData($tGroup, "Header"))
  1520. Select
  1521. Case BitAND(DllStructGetData($tGroup, "Align"), $LVGA_HEADER_CENTER) <> 0
  1522. $aGroup[1] = 1
  1523. Case BitAND(DllStructGetData($tGroup, "Align"), $LVGA_HEADER_RIGHT) <> 0
  1524. $aGroup[1] = 2
  1525. Case Else
  1526. $aGroup[1] = 0
  1527. EndSelect
  1528. Return SetError($iErr, 0, $aGroup)
  1529. EndFunc ;==>_GUICtrlListView_GetGroupInfo
  1530. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  1531. ; Name ..........: __GUICtrlListView_GetGroupInfoEx
  1532. ; Description ...: Retrieves group information
  1533. ; Syntax ........: __GUICtrlListView_GetGroupInfoEx($hWnd, $iGroupID, $iMask)
  1534. ; Parameters ....: $hWnd - Handle to the control
  1535. ; $iGroupID - ID that specifies the group whose information is retrieved
  1536. ; $iMask - Can be a combination of the following:
  1537. ; |$LVGF_NONENo other items are valid.
  1538. ; |$LVGF_HEADER
  1539. ; |$LVGF_FOOTER
  1540. ; |$LVGF_STATE
  1541. ; |$LVGF_ALIGN
  1542. ; |$LVGF_GROUPID
  1543. ; |$LVGF_SUBTITLE
  1544. ; |$LVGF_TASK
  1545. ; |$LVGF_DESCRIPTIONTOP
  1546. ; |$LVGF_DESCRIPTIONBOTTOM
  1547. ; |$LVGF_TITLEIMAGE
  1548. ; |$LVGF_EXTENDEDIMAGE
  1549. ; |$LVGF_ITEMS
  1550. ; |$LVGF_SUBSET
  1551. ; |$LVGF_SUBSETITEMS
  1552. ; Return values .: Success - $tagLVGROUP structure
  1553. ; Author ........: Paul Campbell (PaulIA)
  1554. ; Modified.......: guinness
  1555. ; Remarks .......: This function is used internally and should not normally be called
  1556. ; Related .......: $tagLVGROUP
  1557. ; Link ..........:
  1558. ; Example .......: No
  1559. ; ===============================================================================================================================
  1560. Func __GUICtrlListView_GetGroupInfoEx($hWnd, $iGroupID, $iMask)
  1561. Local $tGroup = DllStructCreate($tagLVGROUP)
  1562. Local $iGroup = DllStructGetSize($tGroup)
  1563. DllStructSetData($tGroup, "Size", $iGroup)
  1564. DllStructSetData($tGroup, "Mask", $iMask)
  1565. Local $iRet
  1566. If IsHWnd($hWnd) Then
  1567. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1568. $iRet = _SendMessage($hWnd, $LVM_GETGROUPINFO, $iGroupID, $tGroup, 0, "wparam", "struct*")
  1569. Else
  1570. Local $tMemMap
  1571. Local $pMemory = _MemInit($hWnd, $iGroup, $tMemMap)
  1572. _MemWrite($tMemMap, $tGroup, $pMemory, $iGroup)
  1573. $iRet = _SendMessage($hWnd, $LVM_GETGROUPINFO, $iGroupID, $pMemory, 0, "wparam", "ptr")
  1574. _MemRead($tMemMap, $pMemory, $tGroup, $iGroup)
  1575. _MemFree($tMemMap)
  1576. EndIf
  1577. Else
  1578. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETGROUPINFO, $iGroupID, DllStructGetPtr($tGroup))
  1579. EndIf
  1580. Return SetError($iRet <> $iGroupID, 0, $tGroup)
  1581. EndFunc ;==>__GUICtrlListView_GetGroupInfoEx
  1582. ; #FUNCTION# ====================================================================================================================
  1583. ; Author ........: Gary Frost
  1584. ; Modified.......: Matt Diesel (Mat) #2726 - Added group id to returned array.
  1585. ; ===============================================================================================================================
  1586. Func _GUICtrlListView_GetGroupInfoByIndex($hWnd, $iIndex)
  1587. Local $tGroup = DllStructCreate($tagLVGROUP)
  1588. Local $iGroup = DllStructGetSize($tGroup)
  1589. DllStructSetData($tGroup, "Size", $iGroup)
  1590. DllStructSetData($tGroup, "Mask", BitOR($LVGF_HEADER, $LVGF_ALIGN, $LVGF_GROUPID))
  1591. Local $iRet
  1592. If IsHWnd($hWnd) Then
  1593. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1594. $iRet = _SendMessage($hWnd, $LVM_GETGROUPINFOBYINDEX, $iIndex, $tGroup, 0, "wparam", "struct*")
  1595. Else
  1596. Local $tMemMap
  1597. Local $pMemory = _MemInit($hWnd, $iGroup, $tMemMap)
  1598. _MemWrite($tMemMap, $tGroup, $pMemory, $iGroup)
  1599. $iRet = _SendMessage($hWnd, $LVM_GETGROUPINFOBYINDEX, $iIndex, $pMemory, 0, "wparam", "ptr")
  1600. _MemRead($tMemMap, $pMemory, $tGroup, $iGroup)
  1601. _MemFree($tMemMap)
  1602. EndIf
  1603. Else
  1604. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETGROUPINFOBYINDEX, $iIndex, DllStructGetPtr($tGroup))
  1605. EndIf
  1606. Local $aGroup[3]
  1607. $aGroup[0] = _WinAPI_WideCharToMultiByte(DllStructGetData($tGroup, "Header"))
  1608. Select
  1609. Case BitAND(DllStructGetData($tGroup, "Align"), $LVGA_HEADER_CENTER) <> 0
  1610. $aGroup[1] = 1
  1611. Case BitAND(DllStructGetData($tGroup, "Align"), $LVGA_HEADER_RIGHT) <> 0
  1612. $aGroup[1] = 2
  1613. Case Else
  1614. $aGroup[1] = 0
  1615. EndSelect
  1616. $aGroup[2] = DllStructGetData($tGroup, "GroupID")
  1617. Return SetError($iRet = 0, 0, $aGroup)
  1618. EndFunc ;==>_GUICtrlListView_GetGroupInfoByIndex
  1619. ; #FUNCTION# ====================================================================================================================
  1620. ; Author ........: Gary Frost
  1621. ; Modified.......:
  1622. ; ===============================================================================================================================
  1623. Func _GUICtrlListView_GetGroupRect($hWnd, $iGroupID, $iGet = $LVGGR_GROUP)
  1624. Local $tGroup = DllStructCreate($tagRECT)
  1625. DllStructSetData($tGroup, "Top", $iGet)
  1626. Local $iRet
  1627. If IsHWnd($hWnd) Then
  1628. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1629. $iRet = _SendMessage($hWnd, $LVM_GETGROUPRECT, $iGroupID, $tGroup, 0, "wparam", "struct*")
  1630. Else
  1631. Local $iGroup = DllStructGetSize($tGroup)
  1632. Local $tMemMap
  1633. Local $pMemory = _MemInit($hWnd, $iGroup, $tMemMap)
  1634. _MemWrite($tMemMap, $tGroup, $pMemory, $iGroup)
  1635. $iRet = _SendMessage($hWnd, $LVM_GETGROUPRECT, $iGroupID, $pMemory, 0, "wparam", "ptr")
  1636. _MemRead($tMemMap, $pMemory, $tGroup, $iGroup)
  1637. _MemFree($tMemMap)
  1638. EndIf
  1639. Else
  1640. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETGROUPRECT, $iGroupID, DllStructGetPtr($tGroup))
  1641. EndIf
  1642. Local $aGroup[4]
  1643. For $x = 0 To 3
  1644. $aGroup[$x] = DllStructGetData($tGroup, $x + 1)
  1645. Next
  1646. Return SetError($iRet = 0, 0, $aGroup)
  1647. EndFunc ;==>_GUICtrlListView_GetGroupRect
  1648. ; #NO_DOC_FUNCTION# =============================================================================================================
  1649. ; Name...........: _GUICtrlListView_GetGroupState
  1650. ; Description ...: Gets the state for a specified group
  1651. ; Syntax.........: _GUICtrlListView_GetGroupState ( $hWnd, $iGroupID, $iMask )
  1652. ; Parameters ....: $hWnd - Handle to the control
  1653. ; $iGroupID - ID that specifies the group whose information is retrieved
  1654. ; $iMask - Can be a combination of the following:
  1655. ; | $LVGS_NORMAL - Groups are expanded, the group name is displayed, and all items in the group are displayed.
  1656. ; | $LVGS_COLLAPSED - The group is collapsed.
  1657. ; | $LVGS_HIDDEN - The group is hidden.
  1658. ; | $LVGS_NOHEADER - The group does not display a header
  1659. ; | $LVGS_COLLAPSIBLE - The group can be collapsed
  1660. ; | $LVGS_FOCUSED - The group has keyboard focus
  1661. ; | $LVGS_SELECTED - The group is selected
  1662. ; | $LVGS_SUBSETED - The group displays only a portion of its items
  1663. ; | $LVGS_SUBSETLINKFOCUSED - The subset link of the group has keyboard focus
  1664. ; Return values .: Success - Returns the combination of state values that are set
  1665. ; Failure - 0
  1666. ; Author ........: Gary Frost
  1667. ; Modified.......:
  1668. ; Remarks .......: Minimum operating systems: Windows Vista
  1669. ; Related .......:
  1670. ; Link ..........:
  1671. ; Example .......: Yes
  1672. ; ===============================================================================================================================
  1673. Func _GUICtrlListView_GetGroupState($hWnd, $iGroupID, $iMask)
  1674. If IsHWnd($hWnd) Then
  1675. Return _SendMessage($hWnd, $LVM_GETGROUPSTATE, $iGroupID, $iMask)
  1676. Else
  1677. Return GUICtrlSendMsg($hWnd, $LVM_GETGROUPSTATE, $iGroupID, $iMask)
  1678. EndIf
  1679. EndFunc ;==>_GUICtrlListView_GetGroupState
  1680. ; #FUNCTION# ====================================================================================================================
  1681. ; Author ........: Paul Campbell (PaulIA)
  1682. ; Modified.......: Gary Frost (gafrost)
  1683. ; ===============================================================================================================================
  1684. Func _GUICtrlListView_GetGroupViewEnabled($hWnd)
  1685. If IsHWnd($hWnd) Then
  1686. Return _SendMessage($hWnd, $LVM_ISGROUPVIEWENABLED) <> 0
  1687. Else
  1688. Return GUICtrlSendMsg($hWnd, $LVM_ISGROUPVIEWENABLED, 0, 0) <> 0
  1689. EndIf
  1690. EndFunc ;==>_GUICtrlListView_GetGroupViewEnabled
  1691. ; #FUNCTION# ====================================================================================================================
  1692. ; Author ........: Gary Frost (gafrost)
  1693. ; Modified.......:
  1694. ; ===============================================================================================================================
  1695. Func _GUICtrlListView_GetHeader($hWnd)
  1696. If IsHWnd($hWnd) Then
  1697. Return HWnd(_SendMessage($hWnd, $LVM_GETHEADER))
  1698. Else
  1699. Return HWnd(GUICtrlSendMsg($hWnd, $LVM_GETHEADER, 0, 0))
  1700. EndIf
  1701. EndFunc ;==>_GUICtrlListView_GetHeader
  1702. ; #FUNCTION# ====================================================================================================================
  1703. ; Author ........: Gary Frost (gafrost)
  1704. ; Modified.......:
  1705. ; ===============================================================================================================================
  1706. Func _GUICtrlListView_GetHotCursor($hWnd)
  1707. If IsHWnd($hWnd) Then
  1708. Return _SendMessage($hWnd, $LVM_GETHOTCURSOR, 0, 0, 0, "wparam", "lparam", "handle")
  1709. Else
  1710. Return Ptr(GUICtrlSendMsg($hWnd, $LVM_GETHOTCURSOR, 0, 0))
  1711. EndIf
  1712. EndFunc ;==>_GUICtrlListView_GetHotCursor
  1713. ; #FUNCTION# ====================================================================================================================
  1714. ; Author ........: Gary Frost (gafrost)
  1715. ; Modified.......:
  1716. ; ===============================================================================================================================
  1717. Func _GUICtrlListView_GetHotItem($hWnd)
  1718. If IsHWnd($hWnd) Then
  1719. Return _SendMessage($hWnd, $LVM_GETHOTITEM)
  1720. Else
  1721. Return GUICtrlSendMsg($hWnd, $LVM_GETHOTITEM, 0, 0)
  1722. EndIf
  1723. EndFunc ;==>_GUICtrlListView_GetHotItem
  1724. ; #FUNCTION# ====================================================================================================================
  1725. ; Author ........: Gary Frost (gafrost)
  1726. ; Modified.......:
  1727. ; ===============================================================================================================================
  1728. Func _GUICtrlListView_GetHoverTime($hWnd)
  1729. If IsHWnd($hWnd) Then
  1730. Return _SendMessage($hWnd, $LVM_GETHOVERTIME)
  1731. Else
  1732. Return GUICtrlSendMsg($hWnd, $LVM_GETHOVERTIME, 0, 0)
  1733. EndIf
  1734. EndFunc ;==>_GUICtrlListView_GetHoverTime
  1735. ; #FUNCTION# ====================================================================================================================
  1736. ; Author ........: Paul Campbell (PaulIA)
  1737. ; Modified.......: Gary Frost (gafrost)
  1738. ; ===============================================================================================================================
  1739. Func _GUICtrlListView_GetImageList($hWnd, $iImageList)
  1740. Local $aImageList[3] = [$LVSIL_NORMAL, $LVSIL_SMALL, $LVSIL_STATE]
  1741. If IsHWnd($hWnd) Then
  1742. Return _SendMessage($hWnd, $LVM_GETIMAGELIST, $aImageList[$iImageList], 0, 0, "wparam", "lparam", "handle")
  1743. Else
  1744. Return Ptr(GUICtrlSendMsg($hWnd, $LVM_GETIMAGELIST, $aImageList[$iImageList], 0))
  1745. EndIf
  1746. EndFunc ;==>_GUICtrlListView_GetImageList
  1747. ; #NO_DOC_FUNCTION# =============================================================================================================
  1748. ; Name...........: _GUICtrlListView_GetInsertMark
  1749. ; Description ...: Retrieves the position of the insertion point
  1750. ; Syntax.........: _GUICtrlListView_GetInsertMark ( $hWnd )
  1751. ; Parameters ....: $hWnd - Handle to the control
  1752. ; Return values .: Success - Array with the following format:
  1753. ; |[0] - True if the insertion point appears after the item, otherwise False
  1754. ; |[1] - Item next to which the insertion point appears. If this is -1, there is no insertion point.
  1755. ; Author ........: Paul Campbell (PaulIA)
  1756. ; Modified.......: Gary Frost (gafrost)
  1757. ; Remarks .......: Minimum operating systems Windows XP.
  1758. ; +
  1759. ; An insertion point can appear only if the control is in icon view, small icon view, or tile view,
  1760. ; and is not in group view mode.
  1761. ; Related .......: _GUICtrlListView_SetInsertMark
  1762. ; Link ..........:
  1763. ; Example .......:
  1764. ; ===============================================================================================================================
  1765. Func _GUICtrlListView_GetInsertMark($hWnd)
  1766. Local $tMark = DllStructCreate($tagLVINSERTMARK)
  1767. Local $iMark = DllStructGetSize($tMark)
  1768. DllStructSetData($tMark, "Size", $iMark)
  1769. Local $iRet
  1770. If IsHWnd($hWnd) Then
  1771. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1772. $iRet = _SendMessage($hWnd, $LVM_GETINSERTMARK, 0, $tMark, 0, "wparam", "struct*")
  1773. Else
  1774. Local $tMemMap
  1775. Local $pMemory = _MemInit($hWnd, $iMark, $tMemMap)
  1776. _MemWrite($tMemMap, $tMark)
  1777. $iRet = _SendMessage($hWnd, $LVM_GETINSERTMARK, 0, $pMemory, 0, "wparam", "ptr")
  1778. _MemRead($tMemMap, $pMemory, $tMark, $iMark)
  1779. _MemFree($tMemMap)
  1780. EndIf
  1781. Else
  1782. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETINSERTMARK, 0, DllStructGetPtr($tMark))
  1783. EndIf
  1784. Local $aMark[2]
  1785. $aMark[0] = DllStructGetData($tMark, "Flags") = $LVIM_AFTER
  1786. $aMark[1] = DllStructGetData($tMark, "Item")
  1787. Return SetError($iRet = 0, 0, $aMark)
  1788. EndFunc ;==>_GUICtrlListView_GetInsertMark
  1789. ; #NO_DOC_FUNCTION# =============================================================================================================
  1790. ; Name...........: _GUICtrlListView_GetInsertMarkColor
  1791. ; Description ...: Retrieves the color of the insertion point
  1792. ; Syntax.........: _GUICtrlListView_GetInsertMarkColor ( $hWnd )
  1793. ; Parameters ....: $hWnd - Handle to the control
  1794. ; Return values .: Success - Color of the insertion point
  1795. ; Author ........: Paul Campbell (PaulIA)
  1796. ; Modified.......: Gary Frost (gafrost)
  1797. ; Remarks .......: Minimum operating systems Windows XP.
  1798. ; Related .......: _GUICtrlListView_SetInsertMarkColor
  1799. ; Link ..........:
  1800. ; Example .......:
  1801. ; ===============================================================================================================================
  1802. Func _GUICtrlListView_GetInsertMarkColor($hWnd)
  1803. If IsHWnd($hWnd) Then
  1804. Return _SendMessage($hWnd, $LVM_GETINSERTMARKCOLOR, $LVSIL_STATE)
  1805. Else
  1806. Return GUICtrlSendMsg($hWnd, $LVM_GETINSERTMARKCOLOR, $LVSIL_STATE, 0)
  1807. EndIf
  1808. EndFunc ;==>_GUICtrlListView_GetInsertMarkColor
  1809. ; #NO_DOC_FUNCTION# =============================================================================================================
  1810. ; Name...........: _GUICtrlListView_GetInsertMarkRect
  1811. ; Description ...: Retrieves the rectangle that bounds the insertion point
  1812. ; Syntax.........: _GUICtrlListView_GetInsertMarkRect ( $hWnd )
  1813. ; Parameters ....: $hWnd - Handle to the control
  1814. ; Return values .: Success - Array with the following format:
  1815. ; |[0] = True if insertion point found, otherwise False
  1816. ; |[1] = X coordinate of the upper left corner of the rectangle
  1817. ; |[2] = Y coordinate of the upper left corner of the rectangle
  1818. ; |[3] = X coordinate of the lower right corner of the rectangle
  1819. ; |[4] = Y coordinate of the lower right corner of the rectangle
  1820. ; Author ........: Paul Campbell (PaulIA)
  1821. ; Modified.......: Gary Frost (gafrost)
  1822. ; Remarks .......: Minimum operating systems Windows XP.
  1823. ; Related .......:
  1824. ; Link ..........:
  1825. ; Example .......:
  1826. ; ===============================================================================================================================
  1827. Func _GUICtrlListView_GetInsertMarkRect($hWnd)
  1828. Local $aRect[5]
  1829. Local $tRECT = DllStructCreate($tagRECT)
  1830. If IsHWnd($hWnd) Then
  1831. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1832. $aRect[0] = _SendMessage($hWnd, $LVM_GETINSERTMARKRECT, 0, $tRECT, 0, "wparam", "struct*") <> 0
  1833. Else
  1834. Local $iRect = DllStructGetSize($tRECT)
  1835. Local $tMemMap
  1836. Local $pMemory = _MemInit($hWnd, $iRect, $tMemMap)
  1837. $aRect[0] = _SendMessage($hWnd, $LVM_GETINSERTMARKRECT, 0, $pMemory, 0, "wparam", "ptr") <> 0
  1838. _MemRead($tMemMap, $pMemory, $tRECT, $iRect)
  1839. _MemFree($tMemMap)
  1840. EndIf
  1841. Else
  1842. $aRect[0] = GUICtrlSendMsg($hWnd, $LVM_GETINSERTMARKRECT, 0, DllStructGetPtr($tRECT)) <> 0
  1843. EndIf
  1844. $aRect[1] = DllStructGetData($tRECT, "Left")
  1845. $aRect[2] = DllStructGetData($tRECT, "Top")
  1846. $aRect[3] = DllStructGetData($tRECT, "Right")
  1847. $aRect[4] = DllStructGetData($tRECT, "Bottom")
  1848. Return $aRect
  1849. EndFunc ;==>_GUICtrlListView_GetInsertMarkRect
  1850. ; #FUNCTION# ====================================================================================================================
  1851. ; Author ........: Paul Campbell (PaulIA)
  1852. ; Modified.......: Gary Frost (gafrost)
  1853. ; ===============================================================================================================================
  1854. Func _GUICtrlListView_GetISearchString($hWnd)
  1855. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  1856. Local $iBuffer
  1857. If IsHWnd($hWnd) Then
  1858. If $bUnicode Then
  1859. $iBuffer = _SendMessage($hWnd, $LVM_GETISEARCHSTRINGW) + 1
  1860. Else
  1861. $iBuffer = _SendMessage($hWnd, $LVM_GETISEARCHSTRINGA) + 1
  1862. EndIf
  1863. Else
  1864. If $bUnicode Then
  1865. $iBuffer = GUICtrlSendMsg($hWnd, $LVM_GETISEARCHSTRINGW, 0, 0) + 1
  1866. Else
  1867. $iBuffer = GUICtrlSendMsg($hWnd, $LVM_GETISEARCHSTRINGA, 0, 0) + 1
  1868. EndIf
  1869. EndIf
  1870. If $iBuffer = 1 Then Return ""
  1871. Local $tBuffer
  1872. If $bUnicode Then
  1873. $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  1874. $iBuffer *= 2
  1875. Else
  1876. $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
  1877. EndIf
  1878. If IsHWnd($hWnd) Then
  1879. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1880. _SendMessage($hWnd, $LVM_GETISEARCHSTRINGW, 0, $tBuffer, 0, "wparam", "struct*")
  1881. Else
  1882. Local $tMemMap
  1883. Local $pMemory = _MemInit($hWnd, $iBuffer, $tMemMap)
  1884. If $bUnicode Then
  1885. _SendMessage($hWnd, $LVM_GETISEARCHSTRINGW, 0, $pMemory)
  1886. Else
  1887. _SendMessage($hWnd, $LVM_GETISEARCHSTRINGA, 0, $pMemory)
  1888. EndIf
  1889. _MemRead($tMemMap, $pMemory, $tBuffer, $iBuffer)
  1890. _MemFree($tMemMap)
  1891. EndIf
  1892. Else
  1893. Local $pBuffer = DllStructGetPtr($tBuffer)
  1894. If $bUnicode Then
  1895. GUICtrlSendMsg($hWnd, $LVM_GETISEARCHSTRINGW, 0, $pBuffer)
  1896. Else
  1897. GUICtrlSendMsg($hWnd, $LVM_GETISEARCHSTRINGA, 0, $pBuffer)
  1898. EndIf
  1899. EndIf
  1900. Return DllStructGetData($tBuffer, "Text")
  1901. EndFunc ;==>_GUICtrlListView_GetISearchString
  1902. ; #FUNCTION# ====================================================================================================================
  1903. ; Author ........: Paul Campbell (PaulIA)
  1904. ; Modified.......:
  1905. ; ===============================================================================================================================
  1906. Func _GUICtrlListView_GetItem($hWnd, $iIndex, $iSubItem = 0)
  1907. Local $aItem[8]
  1908. Local $tItem = DllStructCreate($tagLVITEM)
  1909. DllStructSetData($tItem, "Mask", BitOR($LVIF_GROUPID, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_STATE))
  1910. DllStructSetData($tItem, "Item", $iIndex)
  1911. DllStructSetData($tItem, "SubItem", $iSubItem)
  1912. DllStructSetData($tItem, "StateMask", -1)
  1913. _GUICtrlListView_GetItemEx($hWnd, $tItem)
  1914. Local $iState = DllStructGetData($tItem, "State")
  1915. If BitAND($iState, $LVIS_CUT) <> 0 Then $aItem[0] = BitOR($aItem[0], 1)
  1916. If BitAND($iState, $LVIS_DROPHILITED) <> 0 Then $aItem[0] = BitOR($aItem[0], 2)
  1917. If BitAND($iState, $LVIS_FOCUSED) <> 0 Then $aItem[0] = BitOR($aItem[0], 4)
  1918. If BitAND($iState, $LVIS_SELECTED) <> 0 Then $aItem[0] = BitOR($aItem[0], 8)
  1919. $aItem[1] = __GUICtrlListView_OverlayImageMaskToIndex($iState)
  1920. $aItem[2] = __GUICtrlListView_StateImageMaskToIndex($iState)
  1921. $aItem[3] = _GUICtrlListView_GetItemText($hWnd, $iIndex, $iSubItem)
  1922. $aItem[4] = DllStructGetData($tItem, "Image")
  1923. $aItem[5] = DllStructGetData($tItem, "Param")
  1924. $aItem[6] = DllStructGetData($tItem, "Indent")
  1925. $aItem[7] = DllStructGetData($tItem, "GroupID")
  1926. Return $aItem
  1927. EndFunc ;==>_GUICtrlListView_GetItem
  1928. ; #FUNCTION# ====================================================================================================================
  1929. ; Author ........: Gary Frost
  1930. ; Modified.......: Siao for external control
  1931. ; ===============================================================================================================================
  1932. Func _GUICtrlListView_GetItemChecked($hWnd, $iIndex)
  1933. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  1934. Local $tLVITEM = DllStructCreate($tagLVITEM)
  1935. Local $iSize = DllStructGetSize($tLVITEM)
  1936. If @error Then Return SetError($LV_ERR, $LV_ERR, False)
  1937. DllStructSetData($tLVITEM, "Mask", $LVIF_STATE)
  1938. DllStructSetData($tLVITEM, "Item", $iIndex)
  1939. DllStructSetData($tLVITEM, "StateMask", 0xffff)
  1940. Local $iRet
  1941. If IsHWnd($hWnd) Then
  1942. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  1943. $iRet = _SendMessage($hWnd, $LVM_GETITEMW, 0, $tLVITEM, 0, "wparam", "struct*") <> 0
  1944. Else
  1945. Local $tMemMap
  1946. Local $pMemory = _MemInit($hWnd, $iSize, $tMemMap)
  1947. _MemWrite($tMemMap, $tLVITEM)
  1948. If $bUnicode Then
  1949. $iRet = _SendMessage($hWnd, $LVM_GETITEMW, 0, $pMemory, 0, "wparam", "ptr") <> 0
  1950. Else
  1951. $iRet = _SendMessage($hWnd, $LVM_GETITEMA, 0, $pMemory, 0, "wparam", "ptr") <> 0
  1952. EndIf
  1953. _MemRead($tMemMap, $pMemory, $tLVITEM, $iSize)
  1954. _MemFree($tMemMap)
  1955. EndIf
  1956. Else
  1957. Local $pItem = DllStructGetPtr($tLVITEM)
  1958. If $bUnicode Then
  1959. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETITEMW, 0, $pItem) <> 0
  1960. Else
  1961. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETITEMA, 0, $pItem) <> 0
  1962. EndIf
  1963. EndIf
  1964. If Not $iRet Then Return SetError($LV_ERR, $LV_ERR, False)
  1965. Return BitAND(DllStructGetData($tLVITEM, "State"), 0x2000) <> 0
  1966. EndFunc ;==>_GUICtrlListView_GetItemChecked
  1967. ; #FUNCTION# ====================================================================================================================
  1968. ; Author ........: Gary Frost (gafrost)
  1969. ; Modified.......:
  1970. ; ===============================================================================================================================
  1971. Func _GUICtrlListView_GetItemCount($hWnd)
  1972. If IsHWnd($hWnd) Then
  1973. Return _SendMessage($hWnd, $LVM_GETITEMCOUNT)
  1974. Else
  1975. Return GUICtrlSendMsg($hWnd, $LVM_GETITEMCOUNT, 0, 0)
  1976. EndIf
  1977. EndFunc ;==>_GUICtrlListView_GetItemCount
  1978. ; #FUNCTION# ====================================================================================================================
  1979. ; Author ........: Paul Campbell (PaulIA)
  1980. ; Modified.......:
  1981. ; ===============================================================================================================================
  1982. Func _GUICtrlListView_GetItemCut($hWnd, $iIndex)
  1983. Return _GUICtrlListView_GetItemState($hWnd, $iIndex, $LVIS_CUT) <> 0
  1984. EndFunc ;==>_GUICtrlListView_GetItemCut
  1985. ; #FUNCTION# ====================================================================================================================
  1986. ; Author ........: Paul Campbell (PaulIA)
  1987. ; Modified.......:
  1988. ; ===============================================================================================================================
  1989. Func _GUICtrlListView_GetItemDropHilited($hWnd, $iIndex)
  1990. Return _GUICtrlListView_GetItemState($hWnd, $iIndex, $LVIS_DROPHILITED) <> 0
  1991. EndFunc ;==>_GUICtrlListView_GetItemDropHilited
  1992. ; #FUNCTION# ====================================================================================================================
  1993. ; Author ........: Paul Campbell (PaulIA)
  1994. ; Modified.......: Gary Frost (gafrost)
  1995. ; ===============================================================================================================================
  1996. Func _GUICtrlListView_GetItemEx($hWnd, ByRef $tItem)
  1997. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  1998. Local $iRet
  1999. If IsHWnd($hWnd) Then
  2000. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2001. $iRet = _SendMessage($hWnd, $LVM_GETITEMW, 0, $tItem, 0, "wparam", "struct*")
  2002. Else
  2003. Local $iItem = DllStructGetSize($tItem)
  2004. Local $tMemMap
  2005. Local $pMemory = _MemInit($hWnd, $iItem, $tMemMap)
  2006. _MemWrite($tMemMap, $tItem)
  2007. If $bUnicode Then
  2008. _SendMessage($hWnd, $LVM_GETITEMW, 0, $pMemory, 0, "wparam", "ptr")
  2009. Else
  2010. _SendMessage($hWnd, $LVM_GETITEMA, 0, $pMemory, 0, "wparam", "ptr")
  2011. EndIf
  2012. _MemRead($tMemMap, $pMemory, $tItem, $iItem)
  2013. _MemFree($tMemMap)
  2014. EndIf
  2015. Else
  2016. Local $pItem = DllStructGetPtr($tItem)
  2017. If $bUnicode Then
  2018. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETITEMW, 0, $pItem)
  2019. Else
  2020. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETITEMA, 0, $pItem)
  2021. EndIf
  2022. EndIf
  2023. Return $iRet <> 0
  2024. EndFunc ;==>_GUICtrlListView_GetItemEx
  2025. ; #FUNCTION# ====================================================================================================================
  2026. ; Author ........: Paul Campbell (PaulIA)
  2027. ; Modified.......:
  2028. ; ===============================================================================================================================
  2029. Func _GUICtrlListView_GetItemFocused($hWnd, $iIndex)
  2030. Return _GUICtrlListView_GetItemState($hWnd, $iIndex, $LVIS_FOCUSED) <> 0
  2031. EndFunc ;==>_GUICtrlListView_GetItemFocused
  2032. ; #FUNCTION# ====================================================================================================================
  2033. ; Author ........: Paul Campbell (PaulIA)
  2034. ; Modified.......:
  2035. ; ===============================================================================================================================
  2036. Func _GUICtrlListView_GetItemGroupID($hWnd, $iIndex)
  2037. Local $tItem = DllStructCreate($tagLVITEM)
  2038. DllStructSetData($tItem, "Mask", $LVIF_GROUPID)
  2039. DllStructSetData($tItem, "Item", $iIndex)
  2040. _GUICtrlListView_GetItemEx($hWnd, $tItem)
  2041. Return DllStructGetData($tItem, "GroupID")
  2042. EndFunc ;==>_GUICtrlListView_GetItemGroupID
  2043. ; #FUNCTION# ====================================================================================================================
  2044. ; Author ........: Paul Campbell (PaulIA)
  2045. ; Modified.......:
  2046. ; ===============================================================================================================================
  2047. Func _GUICtrlListView_GetItemImage($hWnd, $iIndex, $iSubItem = 0)
  2048. Local $tItem = DllStructCreate($tagLVITEM)
  2049. DllStructSetData($tItem, "Mask", $LVIF_IMAGE)
  2050. DllStructSetData($tItem, "Item", $iIndex)
  2051. DllStructSetData($tItem, "SubItem", $iSubItem)
  2052. _GUICtrlListView_GetItemEx($hWnd, $tItem)
  2053. Return DllStructGetData($tItem, "Image")
  2054. EndFunc ;==>_GUICtrlListView_GetItemImage
  2055. ; #FUNCTION# ====================================================================================================================
  2056. ; Author ........: Paul Campbell (PaulIA)
  2057. ; Modified.......:
  2058. ; ===============================================================================================================================
  2059. Func _GUICtrlListView_GetItemIndent($hWnd, $iIndex)
  2060. Local $tItem = DllStructCreate($tagLVITEM)
  2061. DllStructSetData($tItem, "Mask", $LVIF_INDENT)
  2062. DllStructSetData($tItem, "Item", $iIndex)
  2063. _GUICtrlListView_GetItemEx($hWnd, $tItem)
  2064. Return DllStructGetData($tItem, "Indent")
  2065. EndFunc ;==>_GUICtrlListView_GetItemIndent
  2066. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  2067. ; Name...........: __GUICtrlListView_GetItemOverlayImage
  2068. ; Description ...: Gets the overlay image that is superimposed over the item's icon image
  2069. ; Syntax.........: __GUICtrlListView_GetItemOverlayImage ( $hWnd, $iIndex )
  2070. ; Parameters ....: $hWnd - Handle to the control
  2071. ; $iIndex - Zero based index of the item
  2072. ; Return values .: Success - Zero based image index
  2073. ; Author ........: Paul Campbell (PaulIA)
  2074. ; Modified.......:
  2075. ; Remarks .......: This function is used internally and should not normally be called
  2076. ; Related .......: __GUICtrlListView_SetItemOverlayImage
  2077. ; Link ..........:
  2078. ; Example .......:
  2079. ; ===============================================================================================================================
  2080. Func __GUICtrlListView_GetItemOverlayImage($hWnd, $iIndex)
  2081. Return BitShift(_GUICtrlListView_GetItemState($hWnd, $iIndex, $LVIS_OVERLAYMASK), 8)
  2082. EndFunc ;==>__GUICtrlListView_GetItemOverlayImage
  2083. ; #FUNCTION# ====================================================================================================================
  2084. ; Author ........: Paul Campbell (PaulIA)
  2085. ; Modified.......:
  2086. ; ===============================================================================================================================
  2087. Func _GUICtrlListView_GetItemParam($hWnd, $iIndex)
  2088. Local $tItem = DllStructCreate($tagLVITEM)
  2089. DllStructSetData($tItem, "Mask", $LVIF_PARAM)
  2090. DllStructSetData($tItem, "Item", $iIndex)
  2091. _GUICtrlListView_GetItemEx($hWnd, $tItem)
  2092. Return DllStructGetData($tItem, "Param")
  2093. EndFunc ;==>_GUICtrlListView_GetItemParam
  2094. ; #FUNCTION# ====================================================================================================================
  2095. ; Author ........: Paul Campbell (PaulIA)
  2096. ; Modified.......: Gary Frost (gafrost)
  2097. ; ===============================================================================================================================
  2098. Func _GUICtrlListView_GetItemPosition($hWnd, $iIndex)
  2099. Local $aPoint[2], $iRet
  2100. Local $tPoint = DllStructCreate($tagPOINT)
  2101. If IsHWnd($hWnd) Then
  2102. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2103. If Not _SendMessage($hWnd, $LVM_GETITEMPOSITION, $iIndex, $tPoint, 0, "wparam", "struct*") Then Return $aPoint
  2104. Else
  2105. Local $iPoint = DllStructGetSize($tPoint)
  2106. Local $tMemMap
  2107. Local $pMemory = _MemInit($hWnd, $iPoint, $tMemMap)
  2108. If Not _SendMessage($hWnd, $LVM_GETITEMPOSITION, $iIndex, $pMemory, 0, "wparam", "ptr") Then Return $aPoint
  2109. _MemRead($tMemMap, $pMemory, $tPoint, $iPoint)
  2110. _MemFree($tMemMap)
  2111. EndIf
  2112. Else
  2113. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETITEMPOSITION, $iIndex, DllStructGetPtr($tPoint))
  2114. If Not $iRet Then Return $aPoint
  2115. EndIf
  2116. $aPoint[0] = DllStructGetData($tPoint, "X")
  2117. $aPoint[1] = DllStructGetData($tPoint, "Y")
  2118. Return $aPoint
  2119. EndFunc ;==>_GUICtrlListView_GetItemPosition
  2120. ; #FUNCTION# ====================================================================================================================
  2121. ; Author ........: Paul Campbell (PaulIA)
  2122. ; Modified.......:
  2123. ; ===============================================================================================================================
  2124. Func _GUICtrlListView_GetItemPositionX($hWnd, $iIndex)
  2125. Local $aPoint = _GUICtrlListView_GetItemPosition($hWnd, $iIndex)
  2126. Return $aPoint[0]
  2127. EndFunc ;==>_GUICtrlListView_GetItemPositionX
  2128. ; #FUNCTION# ====================================================================================================================
  2129. ; Author ........: Paul Campbell (PaulIA)
  2130. ; Modified.......:
  2131. ; ===============================================================================================================================
  2132. Func _GUICtrlListView_GetItemPositionY($hWnd, $iIndex)
  2133. Local $aPoint = _GUICtrlListView_GetItemPosition($hWnd, $iIndex)
  2134. Return $aPoint[1]
  2135. EndFunc ;==>_GUICtrlListView_GetItemPositionY
  2136. ; #FUNCTION# ====================================================================================================================
  2137. ; Author ........: Paul Campbell (PaulIA)
  2138. ; Modified.......:
  2139. ; ===============================================================================================================================
  2140. Func _GUICtrlListView_GetItemRect($hWnd, $iIndex, $iPart = 3)
  2141. Local $tRECT = _GUICtrlListView_GetItemRectEx($hWnd, $iIndex, $iPart)
  2142. Local $aRect[4]
  2143. $aRect[0] = DllStructGetData($tRECT, "Left")
  2144. $aRect[1] = DllStructGetData($tRECT, "Top")
  2145. $aRect[2] = DllStructGetData($tRECT, "Right")
  2146. $aRect[3] = DllStructGetData($tRECT, "Bottom")
  2147. Return $aRect
  2148. EndFunc ;==>_GUICtrlListView_GetItemRect
  2149. ; #FUNCTION# ====================================================================================================================
  2150. ; Author ........: Paul Campbell (PaulIA)
  2151. ; Modified.......: Gary Frost (gafrost)
  2152. ; ===============================================================================================================================
  2153. Func _GUICtrlListView_GetItemRectEx($hWnd, $iIndex, $iPart = 3)
  2154. Local $tRECT = DllStructCreate($tagRECT)
  2155. DllStructSetData($tRECT, "Left", $iPart)
  2156. If IsHWnd($hWnd) Then
  2157. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2158. _SendMessage($hWnd, $LVM_GETITEMRECT, $iIndex, $tRECT, 0, "wparam", "struct*")
  2159. Else
  2160. Local $iRect = DllStructGetSize($tRECT)
  2161. Local $tMemMap
  2162. Local $pMemory = _MemInit($hWnd, $iRect, $tMemMap)
  2163. _MemWrite($tMemMap, $tRECT, $pMemory, $iRect)
  2164. _SendMessage($hWnd, $LVM_GETITEMRECT, $iIndex, $pMemory, 0, "wparam", "ptr")
  2165. _MemRead($tMemMap, $pMemory, $tRECT, $iRect)
  2166. _MemFree($tMemMap)
  2167. EndIf
  2168. Else
  2169. GUICtrlSendMsg($hWnd, $LVM_GETITEMRECT, $iIndex, DllStructGetPtr($tRECT))
  2170. EndIf
  2171. Return $tRECT
  2172. EndFunc ;==>_GUICtrlListView_GetItemRectEx
  2173. ; #FUNCTION# ====================================================================================================================
  2174. ; Author ........: Paul Campbell (PaulIA)
  2175. ; Modified.......:
  2176. ; ===============================================================================================================================
  2177. Func _GUICtrlListView_GetItemSelected($hWnd, $iIndex)
  2178. Return _GUICtrlListView_GetItemState($hWnd, $iIndex, $LVIS_SELECTED) <> 0
  2179. EndFunc ;==>_GUICtrlListView_GetItemSelected
  2180. ; #FUNCTION# ====================================================================================================================
  2181. ; Author ........: Paul Campbell (PaulIA)
  2182. ; Modified.......: Gary Frost (gafrost)
  2183. ; ===============================================================================================================================
  2184. Func _GUICtrlListView_GetItemSpacing($hWnd, $bSmall = False)
  2185. Local $iSpace
  2186. If IsHWnd($hWnd) Then
  2187. $iSpace = _SendMessage($hWnd, $LVM_GETITEMSPACING, $bSmall)
  2188. Else
  2189. $iSpace = GUICtrlSendMsg($hWnd, $LVM_GETITEMSPACING, $bSmall, 0)
  2190. EndIf
  2191. Local $aSpace[2]
  2192. $aSpace[0] = BitAND($iSpace, 0xFFFF)
  2193. $aSpace[1] = BitShift($iSpace, 16)
  2194. Return $aSpace
  2195. EndFunc ;==>_GUICtrlListView_GetItemSpacing
  2196. ; #FUNCTION# ====================================================================================================================
  2197. ; Author ........: Paul Campbell (PaulIA)
  2198. ; Modified.......: Gary Frost (gafrost)
  2199. ; ===============================================================================================================================
  2200. Func _GUICtrlListView_GetItemSpacingX($hWnd, $bSmall = False)
  2201. If IsHWnd($hWnd) Then
  2202. Return BitAND(_SendMessage($hWnd, $LVM_GETITEMSPACING, $bSmall, 0), 0xFFFF)
  2203. Else
  2204. Return BitAND(GUICtrlSendMsg($hWnd, $LVM_GETITEMSPACING, $bSmall, 0), 0xFFFF)
  2205. EndIf
  2206. EndFunc ;==>_GUICtrlListView_GetItemSpacingX
  2207. ; #FUNCTION# ====================================================================================================================
  2208. ; Author ........: Paul Campbell (PaulIA)
  2209. ; Modified.......: Gary Frost (gafrost)
  2210. ; ===============================================================================================================================
  2211. Func _GUICtrlListView_GetItemSpacingY($hWnd, $bSmall = False)
  2212. If IsHWnd($hWnd) Then
  2213. Return BitShift(_SendMessage($hWnd, $LVM_GETITEMSPACING, $bSmall, 0), 16)
  2214. Else
  2215. Return BitShift(GUICtrlSendMsg($hWnd, $LVM_GETITEMSPACING, $bSmall, 0), 16)
  2216. EndIf
  2217. EndFunc ;==>_GUICtrlListView_GetItemSpacingY
  2218. ; #FUNCTION# ====================================================================================================================
  2219. ; Author ........: Paul Campbell (PaulIA)
  2220. ; Modified.......: Gary Frost (gafrost)
  2221. ; ===============================================================================================================================
  2222. Func _GUICtrlListView_GetItemState($hWnd, $iIndex, $iMask)
  2223. If IsHWnd($hWnd) Then
  2224. Return _SendMessage($hWnd, $LVM_GETITEMSTATE, $iIndex, $iMask)
  2225. Else
  2226. Return GUICtrlSendMsg($hWnd, $LVM_GETITEMSTATE, $iIndex, $iMask)
  2227. EndIf
  2228. EndFunc ;==>_GUICtrlListView_GetItemState
  2229. ; #FUNCTION# ====================================================================================================================
  2230. ; Author ........: Paul Campbell (PaulIA)
  2231. ; Modified.......:
  2232. ; ===============================================================================================================================
  2233. Func _GUICtrlListView_GetItemStateImage($hWnd, $iIndex)
  2234. Return BitShift(_GUICtrlListView_GetItemState($hWnd, $iIndex, $LVIS_STATEIMAGEMASK), 12)
  2235. EndFunc ;==>_GUICtrlListView_GetItemStateImage
  2236. ; #FUNCTION# ====================================================================================================================
  2237. ; Author ........: Paul Campbell (PaulIA)
  2238. ; Modified.......: Gary Frost (gafrost)
  2239. ; ===============================================================================================================================
  2240. Func _GUICtrlListView_GetItemText($hWnd, $iIndex, $iSubItem = 0)
  2241. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  2242. Local $tBuffer
  2243. If $bUnicode Then
  2244. $tBuffer = DllStructCreate("wchar Text[4096]")
  2245. Else
  2246. $tBuffer = DllStructCreate("char Text[4096]")
  2247. EndIf
  2248. Local $pBuffer = DllStructGetPtr($tBuffer)
  2249. Local $tItem = DllStructCreate($tagLVITEM)
  2250. DllStructSetData($tItem, "SubItem", $iSubItem)
  2251. DllStructSetData($tItem, "TextMax", 4096)
  2252. If IsHWnd($hWnd) Then
  2253. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2254. DllStructSetData($tItem, "Text", $pBuffer)
  2255. _SendMessage($hWnd, $LVM_GETITEMTEXTW, $iIndex, $tItem, 0, "wparam", "struct*")
  2256. Else
  2257. Local $iItem = DllStructGetSize($tItem)
  2258. Local $tMemMap
  2259. Local $pMemory = _MemInit($hWnd, $iItem + 4096, $tMemMap)
  2260. Local $pText = $pMemory + $iItem
  2261. DllStructSetData($tItem, "Text", $pText)
  2262. _MemWrite($tMemMap, $tItem, $pMemory, $iItem)
  2263. If $bUnicode Then
  2264. _SendMessage($hWnd, $LVM_GETITEMTEXTW, $iIndex, $pMemory, 0, "wparam", "ptr")
  2265. Else
  2266. _SendMessage($hWnd, $LVM_GETITEMTEXTA, $iIndex, $pMemory, 0, "wparam", "ptr")
  2267. EndIf
  2268. _MemRead($tMemMap, $pText, $tBuffer, 4096)
  2269. _MemFree($tMemMap)
  2270. EndIf
  2271. Else
  2272. Local $pItem = DllStructGetPtr($tItem)
  2273. DllStructSetData($tItem, "Text", $pBuffer)
  2274. If $bUnicode Then
  2275. GUICtrlSendMsg($hWnd, $LVM_GETITEMTEXTW, $iIndex, $pItem)
  2276. Else
  2277. GUICtrlSendMsg($hWnd, $LVM_GETITEMTEXTA, $iIndex, $pItem)
  2278. EndIf
  2279. EndIf
  2280. Return DllStructGetData($tBuffer, "Text")
  2281. EndFunc ;==>_GUICtrlListView_GetItemText
  2282. ; #FUNCTION# ====================================================================================================================
  2283. ; Author ........: Gary Frost (gafrost)
  2284. ; Modified.......:
  2285. ; ===============================================================================================================================
  2286. Func _GUICtrlListView_GetItemTextArray($hWnd, $iItem = -1)
  2287. Local $sItems = _GUICtrlListView_GetItemTextString($hWnd, $iItem)
  2288. If $sItems = "" Then
  2289. Local $aItems[1] = [0]
  2290. Return SetError($LV_ERR, $LV_ERR, $aItems)
  2291. EndIf
  2292. Return StringSplit($sItems, Opt('GUIDataSeparatorChar'))
  2293. EndFunc ;==>_GUICtrlListView_GetItemTextArray
  2294. ; #FUNCTION# ====================================================================================================================
  2295. ; Author ........: Gary Frost (gafrost)
  2296. ; Modified.......:
  2297. ; ===============================================================================================================================
  2298. Func _GUICtrlListView_GetItemTextString($hWnd, $iItem = -1)
  2299. Local $sRow = "", $sSeparatorChar = Opt('GUIDataSeparatorChar'), $iSelected
  2300. If $iItem = -1 Then
  2301. $iSelected = _GUICtrlListView_GetNextItem($hWnd) ; get current row selected
  2302. Else
  2303. $iSelected = $iItem ; get row
  2304. EndIf
  2305. For $x = 0 To _GUICtrlListView_GetColumnCount($hWnd) - 1
  2306. $sRow &= _GUICtrlListView_GetItemText($hWnd, $iSelected, $x) & $sSeparatorChar
  2307. Next
  2308. Return StringTrimRight($sRow, 1)
  2309. EndFunc ;==>_GUICtrlListView_GetItemTextString
  2310. ; #FUNCTION# ====================================================================================================================
  2311. ; Author ........: Paul Campbell (PaulIA)
  2312. ; Modified.......:
  2313. ; ===============================================================================================================================
  2314. Func _GUICtrlListView_GetNextItem($hWnd, $iStart = -1, $iSearch = 0, $iState = 8)
  2315. Local $aSearch[5] = [$LVNI_ALL, $LVNI_ABOVE, $LVNI_BELOW, $LVNI_TOLEFT, $LVNI_TORIGHT]
  2316. Local $iFlags = $aSearch[$iSearch]
  2317. If BitAND($iState, 1) <> 0 Then $iFlags = BitOR($iFlags, $LVNI_CUT)
  2318. If BitAND($iState, 2) <> 0 Then $iFlags = BitOR($iFlags, $LVNI_DROPHILITED)
  2319. If BitAND($iState, 4) <> 0 Then $iFlags = BitOR($iFlags, $LVNI_FOCUSED)
  2320. If BitAND($iState, 8) <> 0 Then $iFlags = BitOR($iFlags, $LVNI_SELECTED)
  2321. If IsHWnd($hWnd) Then
  2322. Return _SendMessage($hWnd, $LVM_GETNEXTITEM, $iStart, $iFlags)
  2323. Else
  2324. Return GUICtrlSendMsg($hWnd, $LVM_GETNEXTITEM, $iStart, $iFlags)
  2325. EndIf
  2326. EndFunc ;==>_GUICtrlListView_GetNextItem
  2327. ; #FUNCTION# ====================================================================================================================
  2328. ; Author ........: Paul Campbell (PaulIA)
  2329. ; Modified.......: Gary Frost (gafrost)
  2330. ; ===============================================================================================================================
  2331. Func _GUICtrlListView_GetNumberOfWorkAreas($hWnd)
  2332. Local $tBuffer = DllStructCreate("int Data")
  2333. If IsHWnd($hWnd) Then
  2334. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2335. _SendMessage($hWnd, $LVM_GETNUMBEROFWORKAREAS, 0, $tBuffer, 0, "wparam", "struct*")
  2336. Else
  2337. Local $iBuffer = DllStructGetSize($tBuffer)
  2338. Local $tMemMap
  2339. Local $pMemory = _MemInit($hWnd, $iBuffer, $tMemMap)
  2340. _SendMessage($hWnd, $LVM_GETNUMBEROFWORKAREAS, 0, $pMemory, 0, "wparam", "ptr")
  2341. _MemRead($tMemMap, $pMemory, $tBuffer, $iBuffer)
  2342. _MemFree($tMemMap)
  2343. EndIf
  2344. Else
  2345. GUICtrlSendMsg($hWnd, $LVM_GETNUMBEROFWORKAREAS, 0, DllStructGetPtr($tBuffer))
  2346. EndIf
  2347. Return DllStructGetData($tBuffer, "Data")
  2348. EndFunc ;==>_GUICtrlListView_GetNumberOfWorkAreas
  2349. ; #FUNCTION# ====================================================================================================================
  2350. ; Author ........: Paul Campbell (PaulIA)
  2351. ; Modified.......: Gary Frost (gafrost)
  2352. ; ===============================================================================================================================
  2353. Func _GUICtrlListView_GetOrigin($hWnd)
  2354. Local $tPoint = DllStructCreate($tagPOINT)
  2355. Local $iRet
  2356. If IsHWnd($hWnd) Then
  2357. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2358. $iRet = _SendMessage($hWnd, $LVM_GETORIGIN, 0, $tPoint, 0, "wparam", "struct*")
  2359. Else
  2360. Local $iPoint = DllStructGetSize($tPoint)
  2361. Local $tMemMap
  2362. Local $pMemory = _MemInit($hWnd, $iPoint, $tMemMap)
  2363. $iRet = _SendMessage($hWnd, $LVM_GETORIGIN, 0, $pMemory, 0, "wparam", "ptr")
  2364. _MemRead($tMemMap, $pMemory, $tPoint, $iPoint)
  2365. _MemFree($tMemMap)
  2366. EndIf
  2367. Else
  2368. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETORIGIN, 0, DllStructGetPtr($tPoint))
  2369. EndIf
  2370. Local $aOrigin[2]
  2371. $aOrigin[0] = DllStructGetData($tPoint, "X")
  2372. $aOrigin[1] = DllStructGetData($tPoint, "Y")
  2373. Return SetError(@error, $iRet = 1, $aOrigin)
  2374. EndFunc ;==>_GUICtrlListView_GetOrigin
  2375. ; #FUNCTION# ====================================================================================================================
  2376. ; Author ........: Paul Campbell (PaulIA)
  2377. ; Modified.......:
  2378. ; ===============================================================================================================================
  2379. Func _GUICtrlListView_GetOriginX($hWnd)
  2380. Local $aOrigin = _GUICtrlListView_GetOrigin($hWnd)
  2381. Return $aOrigin[0]
  2382. EndFunc ;==>_GUICtrlListView_GetOriginX
  2383. ; #FUNCTION# ====================================================================================================================
  2384. ; Author ........: Paul Campbell (PaulIA)
  2385. ; Modified.......:
  2386. ; ===============================================================================================================================
  2387. Func _GUICtrlListView_GetOriginY($hWnd)
  2388. Local $aOrigin = _GUICtrlListView_GetOrigin($hWnd)
  2389. Return $aOrigin[1]
  2390. EndFunc ;==>_GUICtrlListView_GetOriginY
  2391. ; #FUNCTION# ====================================================================================================================
  2392. ; Author ........: Paul Campbell (PaulIA)
  2393. ; Modified.......: Gary Frost (gafrost)
  2394. ; ===============================================================================================================================
  2395. Func _GUICtrlListView_GetOutlineColor($hWnd)
  2396. If IsHWnd($hWnd) Then
  2397. Return _SendMessage($hWnd, $LVM_GETOUTLINECOLOR)
  2398. Else
  2399. Return GUICtrlSendMsg($hWnd, $LVM_GETOUTLINECOLOR, 0, 0)
  2400. EndIf
  2401. EndFunc ;==>_GUICtrlListView_GetOutlineColor
  2402. ; #FUNCTION# ====================================================================================================================
  2403. ; Author ........: Paul Campbell (PaulIA)
  2404. ; Modified.......: Gary Frost (gafrost)
  2405. ; ===============================================================================================================================
  2406. Func _GUICtrlListView_GetSelectedColumn($hWnd)
  2407. If IsHWnd($hWnd) Then
  2408. Return _SendMessage($hWnd, $LVM_GETSELECTEDCOLUMN)
  2409. Else
  2410. Return GUICtrlSendMsg($hWnd, $LVM_GETSELECTEDCOLUMN, 0, 0)
  2411. EndIf
  2412. EndFunc ;==>_GUICtrlListView_GetSelectedColumn
  2413. ; #FUNCTION# ====================================================================================================================
  2414. ; Author ........: Gary Frost (gafrost)
  2415. ; Modified.......:
  2416. ; ===============================================================================================================================
  2417. Func _GUICtrlListView_GetSelectedCount($hWnd)
  2418. If IsHWnd($hWnd) Then
  2419. Return _SendMessage($hWnd, $LVM_GETSELECTEDCOUNT)
  2420. Else
  2421. Return GUICtrlSendMsg($hWnd, $LVM_GETSELECTEDCOUNT, 0, 0)
  2422. EndIf
  2423. EndFunc ;==>_GUICtrlListView_GetSelectedCount
  2424. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  2425. ; Name...........: __GUICtrlListView_GetCheckedIndices
  2426. ; Description ...: Retrieve indices of checked item(s)
  2427. ; Syntax.........: __GUICtrlListView_GetCheckedIndices ( $hWnd )
  2428. ; Parameters ....: $hWnd - Handle to the control
  2429. ; Return values .: Success - Checked indices Based on $bArray:
  2430. ; +Array - With the following format
  2431. ; |[0] - Number of Items in array (n)
  2432. ; |[1] - First item index
  2433. ; |[2] - Second item index
  2434. ; |[n] - Last item index
  2435. ; Failure - Based on $bArray
  2436. ; |Array - With the following format
  2437. ; |[0] - Number of Items in array (0)
  2438. ; Author ........: jpm
  2439. ; Modified.......: Melba23 (based on code by benners)
  2440. ; Remarks .......:
  2441. ; Related .......:
  2442. ; Link ..........:
  2443. ; Example .......: Yes
  2444. ; ===============================================================================================================================
  2445. Func __GUICtrlListView_GetCheckedIndices($hWnd)
  2446. Local $iCount = _GUICtrlListView_GetItemCount($hWnd)
  2447. ; Create max size array
  2448. Local $aSelected[$iCount + 1] = [0]
  2449. For $i = 0 To $iCount - 1
  2450. If _GUICtrlListView_GetItemChecked($hWnd, $i) Then
  2451. $aSelected[0] += 1
  2452. $aSelected[$aSelected[0]] = $i
  2453. EndIf
  2454. Next
  2455. ; Remove unfilled elements
  2456. ReDim $aSelected[$aSelected[0] + 1]
  2457. Return $aSelected
  2458. EndFunc ;==>__GUICtrlListView_GetCheckedIndices
  2459. ; #FUNCTION# ====================================================================================================================
  2460. ; Author ........: Gary Frost (gafrost)
  2461. ; Modified.......:
  2462. ; ===============================================================================================================================
  2463. Func _GUICtrlListView_GetSelectedIndices($hWnd, $bArray = False)
  2464. Local $sIndices, $aIndices[1] = [0]
  2465. Local $iRet, $iCount = _GUICtrlListView_GetItemCount($hWnd)
  2466. For $iItem = 0 To $iCount
  2467. If IsHWnd($hWnd) Then
  2468. $iRet = _SendMessage($hWnd, $LVM_GETITEMSTATE, $iItem, $LVIS_SELECTED)
  2469. Else
  2470. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETITEMSTATE, $iItem, $LVIS_SELECTED)
  2471. EndIf
  2472. If $iRet Then
  2473. If (Not $bArray) Then
  2474. If StringLen($sIndices) Then
  2475. $sIndices &= "|" & $iItem
  2476. Else
  2477. $sIndices = $iItem
  2478. EndIf
  2479. Else
  2480. ReDim $aIndices[UBound($aIndices) + 1]
  2481. $aIndices[0] = UBound($aIndices) - 1
  2482. $aIndices[UBound($aIndices) - 1] = $iItem
  2483. EndIf
  2484. EndIf
  2485. Next
  2486. If (Not $bArray) Then
  2487. Return String($sIndices)
  2488. Else
  2489. Return $aIndices
  2490. EndIf
  2491. EndFunc ;==>_GUICtrlListView_GetSelectedIndices
  2492. ; #FUNCTION# ====================================================================================================================
  2493. ; Author ........: Paul Campbell (PaulIA)
  2494. ; Modified.......: Gary Frost (gafrost)
  2495. ; ===============================================================================================================================
  2496. Func _GUICtrlListView_GetSelectionMark($hWnd)
  2497. If IsHWnd($hWnd) Then
  2498. Return _SendMessage($hWnd, $LVM_GETSELECTIONMARK)
  2499. Else
  2500. Return GUICtrlSendMsg($hWnd, $LVM_GETSELECTIONMARK, 0, 0)
  2501. EndIf
  2502. EndFunc ;==>_GUICtrlListView_GetSelectionMark
  2503. ; #FUNCTION# ====================================================================================================================
  2504. ; Author ........: Paul Campbell (PaulIA)
  2505. ; Modified.......: Gary Frost (gafrost)
  2506. ; ===============================================================================================================================
  2507. Func _GUICtrlListView_GetStringWidth($hWnd, $sString)
  2508. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  2509. Local $iBuffer = StringLen($sString) + 1
  2510. Local $tBuffer
  2511. If $bUnicode Then
  2512. $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  2513. $iBuffer *= 2
  2514. Else
  2515. $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
  2516. EndIf
  2517. DllStructSetData($tBuffer, "Text", $sString)
  2518. Local $iRet
  2519. If IsHWnd($hWnd) Then
  2520. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2521. $iRet = _SendMessage($hWnd, $LVM_GETSTRINGWIDTHW, 0, $tBuffer, 0, "wparam", "struct*")
  2522. Else
  2523. Local $tMemMap
  2524. Local $pMemory = _MemInit($hWnd, $iBuffer, $tMemMap)
  2525. _MemWrite($tMemMap, $tBuffer, $pMemory, $iBuffer)
  2526. If $bUnicode Then
  2527. $iRet = _SendMessage($hWnd, $LVM_GETSTRINGWIDTHW, 0, $pMemory, 0, "wparam", "ptr")
  2528. Else
  2529. $iRet = _SendMessage($hWnd, $LVM_GETSTRINGWIDTHA, 0, $pMemory, 0, "wparam", "ptr")
  2530. EndIf
  2531. _MemRead($tMemMap, $pMemory, $tBuffer, $iBuffer)
  2532. _MemFree($tMemMap)
  2533. EndIf
  2534. Else
  2535. Local $pBuffer = DllStructGetPtr($tBuffer)
  2536. If $bUnicode Then
  2537. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETSTRINGWIDTHW, 0, $pBuffer)
  2538. Else
  2539. $iRet = GUICtrlSendMsg($hWnd, $LVM_GETSTRINGWIDTHA, 0, $pBuffer)
  2540. EndIf
  2541. EndIf
  2542. Return $iRet
  2543. EndFunc ;==>_GUICtrlListView_GetStringWidth
  2544. ; #FUNCTION# ====================================================================================================================
  2545. ; Author ........: Paul Campbell (PaulIA)
  2546. ; Modified.......: Gary Frost (gafrost)
  2547. ; ===============================================================================================================================
  2548. Func _GUICtrlListView_GetSubItemRect($hWnd, $iIndex, $iSubItem, $iPart = 0)
  2549. Local $aPart[2] = [$LVIR_BOUNDS, $LVIR_ICON]
  2550. Local $tRECT = DllStructCreate($tagRECT)
  2551. DllStructSetData($tRECT, "Top", $iSubItem)
  2552. DllStructSetData($tRECT, "Left", $aPart[$iPart])
  2553. If IsHWnd($hWnd) Then
  2554. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2555. _SendMessage($hWnd, $LVM_GETSUBITEMRECT, $iIndex, $tRECT, 0, "wparam", "struct*")
  2556. Else
  2557. Local $iRect = DllStructGetSize($tRECT)
  2558. Local $tMemMap
  2559. Local $pMemory = _MemInit($hWnd, $iRect, $tMemMap)
  2560. _MemWrite($tMemMap, $tRECT, $pMemory, $iRect)
  2561. _SendMessage($hWnd, $LVM_GETSUBITEMRECT, $iIndex, $pMemory, 0, "wparam", "ptr")
  2562. _MemRead($tMemMap, $pMemory, $tRECT, $iRect)
  2563. _MemFree($tMemMap)
  2564. EndIf
  2565. Else
  2566. GUICtrlSendMsg($hWnd, $LVM_GETSUBITEMRECT, $iIndex, DllStructGetPtr($tRECT))
  2567. EndIf
  2568. Local $aRect[4]
  2569. $aRect[0] = DllStructGetData($tRECT, "Left")
  2570. $aRect[1] = DllStructGetData($tRECT, "Top")
  2571. $aRect[2] = DllStructGetData($tRECT, "Right")
  2572. $aRect[3] = DllStructGetData($tRECT, "Bottom")
  2573. Return $aRect
  2574. EndFunc ;==>_GUICtrlListView_GetSubItemRect
  2575. ; #FUNCTION# ====================================================================================================================
  2576. ; Author ........: Paul Campbell (PaulIA)
  2577. ; Modified.......: Gary Frost (gafrost)
  2578. ; ===============================================================================================================================
  2579. Func _GUICtrlListView_GetTextBkColor($hWnd)
  2580. If IsHWnd($hWnd) Then
  2581. Return _SendMessage($hWnd, $LVM_GETTEXTBKCOLOR)
  2582. Else
  2583. Return GUICtrlSendMsg($hWnd, $LVM_GETTEXTBKCOLOR, 0, 0)
  2584. EndIf
  2585. EndFunc ;==>_GUICtrlListView_GetTextBkColor
  2586. ; #FUNCTION# ====================================================================================================================
  2587. ; Author ........: Paul Campbell (PaulIA)
  2588. ; Modified.......: Gary Frost (gafrost)
  2589. ; ===============================================================================================================================
  2590. Func _GUICtrlListView_GetTextColor($hWnd)
  2591. If IsHWnd($hWnd) Then
  2592. Return _SendMessage($hWnd, $LVM_GETTEXTCOLOR)
  2593. Else
  2594. Return GUICtrlSendMsg($hWnd, $LVM_GETTEXTCOLOR, 0, 0)
  2595. EndIf
  2596. EndFunc ;==>_GUICtrlListView_GetTextColor
  2597. ; #FUNCTION# ====================================================================================================================
  2598. ; Author ........: Paul Campbell (PaulIA)
  2599. ; Modified.......: Gary Frost (gafrost)
  2600. ; ===============================================================================================================================
  2601. Func _GUICtrlListView_GetToolTips($hWnd)
  2602. If IsHWnd($hWnd) Then
  2603. Return HWnd(_SendMessage($hWnd, $LVM_GETTOOLTIPS))
  2604. Else
  2605. Return HWnd(GUICtrlSendMsg($hWnd, $LVM_GETTOOLTIPS, 0, 0))
  2606. EndIf
  2607. EndFunc ;==>_GUICtrlListView_GetToolTips
  2608. ; #FUNCTION# ====================================================================================================================
  2609. ; Author ........: Gary Frost (gafrost)
  2610. ; Modified.......:
  2611. ; ===============================================================================================================================
  2612. Func _GUICtrlListView_GetTopIndex($hWnd)
  2613. If IsHWnd($hWnd) Then
  2614. Return _SendMessage($hWnd, $LVM_GETTOPINDEX)
  2615. Else
  2616. Return GUICtrlSendMsg($hWnd, $LVM_GETTOPINDEX, 0, 0)
  2617. EndIf
  2618. EndFunc ;==>_GUICtrlListView_GetTopIndex
  2619. ; #FUNCTION# ====================================================================================================================
  2620. ; Author ........: Gary Frost (gafrost)
  2621. ; Modified.......:
  2622. ; ===============================================================================================================================
  2623. Func _GUICtrlListView_GetUnicodeFormat($hWnd)
  2624. If IsHWnd($hWnd) Then
  2625. Return _SendMessage($hWnd, $LVM_GETUNICODEFORMAT) <> 0
  2626. Else
  2627. Return GUICtrlSendMsg($hWnd, $LVM_GETUNICODEFORMAT, 0, 0) <> 0
  2628. EndIf
  2629. EndFunc ;==>_GUICtrlListView_GetUnicodeFormat
  2630. ; #FUNCTION# ====================================================================================================================
  2631. ; Author ........: Paul Campbell (PaulIA)
  2632. ; Modified.......: Gary Frost (gafrost)
  2633. ; ===============================================================================================================================
  2634. Func _GUICtrlListView_GetView($hWnd)
  2635. Local $iView
  2636. If IsHWnd($hWnd) Then
  2637. $iView = _SendMessage($hWnd, $LVM_GETVIEW)
  2638. Else
  2639. $iView = GUICtrlSendMsg($hWnd, $LVM_GETVIEW, 0, 0)
  2640. EndIf
  2641. Switch $iView
  2642. Case $LV_VIEW_ICON
  2643. Return Int($LV_VIEW_ICON)
  2644. Case $LV_VIEW_DETAILS
  2645. Return Int($LV_VIEW_DETAILS)
  2646. Case $LV_VIEW_LIST
  2647. Return Int($LV_VIEW_LIST)
  2648. Case $LV_VIEW_SMALLICON
  2649. Return Int($LV_VIEW_SMALLICON)
  2650. Case $LV_VIEW_TILE
  2651. Return Int($LV_VIEW_TILE)
  2652. Case Else
  2653. Return -1
  2654. EndSwitch
  2655. EndFunc ;==>_GUICtrlListView_GetView
  2656. ; #FUNCTION# ====================================================================================================================
  2657. ; Author ........: Paul Campbell (PaulIA)
  2658. ; Modified.......:
  2659. ; ===============================================================================================================================
  2660. Func _GUICtrlListView_GetViewDetails($hWnd)
  2661. Return _GUICtrlListView_GetView($hWnd) = $LV_VIEW_DETAILS
  2662. EndFunc ;==>_GUICtrlListView_GetViewDetails
  2663. ; #FUNCTION# ====================================================================================================================
  2664. ; Author ........: Paul Campbell (PaulIA)
  2665. ; Modified.......:
  2666. ; ===============================================================================================================================
  2667. Func _GUICtrlListView_GetViewLarge($hWnd)
  2668. Return _GUICtrlListView_GetView($hWnd) = $LV_VIEW_ICON
  2669. EndFunc ;==>_GUICtrlListView_GetViewLarge
  2670. ; #FUNCTION# ====================================================================================================================
  2671. ; Author ........: Paul Campbell (PaulIA)
  2672. ; Modified.......:
  2673. ; ===============================================================================================================================
  2674. Func _GUICtrlListView_GetViewList($hWnd)
  2675. Return _GUICtrlListView_GetView($hWnd) = $LV_VIEW_LIST
  2676. EndFunc ;==>_GUICtrlListView_GetViewList
  2677. ; #FUNCTION# ====================================================================================================================
  2678. ; Author ........: Paul Campbell (PaulIA)
  2679. ; Modified.......:
  2680. ; ===============================================================================================================================
  2681. Func _GUICtrlListView_GetViewSmall($hWnd)
  2682. Return _GUICtrlListView_GetView($hWnd) = $LV_VIEW_SMALLICON
  2683. EndFunc ;==>_GUICtrlListView_GetViewSmall
  2684. ; #FUNCTION# ====================================================================================================================
  2685. ; Author ........: Paul Campbell (PaulIA)
  2686. ; Modified.......:
  2687. ; ===============================================================================================================================
  2688. Func _GUICtrlListView_GetViewTile($hWnd)
  2689. Return _GUICtrlListView_GetView($hWnd) = $LV_VIEW_TILE
  2690. EndFunc ;==>_GUICtrlListView_GetViewTile
  2691. ; #FUNCTION# ====================================================================================================================
  2692. ; Author ........: Paul Campbell (PaulIA)
  2693. ; Modified.......: Gary Frost (gafrost)
  2694. ; ===============================================================================================================================
  2695. Func _GUICtrlListView_GetViewRect($hWnd)
  2696. Local $aRect[4] = [0, 0, 0, 0]
  2697. Local $iView = _GUICtrlListView_GetView($hWnd)
  2698. If ($iView <> 1) And ($iView <> 3) Then Return $aRect
  2699. Local $tRECT = DllStructCreate($tagRECT)
  2700. If IsHWnd($hWnd) Then
  2701. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2702. _SendMessage($hWnd, $LVM_GETVIEWRECT, 0, $tRECT, 0, "wparam", "struct*")
  2703. Else
  2704. Local $iRect = DllStructGetSize($tRECT)
  2705. Local $tMemMap
  2706. Local $pMemory = _MemInit($hWnd, $iRect, $tMemMap)
  2707. _SendMessage($hWnd, $LVM_GETVIEWRECT, 0, $pMemory, 0, "wparam", "ptr")
  2708. _MemRead($tMemMap, $pMemory, $tRECT, $iRect)
  2709. _MemFree($tMemMap)
  2710. EndIf
  2711. Else
  2712. GUICtrlSendMsg($hWnd, $LVM_GETVIEWRECT, 0, DllStructGetPtr($tRECT))
  2713. EndIf
  2714. $aRect[0] = DllStructGetData($tRECT, "Left")
  2715. $aRect[1] = DllStructGetData($tRECT, "Top")
  2716. $aRect[2] = DllStructGetData($tRECT, "Right")
  2717. $aRect[3] = DllStructGetData($tRECT, "Bottom")
  2718. Return $aRect
  2719. EndFunc ;==>_GUICtrlListView_GetViewRect
  2720. ; #FUNCTION# ====================================================================================================================
  2721. ; Author ........: Gary Frost (gafrost)
  2722. ; Modified.......:
  2723. ; ===============================================================================================================================
  2724. Func _GUICtrlListView_HideColumn($hWnd, $iCol)
  2725. If IsHWnd($hWnd) Then
  2726. Return _SendMessage($hWnd, $LVM_SETCOLUMNWIDTH, $iCol) <> 0
  2727. Else
  2728. Return GUICtrlSendMsg($hWnd, $LVM_SETCOLUMNWIDTH, $iCol, 0) <> 0
  2729. EndIf
  2730. EndFunc ;==>_GUICtrlListView_HideColumn
  2731. ; #FUNCTION# ====================================================================================================================
  2732. ; Author ........: Paul Campbell (PaulIA)
  2733. ; Modified.......: Gary Frost (gafrost)
  2734. ; ===============================================================================================================================
  2735. Func _GUICtrlListView_HitTest($hWnd, $iX = -1, $iY = -1)
  2736. Local $aTest[10]
  2737. Local $iMode = Opt("MouseCoordMode", 1)
  2738. Local $aPos = MouseGetPos()
  2739. Opt("MouseCoordMode", $iMode)
  2740. Local $tPoint = DllStructCreate($tagPOINT)
  2741. DllStructSetData($tPoint, "X", $aPos[0])
  2742. DllStructSetData($tPoint, "Y", $aPos[1])
  2743. Local $aResult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hWnd, "struct*", $tPoint)
  2744. If @error Then Return SetError(@error, @extended, 0)
  2745. If $aResult[0] = 0 Then Return 0
  2746. If $iX = -1 Then $iX = DllStructGetData($tPoint, "X")
  2747. If $iY = -1 Then $iY = DllStructGetData($tPoint, "Y")
  2748. Local $tTest = DllStructCreate($tagLVHITTESTINFO)
  2749. DllStructSetData($tTest, "X", $iX)
  2750. DllStructSetData($tTest, "Y", $iY)
  2751. If IsHWnd($hWnd) Then
  2752. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2753. $aTest[0] = _SendMessage($hWnd, $LVM_HITTEST, 0, $tTest, 0, "wparam", "struct*")
  2754. Else
  2755. Local $iTest = DllStructGetSize($tTest)
  2756. Local $tMemMap
  2757. Local $pMemory = _MemInit($hWnd, $iTest, $tMemMap)
  2758. _MemWrite($tMemMap, $tTest, $pMemory, $iTest)
  2759. $aTest[0] = _SendMessage($hWnd, $LVM_HITTEST, 0, $pMemory, 0, "wparam", "ptr")
  2760. _MemRead($tMemMap, $pMemory, $tTest, $iTest)
  2761. _MemFree($tMemMap)
  2762. EndIf
  2763. Else
  2764. $aTest[0] = GUICtrlSendMsg($hWnd, $LVM_HITTEST, 0, DllStructGetPtr($tTest))
  2765. EndIf
  2766. Local $iFlags = DllStructGetData($tTest, "Flags")
  2767. $aTest[1] = BitAND($iFlags, $LVHT_NOWHERE) <> 0
  2768. $aTest[2] = BitAND($iFlags, $LVHT_ONITEMICON) <> 0
  2769. $aTest[3] = BitAND($iFlags, $LVHT_ONITEMLABEL) <> 0
  2770. $aTest[4] = BitAND($iFlags, $LVHT_ONITEMSTATEICON) <> 0
  2771. $aTest[5] = BitAND($iFlags, $LVHT_ONITEM) <> 0
  2772. $aTest[6] = BitAND($iFlags, $LVHT_ABOVE) <> 0
  2773. $aTest[7] = BitAND($iFlags, $LVHT_BELOW) <> 0
  2774. $aTest[8] = BitAND($iFlags, $LVHT_TOLEFT) <> 0
  2775. $aTest[9] = BitAND($iFlags, $LVHT_TORIGHT) <> 0
  2776. Return $aTest
  2777. EndFunc ;==>_GUICtrlListView_HitTest
  2778. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  2779. ; Name...........: __GUICtrlListView_IndexToOverlayImageMask
  2780. ; Description ...: Converts an image index to a overlay image mask
  2781. ; Syntax.........: __GUICtrlListView_IndexToOverlayImageMask ( $iIndex )
  2782. ; Parameters ....: $iIndex - One based overlay index
  2783. ; Return values .: Success - Image index mask
  2784. ; Author ........: Paul Campbell (PaulIA)
  2785. ; Modified.......:
  2786. ; Remarks .......: This function is used internally and should not normally be called
  2787. ; Related .......: __GUICtrlListView_OverlayImageMaskToIndex
  2788. ; Link ..........:
  2789. ; Example .......:
  2790. ; ===============================================================================================================================
  2791. Func __GUICtrlListView_IndexToOverlayImageMask($iIndex)
  2792. Return BitShift($iIndex, -8)
  2793. EndFunc ;==>__GUICtrlListView_IndexToOverlayImageMask
  2794. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  2795. ; Name...........: __GUICtrlListView_IndexToStateImageMask
  2796. ; Description ...: Converts an image index to a state image mask
  2797. ; Syntax.........: __GUICtrlListView_IndexToStateImageMask ( $iIndex )
  2798. ; Parameters ....: $iIndex - One based image index
  2799. ; Return values .: Success - Image index mask
  2800. ; Author ........: Paul Campbell (PaulIA)
  2801. ; Modified.......:
  2802. ; Remarks .......: This function is used internally and should not normally be called
  2803. ; Related .......: __GUICtrlListView_StateImageMaskToIndex
  2804. ; Link ..........:
  2805. ; Example .......:
  2806. ; ===============================================================================================================================
  2807. Func __GUICtrlListView_IndexToStateImageMask($iIndex)
  2808. Return BitShift($iIndex, -12)
  2809. EndFunc ;==>__GUICtrlListView_IndexToStateImageMask
  2810. ; #FUNCTION# ====================================================================================================================
  2811. ; Author ........: Paul Campbell (PaulIA)
  2812. ; Modified.......: Gary Frost (gafrost)
  2813. ; ===============================================================================================================================
  2814. Func _GUICtrlListView_InsertColumn($hWnd, $iIndex, $sText, $iWidth = 50, $iAlign = -1, $iImage = -1, $bOnRight = False)
  2815. Local $aAlign[3] = [$LVCFMT_LEFT, $LVCFMT_RIGHT, $LVCFMT_CENTER]
  2816. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  2817. Local $iBuffer = StringLen($sText) + 1
  2818. Local $tBuffer
  2819. If $bUnicode Then
  2820. $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  2821. $iBuffer *= 2
  2822. Else
  2823. $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
  2824. EndIf
  2825. Local $pBuffer = DllStructGetPtr($tBuffer)
  2826. Local $tColumn = DllStructCreate($tagLVCOLUMN)
  2827. Local $iMask = BitOR($LVCF_FMT, $LVCF_WIDTH, $LVCF_TEXT)
  2828. If $iAlign < 0 Or $iAlign > 2 Then $iAlign = 0
  2829. Local $iFmt = $aAlign[$iAlign]
  2830. If $iImage <> -1 Then
  2831. $iMask = BitOR($iMask, $LVCF_IMAGE)
  2832. $iFmt = BitOR($iFmt, $LVCFMT_COL_HAS_IMAGES, $LVCFMT_IMAGE)
  2833. EndIf
  2834. If $bOnRight Then $iFmt = BitOR($iFmt, $LVCFMT_BITMAP_ON_RIGHT)
  2835. DllStructSetData($tBuffer, "Text", $sText)
  2836. DllStructSetData($tColumn, "Mask", $iMask)
  2837. DllStructSetData($tColumn, "Fmt", $iFmt)
  2838. DllStructSetData($tColumn, "CX", $iWidth)
  2839. DllStructSetData($tColumn, "TextMax", $iBuffer)
  2840. DllStructSetData($tColumn, "Image", $iImage)
  2841. Local $iRet
  2842. If IsHWnd($hWnd) Then
  2843. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2844. DllStructSetData($tColumn, "Text", $pBuffer)
  2845. $iRet = _SendMessage($hWnd, $LVM_INSERTCOLUMNW, $iIndex, $tColumn, 0, "wparam", "struct*")
  2846. Else
  2847. Local $iColumn = DllStructGetSize($tColumn)
  2848. Local $tMemMap
  2849. Local $pMemory = _MemInit($hWnd, $iColumn + $iBuffer, $tMemMap)
  2850. Local $pText = $pMemory + $iColumn
  2851. DllStructSetData($tColumn, "Text", $pText)
  2852. _MemWrite($tMemMap, $tColumn, $pMemory, $iColumn)
  2853. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  2854. If $bUnicode Then
  2855. $iRet = _SendMessage($hWnd, $LVM_INSERTCOLUMNW, $iIndex, $pMemory, 0, "wparam", "ptr")
  2856. Else
  2857. $iRet = _SendMessage($hWnd, $LVM_INSERTCOLUMNA, $iIndex, $pMemory, 0, "wparam", "ptr")
  2858. EndIf
  2859. _MemFree($tMemMap)
  2860. EndIf
  2861. Else
  2862. Local $pColumn = DllStructGetPtr($tColumn)
  2863. DllStructSetData($tColumn, "Text", $pBuffer)
  2864. If $bUnicode Then
  2865. $iRet = GUICtrlSendMsg($hWnd, $LVM_INSERTCOLUMNW, $iIndex, $pColumn)
  2866. Else
  2867. $iRet = GUICtrlSendMsg($hWnd, $LVM_INSERTCOLUMNA, $iIndex, $pColumn)
  2868. EndIf
  2869. EndIf
  2870. ; added, not sure why justification is not working on insert
  2871. If $iAlign > 0 Then _GUICtrlListView_SetColumn($hWnd, $iRet, $sText, $iWidth, $iAlign, $iImage, $bOnRight)
  2872. Return $iRet
  2873. EndFunc ;==>_GUICtrlListView_InsertColumn
  2874. ; #FUNCTION# ====================================================================================================================
  2875. ; Author ........: Yoan Roblet (Arcker), Paul Campbell (PaulIA)
  2876. ; Modified.......: Gary Frost (gafrost)
  2877. ; ===============================================================================================================================
  2878. Func _GUICtrlListView_InsertGroup($hWnd, $iIndex, $iGroupID, $sHeader, $iAlign = 0)
  2879. Local $aAlign[3] = [$LVGA_HEADER_LEFT, $LVGA_HEADER_CENTER, $LVGA_HEADER_RIGHT]
  2880. If $iAlign < 0 Or $iAlign > 2 Then $iAlign = 0
  2881. Local $tHeader = _WinAPI_MultiByteToWideChar($sHeader)
  2882. Local $pHeader = DllStructGetPtr($tHeader)
  2883. Local $iHeader = StringLen($sHeader)
  2884. Local $tGroup = DllStructCreate($tagLVGROUP)
  2885. Local $iGroup = DllStructGetSize($tGroup)
  2886. Local $iMask = BitOR($LVGF_HEADER, $LVGF_ALIGN, $LVGF_GROUPID)
  2887. DllStructSetData($tGroup, "Size", $iGroup)
  2888. DllStructSetData($tGroup, "Mask", $iMask)
  2889. DllStructSetData($tGroup, "HeaderMax", $iHeader)
  2890. DllStructSetData($tGroup, "GroupID", $iGroupID)
  2891. DllStructSetData($tGroup, "Align", $aAlign[$iAlign])
  2892. Local $iRet
  2893. If IsHWnd($hWnd) Then
  2894. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  2895. DllStructSetData($tGroup, "Header", $pHeader)
  2896. $iRet = _SendMessage($hWnd, $LVM_INSERTGROUP, $iIndex, $tGroup, 0, "wparam", "struct*")
  2897. Else
  2898. Local $tMemMap
  2899. Local $pMemory = _MemInit($hWnd, $iGroup + $iHeader, $tMemMap)
  2900. Local $pText = $pMemory + $iGroup
  2901. DllStructSetData($tGroup, "Header", $pText)
  2902. _MemWrite($tMemMap, $tGroup, $pMemory, $iGroup)
  2903. _MemWrite($tMemMap, $tHeader, $pText, $iHeader)
  2904. $iRet = _SendMessage($hWnd, $LVM_INSERTGROUP, $iIndex, $tGroup, 0, "wparam", "struct*")
  2905. _MemFree($tMemMap)
  2906. EndIf
  2907. Else
  2908. DllStructSetData($tGroup, "Header", $pHeader)
  2909. $iRet = GUICtrlSendMsg($hWnd, $LVM_INSERTGROUP, $iIndex, DllStructGetPtr($tGroup))
  2910. EndIf
  2911. Return $iRet
  2912. EndFunc ;==>_GUICtrlListView_InsertGroup
  2913. ; #FUNCTION# ====================================================================================================================
  2914. ; Author ........: Paul Campbell (PaulIA)
  2915. ; Modified.......: Gary Frost (gafrost)
  2916. ; ===============================================================================================================================
  2917. Func _GUICtrlListView_InsertItem($hWnd, $sText, $iIndex = -1, $iImage = -1, $iParam = 0)
  2918. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  2919. Local $iBuffer, $tBuffer, $iRet
  2920. If $iIndex = -1 Then $iIndex = 999999999
  2921. Local $tItem = DllStructCreate($tagLVITEM)
  2922. DllStructSetData($tItem, "Param", $iParam)
  2923. ; If $sText <> -1 Then
  2924. $iBuffer = StringLen($sText) + 1
  2925. If $bUnicode Then
  2926. $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  2927. $iBuffer *= 2
  2928. Else
  2929. $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
  2930. EndIf
  2931. DllStructSetData($tBuffer, "Text", $sText)
  2932. DllStructSetData($tItem, "Text", DllStructGetPtr($tBuffer))
  2933. DllStructSetData($tItem, "TextMax", $iBuffer)
  2934. ; Else
  2935. ; DllStructSetData($tItem, "Text", -1)
  2936. ; EndIf
  2937. Local $iMask = BitOR($LVIF_TEXT, $LVIF_PARAM)
  2938. If $iImage >= 0 Then $iMask = BitOR($iMask, $LVIF_IMAGE)
  2939. DllStructSetData($tItem, "Mask", $iMask)
  2940. DllStructSetData($tItem, "Item", $iIndex)
  2941. DllStructSetData($tItem, "Image", $iImage)
  2942. If IsHWnd($hWnd) Then
  2943. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Or ($sText = -1) Then
  2944. $iRet = _SendMessage($hWnd, $LVM_INSERTITEMW, 0, $tItem, 0, "wparam", "struct*")
  2945. Else
  2946. Local $iItem = DllStructGetSize($tItem)
  2947. Local $tMemMap
  2948. Local $pMemory = _MemInit($hWnd, $iItem + $iBuffer, $tMemMap)
  2949. Local $pText = $pMemory + $iItem
  2950. DllStructSetData($tItem, "Text", $pText)
  2951. _MemWrite($tMemMap, $tItem, $pMemory, $iItem)
  2952. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  2953. If $bUnicode Then
  2954. $iRet = _SendMessage($hWnd, $LVM_INSERTITEMW, 0, $pMemory, 0, "wparam", "ptr")
  2955. Else
  2956. $iRet = _SendMessage($hWnd, $LVM_INSERTITEMA, 0, $pMemory, 0, "wparam", "ptr")
  2957. EndIf
  2958. _MemFree($tMemMap)
  2959. EndIf
  2960. Else
  2961. Local $pItem = DllStructGetPtr($tItem)
  2962. If $bUnicode Then
  2963. $iRet = GUICtrlSendMsg($hWnd, $LVM_INSERTITEMW, 0, $pItem)
  2964. Else
  2965. $iRet = GUICtrlSendMsg($hWnd, $LVM_INSERTITEMA, 0, $pItem)
  2966. EndIf
  2967. EndIf
  2968. Return $iRet
  2969. EndFunc ;==>_GUICtrlListView_InsertItem
  2970. ; #NO_DOC_FUNCTION# =============================================================================================================
  2971. ; Name...........: _GUICtrlListView_InsertMarkHitTest
  2972. ; Description ...: Retrieves the insertion point closest to a specified point
  2973. ; Syntax.........: _GUICtrlListView_InsertMarkHitTest ( $hWnd [, $iX = -1 [, $iY = -1]] )
  2974. ; Parameters ....: $hWnd - Handle to the control
  2975. ; $iX - X position test point or -1 to use the current mouse position
  2976. ; $iY - Y position test point or -1 to use the current mouse position
  2977. ; Return values .: Success - Array with the following format:
  2978. ; |[0] - True if the insertion point appears after the item, otherwise False
  2979. ; |[1] - Item next to which the insertion point appears. If this is -1, there is no insertion point.
  2980. ; Author ........: Paul Campbell (PaulIA)
  2981. ; Modified.......: Gary Frost (gafrost)
  2982. ; Remarks .......: Minimum operating systems Windows XP.
  2983. ; Related .......: _GUICtrlListView_GetInsertMark
  2984. ; Link ..........:
  2985. ; Example .......:
  2986. ; ===============================================================================================================================
  2987. Func _GUICtrlListView_InsertMarkHitTest($hWnd, $iX = -1, $iY = -1)
  2988. Local $iMode = Opt("MouseCoordMode", 1)
  2989. Local $aPos = MouseGetPos()
  2990. Opt("MouseCoordMode", $iMode)
  2991. Local $tPoint = DllStructCreate($tagPOINT)
  2992. DllStructSetData($tPoint, "X", $aPos[0])
  2993. DllStructSetData($tPoint, "Y", $aPos[1])
  2994. Local $aResult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hWnd, "struct*", $tPoint)
  2995. If @error Then Return SetError(@error, @extended, 0)
  2996. If $aResult[0] = 0 Then Return 0
  2997. If $iX = -1 Then $iX = DllStructGetData($tPoint, "X")
  2998. If $iY = -1 Then $iY = DllStructGetData($tPoint, "Y")
  2999. Local $tMark = DllStructCreate($tagLVINSERTMARK)
  3000. Local $iMark = DllStructGetSize($tMark)
  3001. DllStructSetData($tPoint, "X", $iX)
  3002. DllStructSetData($tPoint, "Y", $iY)
  3003. DllStructSetData($tMark, "Size", $iMark)
  3004. If IsHWnd($hWnd) Then
  3005. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  3006. _SendMessage($hWnd, $LVM_INSERTMARKHITTEST, $tPoint, $tMark, 0, "struct*", "struct*")
  3007. Else
  3008. Local $iPoint = DllStructGetSize($tPoint)
  3009. Local $tMemMap
  3010. Local $pMemM = _MemInit($hWnd, $iPoint + $iMark, $tMemMap)
  3011. Local $pMemP = $pMemM + $iPoint ; BUG ??? was referencing $pMemP
  3012. _MemWrite($tMemMap, $tMark, $pMemM, $iMark)
  3013. _MemWrite($tMemMap, $tPoint, $pMemP, $iPoint)
  3014. _SendMessage($hWnd, $LVM_INSERTMARKHITTEST, $pMemP, $pMemM, 0, "wparam", "ptr")
  3015. _MemRead($tMemMap, $pMemM, $tMark, $iMark)
  3016. _MemFree($tMemMap)
  3017. EndIf
  3018. Else
  3019. GUICtrlSendMsg($hWnd, $LVM_INSERTMARKHITTEST, DllStructGetPtr($tPoint), DllStructGetPtr($tMark))
  3020. EndIf
  3021. Local $aTest[2]
  3022. $aTest[0] = DllStructGetData($tMark, "Flags") = $LVIM_AFTER
  3023. $aTest[1] = DllStructGetData($tMark, "Item")
  3024. Return $aTest
  3025. EndFunc ;==>_GUICtrlListView_InsertMarkHitTest
  3026. ; #NO_DOC_FUNCTION# =============================================================================================================
  3027. ; Name...........: _GUICtrlListView_IsItemVisible
  3028. ; Description ...: Gets the state for a specified group
  3029. ; Syntax.........: _GUICtrlListView_IsItemVisible ( $hWnd, $iIndex )
  3030. ; Parameters ....: $hWnd - Handle to the control
  3031. ; $iIndex - An index of the item in the list-view control
  3032. ; Return values .: True - Visible
  3033. ; False - Not Visible
  3034. ; Author ........: Gary Frost
  3035. ; Modified.......:
  3036. ; Remarks .......: Minimum operating systems: Windows Vista
  3037. ; Related .......:
  3038. ; Link ..........:
  3039. ; Example .......: Yes
  3040. ; ===============================================================================================================================
  3041. Func _GUICtrlListView_IsItemVisible($hWnd, $iIndex)
  3042. If IsHWnd($hWnd) Then
  3043. Return _SendMessage($hWnd, $LVM_ISITEMVISIBLE, $iIndex) <> 0
  3044. Else
  3045. Return GUICtrlSendMsg($hWnd, $LVM_ISITEMVISIBLE, $iIndex, 0) <> 0
  3046. EndIf
  3047. EndFunc ;==>_GUICtrlListView_IsItemVisible
  3048. ; #FUNCTION# ====================================================================================================================
  3049. ; Author ........: Gary Frost (gafrost)
  3050. ; Modified.......:
  3051. ; ===============================================================================================================================
  3052. Func _GUICtrlListView_JustifyColumn($hWnd, $iIndex, $iAlign = -1)
  3053. Local $aAlign[3] = [$LVCFMT_LEFT, $LVCFMT_RIGHT, $LVCFMT_CENTER]
  3054. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  3055. Local $tColumn = DllStructCreate($tagLVCOLUMN)
  3056. If $iAlign < 0 Or $iAlign > 2 Then $iAlign = 0
  3057. Local $iMask = $LVCF_FMT
  3058. Local $iFmt = $aAlign[$iAlign]
  3059. DllStructSetData($tColumn, "Mask", $iMask)
  3060. DllStructSetData($tColumn, "Fmt", $iFmt)
  3061. Local $iRet
  3062. If IsHWnd($hWnd) Then
  3063. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  3064. $iRet = _SendMessage($hWnd, $LVM_SETCOLUMNW, $iIndex, $tColumn, 0, "wparam", "struct*")
  3065. Else
  3066. Local $iColumn = DllStructGetSize($tColumn)
  3067. Local $tMemMap
  3068. Local $pMemory = _MemInit($hWnd, $iColumn, $tMemMap)
  3069. _MemWrite($tMemMap, $tColumn, $pMemory, $iColumn)
  3070. If $bUnicode Then
  3071. $iRet = _SendMessage($hWnd, $LVM_SETCOLUMNW, $iIndex, $pMemory, 0, "wparam", "ptr")
  3072. Else
  3073. $iRet = _SendMessage($hWnd, $LVM_SETCOLUMNA, $iIndex, $pMemory, 0, "wparam", "ptr")
  3074. EndIf
  3075. _MemFree($tMemMap)
  3076. EndIf
  3077. Else
  3078. Local $pColumn = DllStructGetPtr($tColumn)
  3079. If $bUnicode Then
  3080. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETCOLUMNW, $iIndex, $pColumn)
  3081. Else
  3082. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETCOLUMNA, $iIndex, $pColumn)
  3083. EndIf
  3084. EndIf
  3085. Return $iRet <> 0
  3086. EndFunc ;==>_GUICtrlListView_JustifyColumn
  3087. ; #FUNCTION# ====================================================================================================================
  3088. ; Author ........: Paul Campbell (PaulIA)
  3089. ; Modified.......: Gary Frost (gafrost)
  3090. ; ===============================================================================================================================
  3091. Func _GUICtrlListView_MapIDToIndex($hWnd, $iID)
  3092. If IsHWnd($hWnd) Then
  3093. Return _SendMessage($hWnd, $LVM_MAPIDTOINDEX, $iID)
  3094. Else
  3095. Return GUICtrlSendMsg($hWnd, $LVM_MAPIDTOINDEX, $iID, 0)
  3096. EndIf
  3097. EndFunc ;==>_GUICtrlListView_MapIDToIndex
  3098. ; #FUNCTION# ====================================================================================================================
  3099. ; Author ........: Paul Campbell (PaulIA)
  3100. ; Modified.......: Gary Frost (gafrost)
  3101. ; ===============================================================================================================================
  3102. Func _GUICtrlListView_MapIndexToID($hWnd, $iIndex)
  3103. If IsHWnd($hWnd) Then
  3104. Return _SendMessage($hWnd, $LVM_MAPINDEXTOID, $iIndex)
  3105. Else
  3106. Return GUICtrlSendMsg($hWnd, $LVM_MAPINDEXTOID, $iIndex, 0)
  3107. EndIf
  3108. EndFunc ;==>_GUICtrlListView_MapIndexToID
  3109. ; #NO_DOC_FUNCTION# =============================================================================================================
  3110. ; Name...........: _GUICtrlListView_MoveGroup
  3111. ; Description ...: Moves the group to the specified zero based index
  3112. ; Syntax.........: _GUICtrlListView_MoveGroup ( $hWnd, $iGroupID [, $iIndex = -1] )
  3113. ; Parameters ....: $hWnd - Handle to the control
  3114. ; $iGroupID - ID of the group to move
  3115. ; $iIndex - Zero based index of an item where the group will move
  3116. ; Return values .:
  3117. ; Author ........: Paul Campbell (PaulIA)
  3118. ; Modified.......: Gary Frost (gafrost)
  3119. ; Remarks .......: Minimum operating systems Windows XP.
  3120. ; Related .......:
  3121. ; Link ..........:
  3122. ; Example .......:
  3123. ; ===============================================================================================================================
  3124. Func _GUICtrlListView_MoveGroup($hWnd, $iGroupID, $iIndex = -1)
  3125. If IsHWnd($hWnd) Then
  3126. Return _SendMessage($hWnd, $LVM_MOVEGROUP, $iGroupID, $iIndex)
  3127. Else
  3128. Return GUICtrlSendMsg($hWnd, $LVM_MOVEGROUP, $iGroupID, $iIndex)
  3129. EndIf
  3130. EndFunc ;==>_GUICtrlListView_MoveGroup
  3131. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  3132. ; Name...........: __GUICtrlListView_OverlayImageMaskToIndex
  3133. ; Description ...: Converts an overlay image mask to an image index
  3134. ; Syntax.........: __GUICtrlListView_OverlayImageMaskToIndex ( $iMask )
  3135. ; Parameters ....: $iMask - Image index mask
  3136. ; Return values .: Success - Image index
  3137. ; Author ........: Paul Campbell (PaulIA)
  3138. ; Modified.......:
  3139. ; Remarks .......: This function is used internally and should not normally be called
  3140. ; Related .......: __GUICtrlListView_IndexToOverlayImageMask
  3141. ; Link ..........:
  3142. ; Example .......:
  3143. ; ===============================================================================================================================
  3144. Func __GUICtrlListView_OverlayImageMaskToIndex($iMask)
  3145. Return BitShift(BitAND($LVIS_OVERLAYMASK, $iMask), 8)
  3146. EndFunc ;==>__GUICtrlListView_OverlayImageMaskToIndex
  3147. ; #FUNCTION# ====================================================================================================================
  3148. ; Author ........: Paul Campbell (PaulIA)
  3149. ; Modified.......: Gary Frost (gafrost)
  3150. ; ===============================================================================================================================
  3151. Func _GUICtrlListView_RedrawItems($hWnd, $iFirst, $iLast)
  3152. If IsHWnd($hWnd) Then
  3153. Return _SendMessage($hWnd, $LVM_REDRAWITEMS, $iFirst, $iLast) <> 0
  3154. Else
  3155. Return GUICtrlSendMsg($hWnd, $LVM_REDRAWITEMS, $iFirst, $iLast) <> 0
  3156. EndIf
  3157. EndFunc ;==>_GUICtrlListView_RedrawItems
  3158. ; #FUNCTION# ====================================================================================================================
  3159. ; Author ........: Gary Frost
  3160. ; Modified.......:
  3161. ; ===============================================================================================================================
  3162. Func _GUICtrlListView_RegisterSortCallBack($hWnd, $vCompareType = 1, $bArrows = True, $sPrivateCallback = "__GUICtrlListView_Sort")
  3163. #Au3Stripper_Ignore_Funcs=$sPrivateCallback
  3164. If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
  3165. If IsBool($vCompareType) Then $vCompareType = ($vCompareType) ? 1 : 0
  3166. Local $hHeader = _GUICtrlListView_GetHeader($hWnd)
  3167. ReDim $__g_aListViewSortInfo[UBound($__g_aListViewSortInfo) + 1][$__LISTVIEWCONSTANT_SORTINFOSIZE]
  3168. $__g_aListViewSortInfo[0][0] = UBound($__g_aListViewSortInfo) - 1
  3169. Local $iIndex = $__g_aListViewSortInfo[0][0]
  3170. $__g_aListViewSortInfo[$iIndex][1] = $hWnd ; Handle/ID of listview
  3171. $__g_aListViewSortInfo[$iIndex][2] = _
  3172. DllCallbackRegister($sPrivateCallback, "int", "int;int;hwnd") ; Handle of callback
  3173. $__g_aListViewSortInfo[$iIndex][3] = -1 ; $nColumn
  3174. $__g_aListViewSortInfo[$iIndex][4] = -1 ; nCurCol
  3175. $__g_aListViewSortInfo[$iIndex][5] = 1 ; $nSortDir
  3176. $__g_aListViewSortInfo[$iIndex][6] = -1 ; $nCol
  3177. $__g_aListViewSortInfo[$iIndex][7] = 0 ; $bSet
  3178. $__g_aListViewSortInfo[$iIndex][8] = $vCompareType ; Treat as Strings, Numbers or use Windows API to compare
  3179. $__g_aListViewSortInfo[$iIndex][9] = $bArrows ; Use arrows in the header of the columns?
  3180. $__g_aListViewSortInfo[$iIndex][10] = $hHeader ; Handle to the Header
  3181. Return $__g_aListViewSortInfo[$iIndex][2] <> 0
  3182. EndFunc ;==>_GUICtrlListView_RegisterSortCallBack
  3183. ; #FUNCTION# ====================================================================================================================
  3184. ; Author ........: Paul Campbell (PaulIA)
  3185. ; Modified.......: Gary Frost (gafrost)
  3186. ; ===============================================================================================================================
  3187. Func _GUICtrlListView_RemoveAllGroups($hWnd)
  3188. If IsHWnd($hWnd) Then
  3189. _SendMessage($hWnd, $LVM_REMOVEALLGROUPS)
  3190. Else
  3191. GUICtrlSendMsg($hWnd, $LVM_REMOVEALLGROUPS, 0, 0)
  3192. EndIf
  3193. EndFunc ;==>_GUICtrlListView_RemoveAllGroups
  3194. ; #FUNCTION# ====================================================================================================================
  3195. ; Author ........: Paul Campbell (PaulIA)
  3196. ; Modified.......: Gary Frost (gafrost)
  3197. ; ===============================================================================================================================
  3198. Func _GUICtrlListView_RemoveGroup($hWnd, $iGroupID)
  3199. If IsHWnd($hWnd) Then
  3200. Return _SendMessage($hWnd, $LVM_REMOVEGROUP, $iGroupID)
  3201. Else
  3202. Return GUICtrlSendMsg($hWnd, $LVM_REMOVEGROUP, $iGroupID, 0)
  3203. EndIf
  3204. EndFunc ;==>_GUICtrlListView_RemoveGroup
  3205. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  3206. ; Name...........: __GUICtrlListView_ReverseColorOrder
  3207. ; Description ...: Convert Hex RGB or BGR Color to Hex RGB or BGR Color
  3208. ; Syntax.........: __GUICtrlListView_ReverseColorOrder ( $iColor )
  3209. ; Parameters ....: $iColor - Color to convert
  3210. ; Return values .: Color - Hex RGB or BGR Color
  3211. ; Author ........: Gary Frost (gafrost)
  3212. ; Modified.......:
  3213. ; Remarks .......: This function is used interanally only
  3214. ; Related .......:
  3215. ; Link ..........:
  3216. ; Example .......:
  3217. ; ===============================================================================================================================
  3218. Func __GUICtrlListView_ReverseColorOrder($iColor)
  3219. Local $sH = Hex(String($iColor), 6)
  3220. Return '0x' & StringMid($sH, 5, 2) & StringMid($sH, 3, 2) & StringMid($sH, 1, 2)
  3221. EndFunc ;==>__GUICtrlListView_ReverseColorOrder
  3222. ; #FUNCTION# ====================================================================================================================
  3223. ; Author ........: Gary Frost (gafrost)
  3224. ; Modified.......:
  3225. ; ===============================================================================================================================
  3226. Func _GUICtrlListView_Scroll($hWnd, $iDX, $iDY)
  3227. If IsHWnd($hWnd) Then
  3228. Return _SendMessage($hWnd, $LVM_SCROLL, $iDX, $iDY) <> 0
  3229. Else
  3230. Return GUICtrlSendMsg($hWnd, $LVM_SCROLL, $iDX, $iDY) <> 0
  3231. EndIf
  3232. EndFunc ;==>_GUICtrlListView_Scroll
  3233. ; #FUNCTION# ====================================================================================================================
  3234. ; Author ........: Paul Campbell (PaulIA)
  3235. ; Modified.......: Gary Frost (gafrost)
  3236. ; ===============================================================================================================================
  3237. Func _GUICtrlListView_SetBkColor($hWnd, $iColor)
  3238. Local $iRet
  3239. If IsHWnd($hWnd) Then
  3240. $iRet = _SendMessage($hWnd, $LVM_SETBKCOLOR, 0, $iColor)
  3241. _WinAPI_InvalidateRect($hWnd)
  3242. Else
  3243. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETBKCOLOR, 0, $iColor)
  3244. _WinAPI_InvalidateRect(GUICtrlGetHandle($hWnd))
  3245. EndIf
  3246. Return $iRet <> 0
  3247. EndFunc ;==>_GUICtrlListView_SetBkColor
  3248. ; #FUNCTION# ====================================================================================================================
  3249. ; Author ........: Paul Campbell (PaulIA)
  3250. ; Modified.......: Gary Frost (gafrost)
  3251. ; ===============================================================================================================================
  3252. Func _GUICtrlListView_SetBkImage($hWnd, $sURL = "", $iStyle = 0, $iXOffset = 0, $iYOffset = 0)
  3253. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  3254. If Not IsHWnd($hWnd) Then Return SetError($LV_ERR, $LV_ERR, False)
  3255. Local $aStyle[2] = [$LVBKIF_STYLE_NORMAL, $LVBKIF_STYLE_TILE]
  3256. Local $iBuffer = StringLen($sURL) + 1
  3257. Local $tBuffer
  3258. If $bUnicode Then
  3259. $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  3260. $iBuffer *= 2
  3261. Else
  3262. $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
  3263. EndIf
  3264. If @error Then Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
  3265. Local $pBuffer = DllStructGetPtr($tBuffer)
  3266. Local $tImage = DllStructCreate($tagLVBKIMAGE)
  3267. Local $iRet = 0
  3268. If $sURL <> "" Then $iRet = $LVBKIF_SOURCE_URL
  3269. $iRet = BitOR($iRet, $aStyle[$iStyle])
  3270. DllStructSetData($tBuffer, "Text", $sURL)
  3271. DllStructSetData($tImage, "Flags", $iRet)
  3272. DllStructSetData($tImage, "XOffPercent", $iXOffset)
  3273. DllStructSetData($tImage, "YOffPercent", $iYOffset)
  3274. If IsHWnd($hWnd) Then
  3275. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  3276. DllStructSetData($tImage, "Image", $pBuffer)
  3277. $iRet = _SendMessage($hWnd, $LVM_SETBKIMAGEW, 0, $tImage, 0, "wparam", "struct*")
  3278. Else
  3279. Local $iImage = DllStructGetSize($tImage)
  3280. Local $tMemMap
  3281. Local $pMemory = _MemInit($hWnd, $iImage + $iBuffer, $tMemMap)
  3282. Local $pText = $pMemory + $iImage
  3283. DllStructSetData($tImage, "Image", $pText)
  3284. _MemWrite($tMemMap, $tImage, $pMemory, $iImage)
  3285. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  3286. If $bUnicode Then
  3287. $iRet = _SendMessage($hWnd, $LVM_SETBKIMAGEW, 0, $pMemory, 0, "wparam", "ptr")
  3288. Else
  3289. $iRet = _SendMessage($hWnd, $LVM_SETBKIMAGEA, 0, $pMemory, 0, "wparam", "ptr")
  3290. EndIf
  3291. _MemFree($tMemMap)
  3292. EndIf
  3293. Else
  3294. Local $pImage = DllStructGetPtr($tImage)
  3295. DllStructSetData($tImage, "Image", $pBuffer)
  3296. If $bUnicode Then
  3297. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETBKIMAGEW, 0, $pImage)
  3298. Else
  3299. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETBKIMAGEA, 0, $pImage)
  3300. EndIf
  3301. EndIf
  3302. Return $iRet <> 0
  3303. EndFunc ;==>_GUICtrlListView_SetBkImage
  3304. ; #FUNCTION# ====================================================================================================================
  3305. ; Author ........: Paul Campbell (PaulIA)
  3306. ; Modified.......: Gary Frost (gafrost)
  3307. ; ===============================================================================================================================
  3308. Func _GUICtrlListView_SetCallBackMask($hWnd, $iMask)
  3309. Local $iFlags = 0
  3310. If BitAND($iMask, 1) <> 0 Then $iFlags = BitOR($iFlags, $LVIS_CUT)
  3311. If BitAND($iMask, 2) <> 0 Then $iFlags = BitOR($iFlags, $LVIS_DROPHILITED)
  3312. If BitAND($iMask, 4) <> 0 Then $iFlags = BitOR($iFlags, $LVIS_FOCUSED)
  3313. If BitAND($iMask, 8) <> 0 Then $iFlags = BitOR($iFlags, $LVIS_SELECTED)
  3314. If BitAND($iMask, 16) <> 0 Then $iFlags = BitOR($iFlags, $LVIS_OVERLAYMASK)
  3315. If BitAND($iMask, 32) <> 0 Then $iFlags = BitOR($iFlags, $LVIS_STATEIMAGEMASK)
  3316. If IsHWnd($hWnd) Then
  3317. Return _SendMessage($hWnd, $LVM_SETCALLBACKMASK, $iFlags) <> 0
  3318. Else
  3319. Return GUICtrlSendMsg($hWnd, $LVM_SETCALLBACKMASK, $iFlags, 0) <> 0
  3320. EndIf
  3321. EndFunc ;==>_GUICtrlListView_SetCallBackMask
  3322. ; #FUNCTION# ====================================================================================================================
  3323. ; Author ........: Paul Campbell (PaulIA)
  3324. ; Modified.......: Gary Frost (gafrost)
  3325. ; ===============================================================================================================================
  3326. Func _GUICtrlListView_SetColumn($hWnd, $iIndex, $sText, $iWidth = -1, $iAlign = -1, $iImage = -1, $bOnRight = False)
  3327. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  3328. Local $aAlign[3] = [$LVCFMT_LEFT, $LVCFMT_RIGHT, $LVCFMT_CENTER]
  3329. Local $iBuffer = StringLen($sText) + 1
  3330. Local $tBuffer
  3331. If $bUnicode Then
  3332. $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  3333. $iBuffer *= 2
  3334. Else
  3335. $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
  3336. EndIf
  3337. Local $pBuffer = DllStructGetPtr($tBuffer)
  3338. Local $tColumn = DllStructCreate($tagLVCOLUMN)
  3339. Local $iMask = $LVCF_TEXT
  3340. If $iAlign < 0 Or $iAlign > 2 Then $iAlign = 0
  3341. $iMask = BitOR($iMask, $LVCF_FMT)
  3342. Local $iFmt = $aAlign[$iAlign]
  3343. If $iWidth <> -1 Then $iMask = BitOR($iMask, $LVCF_WIDTH)
  3344. If $iImage <> -1 Then
  3345. $iMask = BitOR($iMask, $LVCF_IMAGE)
  3346. $iFmt = BitOR($iFmt, $LVCFMT_COL_HAS_IMAGES, $LVCFMT_IMAGE)
  3347. Else
  3348. $iImage = 0
  3349. EndIf
  3350. If $bOnRight Then $iFmt = BitOR($iFmt, $LVCFMT_BITMAP_ON_RIGHT)
  3351. DllStructSetData($tBuffer, "Text", $sText)
  3352. DllStructSetData($tColumn, "Mask", $iMask)
  3353. DllStructSetData($tColumn, "Fmt", $iFmt)
  3354. DllStructSetData($tColumn, "CX", $iWidth)
  3355. DllStructSetData($tColumn, "TextMax", $iBuffer)
  3356. DllStructSetData($tColumn, "Image", $iImage)
  3357. Local $iRet
  3358. If IsHWnd($hWnd) Then
  3359. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  3360. DllStructSetData($tColumn, "Text", $pBuffer)
  3361. $iRet = _SendMessage($hWnd, $LVM_SETCOLUMNW, $iIndex, $tColumn, 0, "wparam", "struct*")
  3362. Else
  3363. Local $iColumn = DllStructGetSize($tColumn)
  3364. Local $tMemMap
  3365. Local $pMemory = _MemInit($hWnd, $iColumn + $iBuffer, $tMemMap)
  3366. Local $pText = $pMemory + $iColumn
  3367. DllStructSetData($tColumn, "Text", $pText)
  3368. _MemWrite($tMemMap, $tColumn, $pMemory, $iColumn)
  3369. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  3370. If $bUnicode Then
  3371. $iRet = _SendMessage($hWnd, $LVM_SETCOLUMNW, $iIndex, $pMemory, 0, "wparam", "ptr")
  3372. Else
  3373. $iRet = _SendMessage($hWnd, $LVM_SETCOLUMNA, $iIndex, $pMemory, 0, "wparam", "ptr")
  3374. EndIf
  3375. _MemFree($tMemMap)
  3376. EndIf
  3377. Else
  3378. Local $pColumn = DllStructGetPtr($tColumn)
  3379. DllStructSetData($tColumn, "Text", $pBuffer)
  3380. If $bUnicode Then
  3381. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETCOLUMNW, $iIndex, $pColumn)
  3382. Else
  3383. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETCOLUMNA, $iIndex, $pColumn)
  3384. EndIf
  3385. EndIf
  3386. Return $iRet <> 0
  3387. EndFunc ;==>_GUICtrlListView_SetColumn
  3388. ; #FUNCTION# ====================================================================================================================
  3389. ; Author ........: Gary Frost (gafrost)
  3390. ; Modified.......:
  3391. ; ===============================================================================================================================
  3392. Func _GUICtrlListView_SetColumnOrder($hWnd, $sOrder)
  3393. Local $sSeparatorChar = Opt('GUIDataSeparatorChar')
  3394. Return _GUICtrlListView_SetColumnOrderArray($hWnd, StringSplit($sOrder, $sSeparatorChar))
  3395. EndFunc ;==>_GUICtrlListView_SetColumnOrder
  3396. ; #FUNCTION# ====================================================================================================================
  3397. ; Author ........: Paul Campbell (PaulIA)
  3398. ; Modified.......:
  3399. ; ===============================================================================================================================
  3400. Func _GUICtrlListView_SetColumnOrderArray($hWnd, $aOrder)
  3401. Local $tBuffer = DllStructCreate("int[" & $aOrder[0] & "]")
  3402. For $iI = 1 To $aOrder[0]
  3403. DllStructSetData($tBuffer, 1, $aOrder[$iI], $iI)
  3404. Next
  3405. Local $iRet
  3406. If IsHWnd($hWnd) Then
  3407. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  3408. $iRet = _SendMessage($hWnd, $LVM_SETCOLUMNORDERARRAY, $aOrder[0], $tBuffer, 0, "wparam", "struct*")
  3409. Else
  3410. Local $iBuffer = DllStructGetSize($tBuffer)
  3411. Local $tMemMap
  3412. Local $pMemory = _MemInit($hWnd, $iBuffer, $tMemMap)
  3413. _MemWrite($tMemMap, $tBuffer, $pMemory, $iBuffer)
  3414. $iRet = _SendMessage($hWnd, $LVM_SETCOLUMNORDERARRAY, $aOrder[0], $pMemory, 0, "wparam", "ptr")
  3415. _MemFree($tMemMap)
  3416. EndIf
  3417. Else
  3418. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETCOLUMNORDERARRAY, $aOrder[0], DllStructGetPtr($tBuffer))
  3419. EndIf
  3420. Return $iRet <> 0
  3421. EndFunc ;==>_GUICtrlListView_SetColumnOrderArray
  3422. ; #FUNCTION# ====================================================================================================================
  3423. ; Author ........: Gary Frost (gafrost)
  3424. ; Modified.......:
  3425. ; ===============================================================================================================================
  3426. Func _GUICtrlListView_SetColumnWidth($hWnd, $iCol, $iWidth)
  3427. If IsHWnd($hWnd) Then
  3428. Return _SendMessage($hWnd, $LVM_SETCOLUMNWIDTH, $iCol, $iWidth)
  3429. Else
  3430. Return GUICtrlSendMsg($hWnd, $LVM_SETCOLUMNWIDTH, $iCol, $iWidth)
  3431. EndIf
  3432. EndFunc ;==>_GUICtrlListView_SetColumnWidth
  3433. ; #FUNCTION# ====================================================================================================================
  3434. ; Author ........: Paul Campbell (PaulIA)
  3435. ; Modified.......: Gary Frost (gafrost)
  3436. ; ===============================================================================================================================
  3437. Func _GUICtrlListView_SetExtendedListViewStyle($hWnd, $iExStyle, $iExMask = 0)
  3438. Local $iRet
  3439. If IsHWnd($hWnd) Then
  3440. $iRet = _SendMessage($hWnd, $LVM_SETEXTENDEDLISTVIEWSTYLE, $iExMask, $iExStyle)
  3441. _WinAPI_InvalidateRect($hWnd)
  3442. Else
  3443. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETEXTENDEDLISTVIEWSTYLE, $iExMask, $iExStyle)
  3444. _WinAPI_InvalidateRect(GUICtrlGetHandle($hWnd))
  3445. EndIf
  3446. Return $iRet
  3447. EndFunc ;==>_GUICtrlListView_SetExtendedListViewStyle
  3448. ; #FUNCTION# ====================================================================================================================
  3449. ; Author ........: Paul Campbell (PaulIA)
  3450. ; Modified.......: Gary Frost (gafrost)
  3451. ; ===============================================================================================================================
  3452. Func _GUICtrlListView_SetGroupInfo($hWnd, $iGroupID, $sHeader, $iAlign = 0, $iState = $LVGS_NORMAL)
  3453. Local $tGroup = 0
  3454. ; Validate the ID of the group contains a list of items when using the $LVGS_SELECTED state
  3455. If BitAND($iState, $LVGS_SELECTED) Then
  3456. $tGroup = __GUICtrlListView_GetGroupInfoEx($hWnd, $iGroupID, BitOR($LVGF_GROUPID, $LVGF_ITEMS))
  3457. If DllStructGetData($tGroup, "GroupId") <> $iGroupID Or DllStructGetData($tGroup, "cItems") = 0 Then Return False
  3458. EndIf
  3459. Local $aAlign[3] = [$LVGA_HEADER_LEFT, $LVGA_HEADER_CENTER, $LVGA_HEADER_RIGHT]
  3460. If $iAlign < 0 Or $iAlign > 2 Then $iAlign = 0
  3461. Local $tHeader = _WinAPI_MultiByteToWideChar($sHeader)
  3462. Local $pHeader = DllStructGetPtr($tHeader)
  3463. Local $iHeader = StringLen($sHeader)
  3464. $tGroup = DllStructCreate($tagLVGROUP)
  3465. Local $pGroup = DllStructGetPtr($tGroup)
  3466. Local $iGroup = DllStructGetSize($tGroup)
  3467. Local $iMask = BitOR($LVGF_HEADER, $LVGF_ALIGN, $LVGF_STATE)
  3468. DllStructSetData($tGroup, "Size", $iGroup)
  3469. DllStructSetData($tGroup, "Mask", $iMask)
  3470. DllStructSetData($tGroup, "HeaderMax", $iHeader)
  3471. DllStructSetData($tGroup, "Align", $aAlign[$iAlign])
  3472. DllStructSetData($tGroup, "State", $iState)
  3473. DllStructSetData($tGroup, "StateMask", $iState)
  3474. Local $iRet
  3475. If IsHWnd($hWnd) Then
  3476. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  3477. DllStructSetData($tGroup, "Header", $pHeader)
  3478. $iRet = _SendMessage($hWnd, $LVM_SETGROUPINFO, $iGroupID, $pGroup)
  3479. DllStructSetData($tGroup, "Mask", $LVGF_GROUPID)
  3480. DllStructSetData($tGroup, "GroupID", $iGroupID)
  3481. _SendMessage($hWnd, $LVM_SETGROUPINFO, 0, $pGroup)
  3482. Else
  3483. Local $tMemMap
  3484. Local $pMemory = _MemInit($hWnd, $iGroup + $iHeader, $tMemMap)
  3485. Local $pText = $pMemory + $iGroup
  3486. DllStructSetData($tGroup, "Header", $pText)
  3487. _MemWrite($tMemMap, $tGroup, $pMemory, $iGroup)
  3488. _MemWrite($tMemMap, $tHeader, $pText, $iHeader)
  3489. $iRet = _SendMessage($hWnd, $LVM_SETGROUPINFO, $iGroupID, $pMemory)
  3490. DllStructSetData($tGroup, "Mask", $LVGF_GROUPID)
  3491. DllStructSetData($tGroup, "GroupID", $iGroupID)
  3492. _SendMessage($hWnd, $LVM_SETGROUPINFO, 0, $pMemory)
  3493. _MemFree($tMemMap)
  3494. EndIf
  3495. _WinAPI_InvalidateRect($hWnd)
  3496. Else
  3497. DllStructSetData($tGroup, "Header", $pHeader)
  3498. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETGROUPINFO, $iGroupID, $pGroup)
  3499. DllStructSetData($tGroup, "Mask", $LVGF_GROUPID)
  3500. DllStructSetData($tGroup, "GroupID", $iGroupID)
  3501. GUICtrlSendMsg($hWnd, $LVM_SETGROUPINFO, 0, $pGroup)
  3502. _WinAPI_InvalidateRect(GUICtrlGetHandle($hWnd))
  3503. EndIf
  3504. Return $iRet <> 0
  3505. EndFunc ;==>_GUICtrlListView_SetGroupInfo
  3506. ; #NO_DOC_FUNCTION# =============================================================================================================
  3507. ; Name...........: _GUICtrlListView_SetHotCursor
  3508. ; Description ...: Sets the cursor handle that the control uses
  3509. ; Syntax.........: _GUICtrlListView_SetHotCursor ( $hWnd, $hCursor )
  3510. ; Parameters ....: $hWnd - Handle to the control
  3511. ; $hCursor - Handle to the cursor to be set
  3512. ; Return values .: Success - Handle to the previous hot cursor
  3513. ; Author ........: Paul Campbell (PaulIA)
  3514. ; Modified.......: Gary Frost (gafrost)
  3515. ; Remarks .......: Currently not tested
  3516. ; Related .......: _GUICtrlListView_GetHotCursor
  3517. ; Link ..........:
  3518. ; Example .......:
  3519. ; ===============================================================================================================================
  3520. Func _GUICtrlListView_SetHotCursor($hWnd, $hCursor)
  3521. If IsHWnd($hWnd) Then
  3522. Return _SendMessage($hWnd, $LVM_SETHOTCURSOR, 0, $hCursor, 0, "wparam", "handle", "handle")
  3523. Else
  3524. Return Ptr(GUICtrlSendMsg($hWnd, $LVM_SETHOTCURSOR, 0, $hCursor))
  3525. EndIf
  3526. EndFunc ;==>_GUICtrlListView_SetHotCursor
  3527. ; #FUNCTION# ====================================================================================================================
  3528. ; Author ........: Gary Frost (gafrost)
  3529. ; Modified.......:
  3530. ; ===============================================================================================================================
  3531. Func _GUICtrlListView_SetHotItem($hWnd, $iIndex)
  3532. If IsHWnd($hWnd) Then
  3533. Return _SendMessage($hWnd, $LVM_SETHOTITEM, $iIndex)
  3534. Else
  3535. Return GUICtrlSendMsg($hWnd, $LVM_SETHOTITEM, $iIndex, 0)
  3536. EndIf
  3537. EndFunc ;==>_GUICtrlListView_SetHotItem
  3538. ; #FUNCTION# ====================================================================================================================
  3539. ; Author ........: Gary Frost (gafrost)
  3540. ; Modified.......:
  3541. ; ===============================================================================================================================
  3542. Func _GUICtrlListView_SetHoverTime($hWnd, $iTime)
  3543. If IsHWnd($hWnd) Then
  3544. Return _SendMessage($hWnd, $LVM_SETHOVERTIME, 0, $iTime)
  3545. Else
  3546. Return GUICtrlSendMsg($hWnd, $LVM_SETHOVERTIME, 0, $iTime)
  3547. EndIf
  3548. EndFunc ;==>_GUICtrlListView_SetHoverTime
  3549. ; #FUNCTION# ====================================================================================================================
  3550. ; Author ........: Paul Campbell (PaulIA)
  3551. ; Modified.......: Gary Frost (gafrost)
  3552. ; ===============================================================================================================================
  3553. Func _GUICtrlListView_SetIconSpacing($hWnd, $iCX, $iCY)
  3554. Local $iRet, $aPadding[2]
  3555. If IsHWnd($hWnd) Then
  3556. $iRet = _SendMessage($hWnd, $LVM_SETICONSPACING, 0, _WinAPI_MakeLong($iCX, $iCY))
  3557. _WinAPI_InvalidateRect($hWnd)
  3558. Else
  3559. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETICONSPACING, 0, _WinAPI_MakeLong($iCX, $iCY))
  3560. _WinAPI_InvalidateRect(GUICtrlGetHandle($hWnd))
  3561. EndIf
  3562. $aPadding[0] = BitAND($iRet, 0xFFFF)
  3563. $aPadding[1] = BitShift($iRet, 16)
  3564. Return $aPadding
  3565. EndFunc ;==>_GUICtrlListView_SetIconSpacing
  3566. ; #FUNCTION# ====================================================================================================================
  3567. ; Author ........: Paul Campbell (PaulIA)
  3568. ; Modified.......: Gary Frost (gafrost)
  3569. ; ===============================================================================================================================
  3570. Func _GUICtrlListView_SetImageList($hWnd, $hHandle, $iType = 0)
  3571. Local $aType[3] = [$LVSIL_NORMAL, $LVSIL_SMALL, $LVSIL_STATE]
  3572. If IsHWnd($hWnd) Then
  3573. Return _SendMessage($hWnd, $LVM_SETIMAGELIST, $aType[$iType], $hHandle, 0, "wparam", "handle", "handle")
  3574. Else
  3575. Return Ptr(GUICtrlSendMsg($hWnd, $LVM_SETIMAGELIST, $aType[$iType], $hHandle))
  3576. EndIf
  3577. EndFunc ;==>_GUICtrlListView_SetImageList
  3578. ; #NO_DOC_FUNCTION# =============================================================================================================
  3579. ; Name...........: _GUICtrlListView_SetInfoTip
  3580. ; Description ...: Sets ToolTip text
  3581. ; Syntax.........: _GUICtrlListView_SetInfoTip ( $hWnd, $iIndex, $sText [, $iSubItem = 0] )
  3582. ; Parameters ....: $hWnd - Handle to the control
  3583. ; $iIndex - Zero based index of the item
  3584. ; $sText - String that contains the tooltip text
  3585. ; $iSubItem - One based index of the subitem
  3586. ; Return values .: Success - True
  3587. ; Failure - False
  3588. ; Author ........: Paul Campbell (PaulIA)
  3589. ; Modified.......: Gary Frost (gafrost)
  3590. ; Remarks .......: Minimum operating systems Windows XP.
  3591. ; Related .......:
  3592. ; Link ..........:
  3593. ; Example .......:
  3594. ; ===============================================================================================================================
  3595. Func _GUICtrlListView_SetInfoTip($hWnd, $iIndex, $sText, $iSubItem = 0)
  3596. Local $tBuffer = _WinAPI_MultiByteToWideChar($sText)
  3597. Local $pBuffer = DllStructGetPtr($tBuffer)
  3598. Local $iBuffer = StringLen($sText)
  3599. Local $tInfo = DllStructCreate($tagLVSETINFOTIP)
  3600. Local $iInfo = DllStructGetSize($tInfo)
  3601. DllStructSetData($tInfo, "Size", $iInfo)
  3602. DllStructSetData($tInfo, "Item", $iIndex)
  3603. DllStructSetData($tInfo, "SubItem", $iSubItem)
  3604. Local $iRet
  3605. If IsHWnd($hWnd) Then
  3606. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  3607. DllStructSetData($tInfo, "Text", $pBuffer)
  3608. $iRet = _SendMessage($hWnd, $LVM_SETINFOTIP, 0, $tInfo, 0, "wparam", "struct*")
  3609. Else
  3610. Local $tMemMap
  3611. Local $pMemory = _MemInit($hWnd, $iInfo + $iBuffer, $tMemMap)
  3612. Local $pText = $pMemory + $iInfo
  3613. DllStructSetData($tInfo, "Text", $pText)
  3614. _MemWrite($tMemMap, $tInfo, $pMemory, $iInfo)
  3615. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  3616. $iRet = _SendMessage($hWnd, $LVM_SETINFOTIP, 0, $pMemory, 0, "wparam", "ptr")
  3617. _MemFree($tMemMap)
  3618. EndIf
  3619. Else
  3620. DllStructSetData($tInfo, "Text", $pBuffer)
  3621. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETINFOTIP, 0, DllStructGetPtr($tInfo))
  3622. EndIf
  3623. Return $iRet <> 0
  3624. EndFunc ;==>_GUICtrlListView_SetInfoTip
  3625. ; #NO_DOC_FUNCTION# =============================================================================================================
  3626. ; Name...........: _GUICtrlListView_SetInsertMark
  3627. ; Description ...: Sets the insertion point to the defined position
  3628. ; Syntax.........: _GUICtrlListView_SetInsertMark ( $hWnd, $iIndex [, $bAfter = False] )
  3629. ; Parameters ....: $hWnd - Handle to the control
  3630. ; $iIndex - Zero based index of the item
  3631. ; $bAfter - Insertion point:
  3632. ; $i_Cols | True - The insertion point will appear after the item
  3633. ; |False - The insertion point will appear before the item
  3634. ; Return values .: Success - True
  3635. ; Failure - False
  3636. ; Author ........: Paul Campbell (PaulIA)
  3637. ; Modified.......: Gary Frost (gafrost)
  3638. ; Remarks .......: Minimum operating systems Windows XP.
  3639. ; +
  3640. ; An insertion point can only appear if the control is in icon view, small icon view, or tile
  3641. ; view, and not in group view mode.
  3642. ; Related .......: _GUICtrlListView_GetInsertMark
  3643. ; Link ..........:
  3644. ; Example .......:
  3645. ; ===============================================================================================================================
  3646. Func _GUICtrlListView_SetInsertMark($hWnd, $iIndex, $bAfter = False)
  3647. Local $tMark = DllStructCreate($tagLVINSERTMARK)
  3648. Local $iMark = DllStructGetSize($tMark)
  3649. DllStructSetData($tMark, "Size", $iMark)
  3650. If $bAfter Then DllStructSetData($tMark, "Flags", $LVIM_AFTER)
  3651. DllStructSetData($tMark, "Item", $iIndex)
  3652. DllStructSetData($tMark, "Reserved", 0)
  3653. Local $iRet
  3654. If IsHWnd($hWnd) Then
  3655. Local $tMemMap
  3656. Local $pMemory = _MemInit($hWnd, $iMark, $tMemMap)
  3657. _MemWrite($tMemMap, $tMark, $pMemory, $iMark)
  3658. $iRet = _SendMessage($hWnd, $LVM_SETINSERTMARK, 0, $pMemory, 0, "wparam", "ptr")
  3659. _MemFree($tMemMap)
  3660. Else
  3661. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETINSERTMARK, 0, DllStructGetPtr($tMark))
  3662. EndIf
  3663. Return $iRet <> 0
  3664. EndFunc ;==>_GUICtrlListView_SetInsertMark
  3665. ; #NO_DOC_FUNCTION# =============================================================================================================
  3666. ; Name...........: _GUICtrlListView_SetInsertMarkColor
  3667. ; Description ...: Sets the color of the insertion point
  3668. ; Syntax.........: _GUICtrlListView_SetInsertMarkColor ( $hWnd, $iColor )
  3669. ; Parameters ....: $hWnd - Handle to the control
  3670. ; $iColor - Color to set the insertion point
  3671. ; Return values .: Success - The previous insertion point color
  3672. ; Author ........: Paul Campbell (PaulIA)
  3673. ; Modified.......: Gary Frost (gafrost)
  3674. ; Remarks .......: Minimum operating systems Windows XP.
  3675. ; Related .......: _GUICtrlListView_GetInsertMarkColor
  3676. ; Link ..........:
  3677. ; Example .......:
  3678. ; ===============================================================================================================================
  3679. Func _GUICtrlListView_SetInsertMarkColor($hWnd, $iColor)
  3680. If IsHWnd($hWnd) Then
  3681. Return _SendMessage($hWnd, $LVM_SETINSERTMARKCOLOR, 0, $iColor)
  3682. Else
  3683. Return GUICtrlSendMsg($hWnd, $LVM_SETINSERTMARKCOLOR, 0, $iColor)
  3684. EndIf
  3685. EndFunc ;==>_GUICtrlListView_SetInsertMarkColor
  3686. ; #FUNCTION# ====================================================================================================================
  3687. ; Author ........: Paul Campbell (PaulIA)
  3688. ; Modified.......:
  3689. ; ===============================================================================================================================
  3690. Func _GUICtrlListView_SetItem($hWnd, $sText, $iIndex = 0, $iSubItem = 0, $iImage = -1, $iParam = -1, $iIndent = -1)
  3691. Local $pBuffer, $iBuffer
  3692. If $sText <> -1 Then
  3693. $iBuffer = StringLen($sText) + 1
  3694. Local $tBuffer
  3695. If _GUICtrlListView_GetUnicodeFormat($hWnd) Then
  3696. $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  3697. Else
  3698. $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
  3699. EndIf
  3700. $pBuffer = DllStructGetPtr($tBuffer)
  3701. DllStructSetData($tBuffer, "Text", $sText)
  3702. Else
  3703. $iBuffer = 0
  3704. $pBuffer = -1 ; LPSTR_TEXTCALLBACK
  3705. EndIf
  3706. Local $tItem = DllStructCreate($tagLVITEM)
  3707. Local $iMask = $LVIF_TEXT
  3708. If $iImage <> -1 Then $iMask = BitOR($iMask, $LVIF_IMAGE)
  3709. If $iParam <> -1 Then $iMask = BitOR($iMask, $LVIF_PARAM)
  3710. If $iIndent <> -1 Then $iMask = BitOR($iMask, $LVIF_INDENT)
  3711. DllStructSetData($tItem, "Mask", $iMask)
  3712. DllStructSetData($tItem, "Item", $iIndex)
  3713. DllStructSetData($tItem, "SubItem", $iSubItem)
  3714. DllStructSetData($tItem, "Text", $pBuffer)
  3715. DllStructSetData($tItem, "TextMax", $iBuffer)
  3716. DllStructSetData($tItem, "Image", $iImage)
  3717. DllStructSetData($tItem, "Param", $iParam)
  3718. DllStructSetData($tItem, "Indent", $iIndent)
  3719. Return _GUICtrlListView_SetItemEx($hWnd, $tItem)
  3720. EndFunc ;==>_GUICtrlListView_SetItem
  3721. ; #FUNCTION# ====================================================================================================================
  3722. ; Author ........: Gary Frost (gafrost)
  3723. ; Modified.......:
  3724. ; ===============================================================================================================================
  3725. Func _GUICtrlListView_SetItemChecked($hWnd, $iIndex, $bCheck = True)
  3726. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  3727. Local $pMemory, $tMemMap, $iRet
  3728. Local $tItem = DllStructCreate($tagLVITEM)
  3729. Local $pItem = DllStructGetPtr($tItem)
  3730. Local $iItem = DllStructGetSize($tItem)
  3731. If @error Then Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
  3732. If $iIndex <> -1 Then
  3733. DllStructSetData($tItem, "Mask", $LVIF_STATE)
  3734. DllStructSetData($tItem, "Item", $iIndex)
  3735. If ($bCheck) Then
  3736. DllStructSetData($tItem, "State", 0x2000)
  3737. Else
  3738. DllStructSetData($tItem, "State", 0x1000)
  3739. EndIf
  3740. DllStructSetData($tItem, "StateMask", 0xf000)
  3741. If IsHWnd($hWnd) Then
  3742. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  3743. Return _SendMessage($hWnd, $LVM_SETITEMW, 0, $tItem, 0, "wparam", "struct*") <> 0
  3744. Else
  3745. $pMemory = _MemInit($hWnd, $iItem, $tMemMap)
  3746. _MemWrite($tMemMap, $tItem)
  3747. If $bUnicode Then
  3748. $iRet = _SendMessage($hWnd, $LVM_SETITEMW, 0, $pMemory, 0, "wparam", "ptr")
  3749. Else
  3750. $iRet = _SendMessage($hWnd, $LVM_SETITEMA, 0, $pMemory, 0, "wparam", "ptr")
  3751. EndIf
  3752. _MemFree($tMemMap)
  3753. Return $iRet <> 0
  3754. EndIf
  3755. Else
  3756. If $bUnicode Then
  3757. Return GUICtrlSendMsg($hWnd, $LVM_SETITEMW, 0, $pItem) <> 0
  3758. Else
  3759. Return GUICtrlSendMsg($hWnd, $LVM_SETITEMA, 0, $pItem) <> 0
  3760. EndIf
  3761. EndIf
  3762. Else
  3763. For $x = 0 To _GUICtrlListView_GetItemCount($hWnd) - 1
  3764. DllStructSetData($tItem, "Mask", $LVIF_STATE)
  3765. DllStructSetData($tItem, "Item", $x)
  3766. If ($bCheck) Then
  3767. DllStructSetData($tItem, "State", 0x2000)
  3768. Else
  3769. DllStructSetData($tItem, "State", 0x1000)
  3770. EndIf
  3771. DllStructSetData($tItem, "StateMask", 0xf000)
  3772. If IsHWnd($hWnd) Then
  3773. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  3774. If Not _SendMessage($hWnd, $LVM_SETITEMW, 0, $tItem, 0, "wparam", "struct*") <> 0 Then Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
  3775. Else
  3776. $pMemory = _MemInit($hWnd, $iItem, $tMemMap)
  3777. _MemWrite($tMemMap, $tItem)
  3778. If $bUnicode Then
  3779. $iRet = _SendMessage($hWnd, $LVM_SETITEMW, 0, $pMemory, 0, "wparam", "ptr")
  3780. Else
  3781. $iRet = _SendMessage($hWnd, $LVM_SETITEMA, 0, $pMemory, 0, "wparam", "ptr")
  3782. EndIf
  3783. _MemFree($tMemMap)
  3784. If Not $iRet <> 0 Then Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
  3785. EndIf
  3786. Else
  3787. If $bUnicode Then
  3788. If Not GUICtrlSendMsg($hWnd, $LVM_SETITEMW, 0, $pItem) <> 0 Then Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
  3789. Else
  3790. If Not GUICtrlSendMsg($hWnd, $LVM_SETITEMA, 0, $pItem) <> 0 Then Return SetError($LV_ERR, $LV_ERR, $LV_ERR)
  3791. EndIf
  3792. EndIf
  3793. Next
  3794. Return True
  3795. EndIf
  3796. Return False
  3797. EndFunc ;==>_GUICtrlListView_SetItemChecked
  3798. ; #FUNCTION# ====================================================================================================================
  3799. ; Author ........: Gary Frost (gafrost)
  3800. ; Modified.......:
  3801. ; ===============================================================================================================================
  3802. Func _GUICtrlListView_SetItemCount($hWnd, $iItems)
  3803. If IsHWnd($hWnd) Then
  3804. Return _SendMessage($hWnd, $LVM_SETITEMCOUNT, $iItems, BitOR($LVSICF_NOINVALIDATEALL, $LVSICF_NOSCROLL)) <> 0
  3805. Else
  3806. Return GUICtrlSendMsg($hWnd, $LVM_SETITEMCOUNT, $iItems, BitOR($LVSICF_NOINVALIDATEALL, $LVSICF_NOSCROLL)) <> 0
  3807. EndIf
  3808. EndFunc ;==>_GUICtrlListView_SetItemCount
  3809. ; #FUNCTION# ====================================================================================================================
  3810. ; Author ........: Paul Campbell (PaulIA)
  3811. ; Modified.......:
  3812. ; ===============================================================================================================================
  3813. Func _GUICtrlListView_SetItemCut($hWnd, $iIndex, $bEnabled = True)
  3814. Local $iState = 0
  3815. If $bEnabled Then $iState = $LVIS_CUT
  3816. Return _GUICtrlListView_SetItemState($hWnd, $iIndex, $iState, $LVIS_CUT)
  3817. EndFunc ;==>_GUICtrlListView_SetItemCut
  3818. ; #FUNCTION# ====================================================================================================================
  3819. ; Author ........: Paul Campbell (PaulIA)
  3820. ; Modified.......:
  3821. ; ===============================================================================================================================
  3822. Func _GUICtrlListView_SetItemDropHilited($hWnd, $iIndex, $bEnabled = True)
  3823. Local $iState = 0
  3824. If $bEnabled Then $iState = $LVIS_DROPHILITED
  3825. Return _GUICtrlListView_SetItemState($hWnd, $iIndex, $iState, $LVIS_DROPHILITED)
  3826. EndFunc ;==>_GUICtrlListView_SetItemDropHilited
  3827. ; #FUNCTION# ====================================================================================================================
  3828. ; Author ........: Paul Campbell (PaulIA)
  3829. ; Modified.......: Gary Frost (gafrost)
  3830. ; ===============================================================================================================================
  3831. Func _GUICtrlListView_SetItemEx($hWnd, ByRef $tItem)
  3832. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  3833. Local $iRet
  3834. If IsHWnd($hWnd) Then
  3835. Local $iItem = DllStructGetSize($tItem)
  3836. Local $iBuffer = DllStructGetData($tItem, "TextMax")
  3837. Local $pBuffer = DllStructGetData($tItem, "Text")
  3838. If $bUnicode Then $iBuffer *= 2
  3839. Local $tMemMap
  3840. Local $pMemory = _MemInit($hWnd, $iItem + $iBuffer, $tMemMap)
  3841. Local $pText = $pMemory + $iItem
  3842. DllStructSetData($tItem, "Text", $pText)
  3843. _MemWrite($tMemMap, $tItem, $pMemory, $iItem)
  3844. If $pBuffer <> 0 Then _MemWrite($tMemMap, $pBuffer, $pText, $iBuffer)
  3845. If $bUnicode Then
  3846. $iRet = _SendMessage($hWnd, $LVM_SETITEMW, 0, $pMemory, 0, "wparam", "ptr")
  3847. Else
  3848. $iRet = _SendMessage($hWnd, $LVM_SETITEMA, 0, $pMemory, 0, "wparam", "ptr")
  3849. EndIf
  3850. _MemFree($tMemMap)
  3851. Else
  3852. Local $pItem = DllStructGetPtr($tItem)
  3853. If $bUnicode Then
  3854. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETITEMW, 0, $pItem)
  3855. Else
  3856. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETITEMA, 0, $pItem)
  3857. EndIf
  3858. EndIf
  3859. Return $iRet <> 0
  3860. EndFunc ;==>_GUICtrlListView_SetItemEx
  3861. ; #FUNCTION# ====================================================================================================================
  3862. ; Author ........: Paul Campbell (PaulIA)
  3863. ; Modified.......:
  3864. ; ===============================================================================================================================
  3865. Func _GUICtrlListView_SetItemFocused($hWnd, $iIndex, $bEnabled = True)
  3866. Local $iState = 0
  3867. If $bEnabled Then $iState = $LVIS_FOCUSED
  3868. Return _GUICtrlListView_SetItemState($hWnd, $iIndex, $iState, $LVIS_FOCUSED)
  3869. EndFunc ;==>_GUICtrlListView_SetItemFocused
  3870. ; #FUNCTION# ====================================================================================================================
  3871. ; Author ........: Yoan Roblet (Arcker), Paul Campbell (PaulIA)
  3872. ; Modified.......:
  3873. ; ===============================================================================================================================
  3874. Func _GUICtrlListView_SetItemGroupID($hWnd, $iIndex, $iGroupID)
  3875. Local $tItem = DllStructCreate($tagLVITEM)
  3876. DllStructSetData($tItem, "Mask", $LVIF_GROUPID)
  3877. DllStructSetData($tItem, "Item", $iIndex)
  3878. DllStructSetData($tItem, "GroupID", $iGroupID)
  3879. Return _GUICtrlListView_SetItemEx($hWnd, $tItem)
  3880. EndFunc ;==>_GUICtrlListView_SetItemGroupID
  3881. ; #FUNCTION# ====================================================================================================================
  3882. ; Author ........: Paul Campbell (PaulIA)
  3883. ; Modified.......:
  3884. ; ===============================================================================================================================
  3885. Func _GUICtrlListView_SetItemImage($hWnd, $iIndex, $iImage, $iSubItem = 0)
  3886. Local $tItem = DllStructCreate($tagLVITEM)
  3887. DllStructSetData($tItem, "Mask", $LVIF_IMAGE)
  3888. DllStructSetData($tItem, "Item", $iIndex)
  3889. DllStructSetData($tItem, "SubItem", $iSubItem)
  3890. DllStructSetData($tItem, "Image", $iImage)
  3891. Return _GUICtrlListView_SetItemEx($hWnd, $tItem)
  3892. EndFunc ;==>_GUICtrlListView_SetItemImage
  3893. ; #FUNCTION# ====================================================================================================================
  3894. ; Author ........: Paul Campbell (PaulIA)
  3895. ; Modified.......:
  3896. ; ===============================================================================================================================
  3897. Func _GUICtrlListView_SetItemIndent($hWnd, $iIndex, $iIndent)
  3898. Local $tItem = DllStructCreate($tagLVITEM)
  3899. DllStructSetData($tItem, "Mask", $LVIF_INDENT)
  3900. DllStructSetData($tItem, "Item", $iIndex)
  3901. DllStructSetData($tItem, "Indent", $iIndent)
  3902. Return _GUICtrlListView_SetItemEx($hWnd, $tItem)
  3903. EndFunc ;==>_GUICtrlListView_SetItemIndent
  3904. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  3905. ; Name...........: __GUICtrlListView_SetItemOverlayImage
  3906. ; Description ...: Sets the overlay image is superimposed over the item's icon image
  3907. ; Syntax.........: __GUICtrlListView_SetItemOverlayImage ( $hWnd, $iIndex, $iImage )
  3908. ; Parameters ....: $hWnd - Handle to the control
  3909. ; $iIndex - Zero based index of the item
  3910. ; $iImage - One based overlay image index
  3911. ; Return values .: Success - True
  3912. ; Failure - False
  3913. ; Author ........: Paul Campbell (PaulIA)
  3914. ; Modified.......:
  3915. ; Remarks .......: This function is used internally and should not normally be called
  3916. ; Related .......: __GUICtrlListView_GetItemOverlayImage
  3917. ; Link ..........:
  3918. ; Example .......:
  3919. ; ===============================================================================================================================
  3920. Func __GUICtrlListView_SetItemOverlayImage($hWnd, $iIndex, $iImage)
  3921. Return _GUICtrlListView_SetItemState($hWnd, $iIndex, __GUICtrlListView_IndexToOverlayImageMask($iImage), $LVIS_OVERLAYMASK)
  3922. EndFunc ;==>__GUICtrlListView_SetItemOverlayImage
  3923. ; #FUNCTION# ====================================================================================================================
  3924. ; Author ........: Paul Campbell (PaulIA)
  3925. ; Modified.......:
  3926. ; ===============================================================================================================================
  3927. Func _GUICtrlListView_SetItemParam($hWnd, $iIndex, $iParam)
  3928. Local $tItem = DllStructCreate($tagLVITEM)
  3929. DllStructSetData($tItem, "Mask", $LVIF_PARAM)
  3930. DllStructSetData($tItem, "Item", $iIndex)
  3931. DllStructSetData($tItem, "Param", $iParam)
  3932. Return _GUICtrlListView_SetItemEx($hWnd, $tItem)
  3933. EndFunc ;==>_GUICtrlListView_SetItemParam
  3934. ; #FUNCTION# ====================================================================================================================
  3935. ; Author ........: Paul Campbell (PaulIA)
  3936. ; Modified.......: Gary Frost (gafrost)
  3937. ; ===============================================================================================================================
  3938. Func _GUICtrlListView_SetItemPosition($hWnd, $iIndex, $iCX, $iCY)
  3939. If IsHWnd($hWnd) Then
  3940. Return _SendMessage($hWnd, $LVM_SETITEMPOSITION, $iIndex, _WinAPI_MakeLong($iCX, $iCY)) <> 0
  3941. Else
  3942. Return GUICtrlSendMsg($hWnd, $LVM_SETITEMPOSITION, $iIndex, _WinAPI_MakeLong($iCX, $iCY)) <> 0
  3943. EndIf
  3944. EndFunc ;==>_GUICtrlListView_SetItemPosition
  3945. ; #FUNCTION# ====================================================================================================================
  3946. ; Author ........: Paul Campbell (PaulIA)
  3947. ; Modified.......: Gary Frost (gafrost)
  3948. ; ===============================================================================================================================
  3949. Func _GUICtrlListView_SetItemPosition32($hWnd, $iIndex, $iCX, $iCY)
  3950. Local $tPoint = DllStructCreate($tagPOINT)
  3951. DllStructSetData($tPoint, "X", $iCX)
  3952. DllStructSetData($tPoint, "Y", $iCY)
  3953. Local $iRet
  3954. If IsHWnd($hWnd) Then
  3955. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  3956. $iRet = _SendMessage($hWnd, $LVM_SETITEMPOSITION32, $iIndex, $tPoint, 0, "wparam", "struct*")
  3957. Else
  3958. Local $iPoint = DllStructGetSize($tPoint)
  3959. Local $tMemMap
  3960. Local $pMemory = _MemInit($hWnd, $iPoint, $tMemMap)
  3961. _MemWrite($tMemMap, $tPoint)
  3962. $iRet = _SendMessage($hWnd, $LVM_SETITEMPOSITION32, $iIndex, $pMemory, 0, "wparam", "ptr")
  3963. _MemFree($tMemMap)
  3964. EndIf
  3965. Else
  3966. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETITEMPOSITION32, $iIndex, DllStructGetPtr($tPoint))
  3967. EndIf
  3968. Return $iRet <> 0
  3969. EndFunc ;==>_GUICtrlListView_SetItemPosition32
  3970. ; #FUNCTION# ====================================================================================================================
  3971. ; Author ........: Gary Frost
  3972. ; Modified.......:
  3973. ; ===============================================================================================================================
  3974. Func _GUICtrlListView_SetItemSelected($hWnd, $iIndex, $bSelected = True, $bFocused = False)
  3975. Local $tStruct = DllStructCreate($tagLVITEM)
  3976. Local $iRet, $iSelected = 0, $iFocused = 0, $iSize, $tMemMap, $pMemory
  3977. If ($bSelected = True) Then $iSelected = $LVIS_SELECTED
  3978. If ($bFocused = True And $iIndex <> -1) Then $iFocused = $LVIS_FOCUSED
  3979. DllStructSetData($tStruct, "Mask", $LVIF_STATE)
  3980. DllStructSetData($tStruct, "Item", $iIndex)
  3981. DllStructSetData($tStruct, "State", BitOR($iSelected, $iFocused))
  3982. DllStructSetData($tStruct, "StateMask", BitOR($LVIS_SELECTED, $iFocused))
  3983. $iSize = DllStructGetSize($tStruct)
  3984. If IsHWnd($hWnd) Then
  3985. $pMemory = _MemInit($hWnd, $iSize, $tMemMap)
  3986. _MemWrite($tMemMap, $tStruct, $pMemory, $iSize)
  3987. $iRet = _SendMessage($hWnd, $LVM_SETITEMSTATE, $iIndex, $pMemory)
  3988. _MemFree($tMemMap)
  3989. Else
  3990. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETITEMSTATE, $iIndex, DllStructGetPtr($tStruct))
  3991. EndIf
  3992. Return $iRet <> 0
  3993. EndFunc ;==>_GUICtrlListView_SetItemSelected
  3994. ; #FUNCTION# ====================================================================================================================
  3995. ; Author ........: Paul Campbell (PaulIA)
  3996. ; Modified.......:
  3997. ; ===============================================================================================================================
  3998. Func _GUICtrlListView_SetItemState($hWnd, $iIndex, $iState, $iStateMask)
  3999. Local $tItem = DllStructCreate($tagLVITEM)
  4000. DllStructSetData($tItem, "Mask", $LVIF_STATE)
  4001. DllStructSetData($tItem, "Item", $iIndex)
  4002. DllStructSetData($tItem, "State", $iState)
  4003. DllStructSetData($tItem, "StateMask", $iStateMask)
  4004. Return _GUICtrlListView_SetItemEx($hWnd, $tItem) <> 0
  4005. EndFunc ;==>_GUICtrlListView_SetItemState
  4006. ; #FUNCTION# ====================================================================================================================
  4007. ; Author ........: Paul Campbell (PaulIA)
  4008. ; Modified.......:
  4009. ; ===============================================================================================================================
  4010. Func _GUICtrlListView_SetItemStateImage($hWnd, $iIndex, $iImage)
  4011. Return _GUICtrlListView_SetItemState($hWnd, $iIndex, BitShift($iImage, -12), $LVIS_STATEIMAGEMASK)
  4012. EndFunc ;==>_GUICtrlListView_SetItemStateImage
  4013. ; #FUNCTION# ====================================================================================================================
  4014. ; Author ........: Paul Campbell (PaulIA)
  4015. ; Modified.......: Gary Frost (gafrost), added code by Ultima to set row text
  4016. ; ===============================================================================================================================
  4017. Func _GUICtrlListView_SetItemText($hWnd, $iIndex, $sText, $iSubItem = 0)
  4018. Local $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd)
  4019. Local $iRet
  4020. If $iSubItem = -1 Then
  4021. Local $sSeparatorChar = Opt('GUIDataSeparatorChar')
  4022. Local $i_Cols = _GUICtrlListView_GetColumnCount($hWnd)
  4023. Local $a_Text = StringSplit($sText, $sSeparatorChar)
  4024. If $i_Cols > $a_Text[0] Then $i_Cols = $a_Text[0]
  4025. For $i = 1 To $i_Cols
  4026. $iRet = _GUICtrlListView_SetItemText($hWnd, $iIndex, $a_Text[$i], $i - 1)
  4027. If Not $iRet Then ExitLoop
  4028. Next
  4029. Return $iRet
  4030. EndIf
  4031. Local $iBuffer = StringLen($sText) + 1
  4032. Local $tBuffer
  4033. If $bUnicode Then
  4034. $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  4035. $iBuffer *= 2
  4036. Else
  4037. $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]")
  4038. EndIf
  4039. Local $pBuffer = DllStructGetPtr($tBuffer)
  4040. Local $tItem = DllStructCreate($tagLVITEM)
  4041. DllStructSetData($tBuffer, "Text", $sText)
  4042. DllStructSetData($tItem, "Mask", $LVIF_TEXT)
  4043. DllStructSetData($tItem, "item", $iIndex)
  4044. DllStructSetData($tItem, "SubItem", $iSubItem)
  4045. If IsHWnd($hWnd) Then
  4046. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  4047. DllStructSetData($tItem, "Text", $pBuffer)
  4048. $iRet = _SendMessage($hWnd, $LVM_SETITEMW, 0, $tItem, 0, "wparam", "struct*")
  4049. Else
  4050. Local $iItem = DllStructGetSize($tItem)
  4051. Local $tMemMap
  4052. Local $pMemory = _MemInit($hWnd, $iItem + $iBuffer, $tMemMap)
  4053. Local $pText = $pMemory + $iItem
  4054. DllStructSetData($tItem, "Text", $pText)
  4055. _MemWrite($tMemMap, $tItem, $pMemory, $iItem)
  4056. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  4057. If $bUnicode Then
  4058. $iRet = _SendMessage($hWnd, $LVM_SETITEMW, 0, $pMemory, 0, "wparam", "ptr")
  4059. Else
  4060. $iRet = _SendMessage($hWnd, $LVM_SETITEMA, 0, $pMemory, 0, "wparam", "ptr")
  4061. EndIf
  4062. _MemFree($tMemMap)
  4063. EndIf
  4064. Else
  4065. Local $pItem = DllStructGetPtr($tItem)
  4066. DllStructSetData($tItem, "Text", $pBuffer)
  4067. If $bUnicode Then
  4068. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETITEMW, 0, $pItem)
  4069. Else
  4070. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETITEMA, 0, $pItem)
  4071. EndIf
  4072. EndIf
  4073. Return $iRet <> 0
  4074. EndFunc ;==>_GUICtrlListView_SetItemText
  4075. ; #FUNCTION# ====================================================================================================================
  4076. ; Author ........: Paul Campbell (PaulIA)
  4077. ; Modified.......: Gary Frost (gafrost)
  4078. ; ===============================================================================================================================
  4079. Func _GUICtrlListView_SetOutlineColor($hWnd, $iColor)
  4080. If IsHWnd($hWnd) Then
  4081. Return _SendMessage($hWnd, $LVM_SETOUTLINECOLOR, 0, $iColor)
  4082. Else
  4083. Return GUICtrlSendMsg($hWnd, $LVM_SETOUTLINECOLOR, 0, $iColor)
  4084. EndIf
  4085. EndFunc ;==>_GUICtrlListView_SetOutlineColor
  4086. ; #FUNCTION# ====================================================================================================================
  4087. ; Author ........: Gary Frost (gafrost)
  4088. ; Modified.......:
  4089. ; ===============================================================================================================================
  4090. Func _GUICtrlListView_SetSelectedColumn($hWnd, $iCol)
  4091. If IsHWnd($hWnd) Then
  4092. _SendMessage($hWnd, $LVM_SETSELECTEDCOLUMN, $iCol)
  4093. _WinAPI_InvalidateRect($hWnd)
  4094. Else
  4095. GUICtrlSendMsg($hWnd, $LVM_SETSELECTEDCOLUMN, $iCol, 0)
  4096. _WinAPI_InvalidateRect(GUICtrlGetHandle($hWnd))
  4097. EndIf
  4098. EndFunc ;==>_GUICtrlListView_SetSelectedColumn
  4099. ; #FUNCTION# ====================================================================================================================
  4100. ; Author ........: Paul Campbell (PaulIA)
  4101. ; Modified.......: Gary Frost (gafrost)
  4102. ; ===============================================================================================================================
  4103. Func _GUICtrlListView_SetSelectionMark($hWnd, $iIndex)
  4104. If IsHWnd($hWnd) Then
  4105. Return _SendMessage($hWnd, $LVM_SETSELECTIONMARK, 0, $iIndex)
  4106. Else
  4107. Return GUICtrlSendMsg($hWnd, $LVM_SETSELECTIONMARK, 0, $iIndex)
  4108. EndIf
  4109. EndFunc ;==>_GUICtrlListView_SetSelectionMark
  4110. ; #FUNCTION# ====================================================================================================================
  4111. ; Author ........: Paul Campbell (PaulIA)
  4112. ; Modified.......: Gary Frost (gafrost)
  4113. ; ===============================================================================================================================
  4114. Func _GUICtrlListView_SetTextBkColor($hWnd, $iColor)
  4115. If IsHWnd($hWnd) Then
  4116. Return _SendMessage($hWnd, $LVM_SETTEXTBKCOLOR, 0, $iColor) <> 0
  4117. Else
  4118. Return GUICtrlSendMsg($hWnd, $LVM_SETTEXTBKCOLOR, 0, $iColor) <> 0
  4119. EndIf
  4120. EndFunc ;==>_GUICtrlListView_SetTextBkColor
  4121. ; #FUNCTION# ====================================================================================================================
  4122. ; Author ........: Paul Campbell (PaulIA)
  4123. ; Modified.......: Gary Frost (gafrost)
  4124. ; ===============================================================================================================================
  4125. Func _GUICtrlListView_SetTextColor($hWnd, $iColor)
  4126. Local $iRet
  4127. If IsHWnd($hWnd) Then
  4128. $iRet = _SendMessage($hWnd, $LVM_SETTEXTCOLOR, 0, $iColor)
  4129. _WinAPI_InvalidateRect($hWnd)
  4130. Else
  4131. $iRet = GUICtrlSendMsg($hWnd, $LVM_SETTEXTCOLOR, 0, $iColor)
  4132. _WinAPI_InvalidateRect(GUICtrlGetHandle($hWnd))
  4133. EndIf
  4134. Return $iRet <> 0
  4135. EndFunc ;==>_GUICtrlListView_SetTextColor
  4136. ; #FUNCTION# ====================================================================================================================
  4137. ; Author ........: Paul Campbell (PaulIA)
  4138. ; Modified.......: Gary Frost (gafrost)
  4139. ; ===============================================================================================================================
  4140. Func _GUICtrlListView_SetToolTips($hWnd, $hToolTip)
  4141. If IsHWnd($hWnd) Then
  4142. Return _SendMessage($hWnd, $LVM_SETTOOLTIPS, 0, $hToolTip, 0, "wparam", "hwnd", "hwnd")
  4143. Else
  4144. Return HWnd(GUICtrlSendMsg($hWnd, $LVM_SETTOOLTIPS, 0, $hToolTip))
  4145. EndIf
  4146. EndFunc ;==>_GUICtrlListView_SetToolTips
  4147. ; #FUNCTION# ====================================================================================================================
  4148. ; Author ........: Paul Campbell (PaulIA)
  4149. ; Modified.......: Gary Frost (gafrost)
  4150. ; ===============================================================================================================================
  4151. Func _GUICtrlListView_SetUnicodeFormat($hWnd, $bUnicode)
  4152. If IsHWnd($hWnd) Then
  4153. Return _SendMessage($hWnd, $LVM_SETUNICODEFORMAT, $bUnicode)
  4154. Else
  4155. Return GUICtrlSendMsg($hWnd, $LVM_SETUNICODEFORMAT, $bUnicode, 0)
  4156. EndIf
  4157. EndFunc ;==>_GUICtrlListView_SetUnicodeFormat
  4158. ; #FUNCTION# ====================================================================================================================
  4159. ; Author ........: Paul Campbell (PaulIA)
  4160. ; Modified.......: Gary Frost (gafrost)
  4161. ; ===============================================================================================================================
  4162. Func _GUICtrlListView_SetView($hWnd, $iView)
  4163. Local $aView[5] = [$LV_VIEW_ICON, $LV_VIEW_DETAILS, $LV_VIEW_LIST, $LV_VIEW_SMALLICON, $LV_VIEW_TILE]
  4164. If IsHWnd($hWnd) Then
  4165. Return _SendMessage($hWnd, $LVM_SETVIEW, $aView[$iView]) <> -1
  4166. Else
  4167. Return GUICtrlSendMsg($hWnd, $LVM_SETVIEW, $aView[$iView], 0) <> -1
  4168. EndIf
  4169. EndFunc ;==>_GUICtrlListView_SetView
  4170. ; #FUNCTION# ====================================================================================================================
  4171. ; Author ........: Paul Campbell (PaulIA)
  4172. ; Modified.......: Gary Frost (gafrost)
  4173. ; ===============================================================================================================================
  4174. Func _GUICtrlListView_SetWorkAreas($hWnd, $iLeft, $iTop, $iRight, $iBottom)
  4175. Local $tRECT = DllStructCreate($tagRECT)
  4176. DllStructSetData($tRECT, "Left", $iLeft)
  4177. DllStructSetData($tRECT, "Top", $iTop)
  4178. DllStructSetData($tRECT, "Right", $iRight)
  4179. DllStructSetData($tRECT, "Bottom", $iBottom)
  4180. If IsHWnd($hWnd) Then
  4181. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  4182. _SendMessage($hWnd, $LVM_SETWORKAREAS, 1, $tRECT, 0, "wparam", "struct*")
  4183. Else
  4184. Local $iRect = DllStructGetSize($tRECT)
  4185. Local $tMemMap
  4186. Local $pMemory = _MemInit($hWnd, $iRect, $tMemMap)
  4187. _MemWrite($tMemMap, $tRECT, $pMemory, $iRect)
  4188. _SendMessage($hWnd, $LVM_SETWORKAREAS, 1, $pMemory, 0, "wparam", "ptr")
  4189. _MemFree($tMemMap)
  4190. EndIf
  4191. Else
  4192. GUICtrlSendMsg($hWnd, $LVM_SETWORKAREAS, 1, DllStructGetPtr($tRECT))
  4193. EndIf
  4194. EndFunc ;==>_GUICtrlListView_SetWorkAreas
  4195. ; #FUNCTION# ====================================================================================================================
  4196. ; Author ........: Gary Frost (gafrost)
  4197. ; Modified.......: guinness - Re-write of function to remove magic numbers and unnecessary use of UBound. Melba23 - Added optional parameter to reverse the $vSortSense variable.
  4198. ; Modified.......: Melba23 to fix checked item bug in __GUICtrlListView_GetCheckedIndices
  4199. ; ===============================================================================================================================
  4200. Func _GUICtrlListView_SimpleSort($hWnd, ByRef $vSortSense, $iCol, $bToggleSense = True)
  4201. Local $iItemCount = _GUICtrlListView_GetItemCount($hWnd)
  4202. If $iItemCount Then
  4203. Local $iDescending = 0
  4204. If UBound($vSortSense) Then
  4205. $iDescending = $vSortSense[$iCol]
  4206. Else
  4207. $iDescending = $vSortSense
  4208. EndIf
  4209. Local $vSeparatorChar = Opt('GUIDataSeparatorChar')
  4210. Local $iColumnCount = _GUICtrlListView_GetColumnCount($hWnd)
  4211. Local Enum $iIndexValue = $iColumnCount, $iItemParam ; Additional columns for the index value and ItemParam
  4212. Local $aListViewItems[$iItemCount][$iColumnCount + 2]
  4213. Local $aSelectedItems = StringSplit(_GUICtrlListView_GetSelectedIndices($hWnd), $vSeparatorChar)
  4214. Local $aCheckedItems = __GUICtrlListView_GetCheckedIndices($hWnd)
  4215. Local $sItemText, $iFocused = -1
  4216. For $i = 0 To $iItemCount - 1 ; Rows
  4217. If $iFocused = -1 Then
  4218. If _GUICtrlListView_GetItemFocused($hWnd, $i) Then $iFocused = $i
  4219. EndIf
  4220. _GUICtrlListView_SetItemSelected($hWnd, $i, False)
  4221. _GUICtrlListView_SetItemChecked($hWnd, $i, False)
  4222. For $j = 0 To $iColumnCount - 1 ; Columns
  4223. $sItemText = StringStripWS(_GUICtrlListView_GetItemText($hWnd, $i, $j), $STR_STRIPTRAILING)
  4224. If (StringIsFloat($sItemText) Or StringIsInt($sItemText)) Then
  4225. $aListViewItems[$i][$j] = Number($sItemText)
  4226. Else
  4227. $aListViewItems[$i][$j] = $sItemText
  4228. EndIf
  4229. Next
  4230. $aListViewItems[$i][$iIndexValue] = $i ; Index value
  4231. $aListViewItems[$i][$iItemParam] = _GUICtrlListView_GetItemParam($hWnd, $i) ; ItemParam
  4232. Next
  4233. ; Sort the ListView array
  4234. _ArraySort($aListViewItems, $iDescending, 0, 0, $iCol)
  4235. For $i = 0 To $iItemCount - 1 ; Rows
  4236. For $j = 0 To $iColumnCount - 1 ; Columns
  4237. _GUICtrlListView_SetItemText($hWnd, $i, $aListViewItems[$i][$j], $j)
  4238. Next
  4239. _GUICtrlListView_SetItemParam($hWnd, $i, $aListViewItems[$i][$iItemParam]) ; ItemParam
  4240. For $j = 1 To $aSelectedItems[0]
  4241. If $aListViewItems[$i][$iIndexValue] = $aSelectedItems[$j] Then
  4242. If $aListViewItems[$i][$iIndexValue] = $iFocused Then
  4243. _GUICtrlListView_SetItemSelected($hWnd, $i, True, True)
  4244. Else
  4245. _GUICtrlListView_SetItemSelected($hWnd, $i, True)
  4246. EndIf
  4247. ExitLoop
  4248. EndIf
  4249. Next
  4250. For $j = 1 To $aCheckedItems[0]
  4251. If $aListViewItems[$i][$iIndexValue] = $aCheckedItems[$j] Then
  4252. _GUICtrlListView_SetItemChecked($hWnd, $i, True)
  4253. ExitLoop
  4254. EndIf
  4255. Next
  4256. Next
  4257. If $bToggleSense Then ; Automatic sort sense toggle
  4258. If UBound($vSortSense) Then
  4259. $vSortSense[$iCol] = Not $iDescending
  4260. Else
  4261. $vSortSense = Not $iDescending
  4262. EndIf
  4263. EndIf
  4264. EndIf
  4265. EndFunc ;==>_GUICtrlListView_SimpleSort
  4266. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  4267. ; Name...........: __GUICtrlListView_Sort
  4268. ; Description ...: Our sorting callback function
  4269. ; Syntax.........: __GUICtrlListView_Sort ( $nItem1, $nItem2, $hWnd )
  4270. ; Parameters ....: $nItem1 - Param of 1st item
  4271. ; $nItem2 - Param of 2nd item
  4272. ; $hWnd - Handle of the control
  4273. ; Return values .: None
  4274. ; Author ........: Gary Frost (gafrost)
  4275. ; Modified.......:
  4276. ; Remarks .......: For Internal Use Only
  4277. ; Related .......:
  4278. ; Link ..........:
  4279. ; Example .......:
  4280. ; ===============================================================================================================================
  4281. #Au3Stripper_Ignore_Funcs=__GUICtrlListView_Sort
  4282. Func __GUICtrlListView_Sort($nItem1, $nItem2, $hWnd)
  4283. Local $iIndex, $sVal1, $sVal2, $nResult
  4284. For $x = 1 To $__g_aListViewSortInfo[0][0]
  4285. If $hWnd = $__g_aListViewSortInfo[$x][1] Then
  4286. $iIndex = $x
  4287. ExitLoop
  4288. EndIf
  4289. Next
  4290. ; Switch the sorting direction
  4291. If $__g_aListViewSortInfo[$iIndex][3] = $__g_aListViewSortInfo[$iIndex][4] Then ; $nColumn = nCurCol ?
  4292. If Not $__g_aListViewSortInfo[$iIndex][7] Then ; $bSet
  4293. $__g_aListViewSortInfo[$iIndex][5] *= -1 ; $nSortDir
  4294. $__g_aListViewSortInfo[$iIndex][7] = 1 ; $bSet
  4295. EndIf
  4296. Else
  4297. $__g_aListViewSortInfo[$iIndex][7] = 1 ; $bSet
  4298. EndIf
  4299. $__g_aListViewSortInfo[$iIndex][6] = $__g_aListViewSortInfo[$iIndex][3] ; $nCol = $nColumn
  4300. $sVal1 = _GUICtrlListView_GetItemText($hWnd, $nItem1, $__g_aListViewSortInfo[$iIndex][3])
  4301. $sVal2 = _GUICtrlListView_GetItemText($hWnd, $nItem2, $__g_aListViewSortInfo[$iIndex][3])
  4302. If $__g_aListViewSortInfo[$iIndex][8] = 1 Then
  4303. ; force Treat as Number if possible
  4304. If (StringIsFloat($sVal1) Or StringIsInt($sVal1)) Then $sVal1 = Number($sVal1)
  4305. If (StringIsFloat($sVal2) Or StringIsInt($sVal2)) Then $sVal2 = Number($sVal2)
  4306. EndIf
  4307. If $__g_aListViewSortInfo[$iIndex][8] < 2 Then
  4308. ; Treat as String or Number
  4309. $nResult = 0 ; No change of item1 and item2 positions
  4310. If $sVal1 < $sVal2 Then
  4311. $nResult = -1 ; Put item2 before item1
  4312. ElseIf $sVal1 > $sVal2 Then
  4313. $nResult = 1 ; Put item2 behind item1
  4314. EndIf
  4315. Else
  4316. ; Use API handling
  4317. $nResult = DllCall('shlwapi.dll', 'int', 'StrCmpLogicalW', 'wstr', $sVal1, 'wstr', $sVal2)[0]
  4318. EndIf
  4319. $nResult = $nResult * $__g_aListViewSortInfo[$iIndex][5] ; $nSortDir
  4320. Return $nResult
  4321. EndFunc ;==>__GUICtrlListView_Sort
  4322. ; #FUNCTION# ====================================================================================================================
  4323. ; Author ........: Gary Frost (gafrost)
  4324. ; Modified.......:
  4325. ; ===============================================================================================================================
  4326. Func _GUICtrlListView_SortItems($hWnd, $iCol)
  4327. Local $iRet, $iIndex, $pFunction, $hHeader, $iFormat
  4328. If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
  4329. For $x = 1 To $__g_aListViewSortInfo[0][0]
  4330. If $hWnd = $__g_aListViewSortInfo[$x][1] Then
  4331. $iIndex = $x
  4332. ExitLoop
  4333. EndIf
  4334. Next
  4335. $pFunction = DllCallbackGetPtr($__g_aListViewSortInfo[$iIndex][2]) ; get pointer to call back
  4336. $__g_aListViewSortInfo[$iIndex][3] = $iCol ; $nColumn = column clicked
  4337. $__g_aListViewSortInfo[$iIndex][7] = 0 ; $bSet
  4338. $__g_aListViewSortInfo[$iIndex][4] = $__g_aListViewSortInfo[$iIndex][6] ; nCurCol = $nCol
  4339. $iRet = _SendMessage($hWnd, $LVM_SORTITEMSEX, $hWnd, $pFunction, 0, "hwnd", "ptr")
  4340. If $iRet <> 0 Then
  4341. If $__g_aListViewSortInfo[$iIndex][9] Then ; Use arrow in header
  4342. $hHeader = $__g_aListViewSortInfo[$iIndex][10]
  4343. For $x = 0 To _GUICtrlHeader_GetItemCount($hHeader) - 1
  4344. $iFormat = _GUICtrlHeader_GetItemFormat($hHeader, $x)
  4345. If BitAND($iFormat, $HDF_SORTDOWN) Then
  4346. _GUICtrlHeader_SetItemFormat($hHeader, $x, BitXOR($iFormat, $HDF_SORTDOWN))
  4347. ElseIf BitAND($iFormat, $HDF_SORTUP) Then
  4348. _GUICtrlHeader_SetItemFormat($hHeader, $x, BitXOR($iFormat, $HDF_SORTUP))
  4349. EndIf
  4350. Next
  4351. $iFormat = _GUICtrlHeader_GetItemFormat($hHeader, $iCol)
  4352. If $__g_aListViewSortInfo[$iIndex][5] = 1 Then ; ascending
  4353. _GUICtrlHeader_SetItemFormat($hHeader, $iCol, BitOR($iFormat, $HDF_SORTUP))
  4354. Else ; descending
  4355. _GUICtrlHeader_SetItemFormat($hHeader, $iCol, BitOR($iFormat, $HDF_SORTDOWN))
  4356. EndIf
  4357. EndIf
  4358. EndIf
  4359. Return $iRet <> 0
  4360. EndFunc ;==>_GUICtrlListView_SortItems
  4361. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  4362. ; Name...........: __GUICtrlListView_StateImageMaskToIndex
  4363. ; Description ...: Converts a state image mask to an image index
  4364. ; Syntax.........: __GUICtrlListView_StateImageMaskToIndex ( $iMask )
  4365. ; Parameters ....: $iMask - State image mask
  4366. ; Return values .: Success - One base state image index
  4367. ; Author ........: Paul Campbell (PaulIA)
  4368. ; Modified.......:
  4369. ; Remarks .......: This function is used internally and should not normally be called
  4370. ; Related .......: __GUICtrlListView_IndexToStateImageMask
  4371. ; Link ..........:
  4372. ; Example .......:
  4373. ; ===============================================================================================================================
  4374. Func __GUICtrlListView_StateImageMaskToIndex($iMask)
  4375. Return BitShift(BitAND($iMask, $LVIS_STATEIMAGEMASK), 12)
  4376. EndFunc ;==>__GUICtrlListView_StateImageMaskToIndex
  4377. ; #FUNCTION# ====================================================================================================================
  4378. ; Author ........: Paul Campbell (PaulIA)
  4379. ; Modified.......: Gary Frost (gafrost)
  4380. ; ===============================================================================================================================
  4381. Func _GUICtrlListView_SubItemHitTest($hWnd, $iX = -1, $iY = -1)
  4382. Local $iTest, $tTest, $pMemory, $tMemMap, $iFlags, $aTest[11]
  4383. If $iX = -1 Then $iX = _WinAPI_GetMousePosX(True, $hWnd)
  4384. If $iY = -1 Then $iY = _WinAPI_GetMousePosY(True, $hWnd)
  4385. $tTest = DllStructCreate($tagLVHITTESTINFO)
  4386. DllStructSetData($tTest, "X", $iX)
  4387. DllStructSetData($tTest, "Y", $iY)
  4388. If IsHWnd($hWnd) Then
  4389. If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then
  4390. _SendMessage($hWnd, $LVM_SUBITEMHITTEST, 0, $tTest, 0, "wparam", "struct*")
  4391. Else
  4392. $iTest = DllStructGetSize($tTest)
  4393. $pMemory = _MemInit($hWnd, $iTest, $tMemMap)
  4394. _MemWrite($tMemMap, $tTest)
  4395. _SendMessage($hWnd, $LVM_SUBITEMHITTEST, 0, $pMemory, 0, "wparam", "ptr")
  4396. _MemRead($tMemMap, $pMemory, $tTest, $iTest)
  4397. _MemFree($tMemMap)
  4398. EndIf
  4399. Else
  4400. GUICtrlSendMsg($hWnd, $LVM_SUBITEMHITTEST, 0, DllStructGetPtr($tTest))
  4401. EndIf
  4402. $iFlags = DllStructGetData($tTest, "Flags")
  4403. $aTest[0] = DllStructGetData($tTest, "Item")
  4404. $aTest[1] = DllStructGetData($tTest, "SubItem")
  4405. $aTest[2] = BitAND($iFlags, $LVHT_NOWHERE) <> 0
  4406. $aTest[3] = BitAND($iFlags, $LVHT_ONITEMICON) <> 0
  4407. $aTest[4] = BitAND($iFlags, $LVHT_ONITEMLABEL) <> 0
  4408. $aTest[5] = BitAND($iFlags, $LVHT_ONITEMSTATEICON) <> 0
  4409. $aTest[6] = BitAND($iFlags, $LVHT_ONITEM) <> 0
  4410. $aTest[7] = BitAND($iFlags, $LVHT_ABOVE) <> 0
  4411. $aTest[8] = BitAND($iFlags, $LVHT_BELOW) <> 0
  4412. $aTest[9] = BitAND($iFlags, $LVHT_TOLEFT) <> 0
  4413. $aTest[10] = BitAND($iFlags, $LVHT_TORIGHT) <> 0
  4414. Return $aTest
  4415. EndFunc ;==>_GUICtrlListView_SubItemHitTest
  4416. ; #FUNCTION# ====================================================================================================================
  4417. ; Author ........: Gary Frost (gafrost)
  4418. ; Modified.......:
  4419. ; ===============================================================================================================================
  4420. Func _GUICtrlListView_UnRegisterSortCallBack($hWnd)
  4421. If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
  4422. For $x = 1 To $__g_aListViewSortInfo[0][0]
  4423. If $hWnd = $__g_aListViewSortInfo[$x][1] Then
  4424. DllCallbackFree($__g_aListViewSortInfo[$x][2])
  4425. __GUICtrlListView_ArrayDelete($__g_aListViewSortInfo, $x)
  4426. $__g_aListViewSortInfo[0][0] -= 1
  4427. ExitLoop
  4428. EndIf
  4429. Next
  4430. EndFunc ;==>_GUICtrlListView_UnRegisterSortCallBack