<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Calling a WinAPI Macro problem in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-a-WinAPI-Macro-problem/m-p/791674#M33004</link>
    <description>Hi there.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I have a problem with a macro of the WinAPI.&lt;/DIV&gt;&lt;DIV&gt;In one of my ListViews, i have to use Checkboxes to select/deselect items for interacting with them in the next step.&lt;/DIV&gt;&lt;DIV&gt;For that, i set the style of the ListView by using SendMessage withLVM_SETEXTENDEDLISTVIEWSTYLE.&lt;/DIV&gt;&lt;DIV&gt;So far so good...works like a charm and the checkboxes too.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The main problem is, that i am not able to read out the states of the checkboxes.&lt;/DIV&gt;&lt;DIV&gt;What i found through MSDN searching is, that there seems to be only one possible way to find out the state ... using the ListView_GetCheckState macro.Sadly it seems not to be implemented withing the Fortran Compiler (vers. 11) so i decided to use an interface (which i did on TrayIcon Balloontips before and worked).&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;My Interface looks like this:&lt;BR /&gt;[fxfortran]INTERFACE   
        logical(BOOL) function ListViewGetCheckState(hwndLV, iIndex)
          !DEC$ ATTRIBUTES DEFAULT :: ListViewGetCheckState  
          !DEC$ ATTRIBUTES STDCALL, DECORATE :: ListViewGetCheckState  
          !DEC$ ATTRIBUTES ALIAS:'ListView_GetCheckState' :: ListViewGetCheckState   
          use comctl32
          IMPLICIT NONE  
          integer(HANDLE) hwndLV ! Handle of Listview     
          integer(UINT)   iIndex ! Index of the item, which should be checked on its checkstate 
        end function ListViewGetCheckState  
END INTERFACE [/fxfortran] The MSDN info of the macro says, that the macro is "stored" withinCommctrl.h...i guess this is comctl32, so i used it within the interface.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Compiling works, but during the linking of the programm, i get a fault, that there is a link to a non-external symbol called "
&lt;SPAN style="font-family: Ubuntu, UbuntuBeta;"&gt;ListView_GetCheckState@8"...copying the error code does not make sense, cause i am working with the german version of visual studio and i dont know, how many of you are speaking german ;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Ubuntu, UbuntuBeta;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;I do have a workaround, by using self made checkbox icons, and adding them as icon to the listview and implement a select/deselect method by myself...but thats the last option, cause i want to use the standard windows ones.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Does anyone have an idea, what i am making wrong, or a solution for my problem?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Best regards&lt;/DIV&gt;&lt;DIV&gt;Oliver&lt;/DIV&gt;</description>
    <pubDate>Wed, 14 Mar 2012 07:11:22 GMT</pubDate>
    <dc:creator>ratzeputz</dc:creator>
    <dc:date>2012-03-14T07:11:22Z</dc:date>
    <item>
      <title>Calling a WinAPI Macro problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-a-WinAPI-Macro-problem/m-p/791674#M33004</link>
      <description>Hi there.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I have a problem with a macro of the WinAPI.&lt;/DIV&gt;&lt;DIV&gt;In one of my ListViews, i have to use Checkboxes to select/deselect items for interacting with them in the next step.&lt;/DIV&gt;&lt;DIV&gt;For that, i set the style of the ListView by using SendMessage withLVM_SETEXTENDEDLISTVIEWSTYLE.&lt;/DIV&gt;&lt;DIV&gt;So far so good...works like a charm and the checkboxes too.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The main problem is, that i am not able to read out the states of the checkboxes.&lt;/DIV&gt;&lt;DIV&gt;What i found through MSDN searching is, that there seems to be only one possible way to find out the state ... using the ListView_GetCheckState macro.Sadly it seems not to be implemented withing the Fortran Compiler (vers. 11) so i decided to use an interface (which i did on TrayIcon Balloontips before and worked).&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;My Interface looks like this:&lt;BR /&gt;[fxfortran]INTERFACE   
        logical(BOOL) function ListViewGetCheckState(hwndLV, iIndex)
          !DEC$ ATTRIBUTES DEFAULT :: ListViewGetCheckState  
          !DEC$ ATTRIBUTES STDCALL, DECORATE :: ListViewGetCheckState  
          !DEC$ ATTRIBUTES ALIAS:'ListView_GetCheckState' :: ListViewGetCheckState   
          use comctl32
          IMPLICIT NONE  
          integer(HANDLE) hwndLV ! Handle of Listview     
          integer(UINT)   iIndex ! Index of the item, which should be checked on its checkstate 
        end function ListViewGetCheckState  
END INTERFACE [/fxfortran] The MSDN info of the macro says, that the macro is "stored" withinCommctrl.h...i guess this is comctl32, so i used it within the interface.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Compiling works, but during the linking of the programm, i get a fault, that there is a link to a non-external symbol called "
&lt;SPAN style="font-family: Ubuntu, UbuntuBeta;"&gt;ListView_GetCheckState@8"...copying the error code does not make sense, cause i am working with the german version of visual studio and i dont know, how many of you are speaking german ;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Ubuntu, UbuntuBeta;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;I do have a workaround, by using self made checkbox icons, and adding them as icon to the listview and implement a select/deselect method by myself...but thats the last option, cause i want to use the standard windows ones.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Does anyone have an idea, what i am making wrong, or a solution for my problem?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Best regards&lt;/DIV&gt;&lt;DIV&gt;Oliver&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Mar 2012 07:11:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-a-WinAPI-Macro-problem/m-p/791674#M33004</guid>
      <dc:creator>ratzeputz</dc:creator>
      <dc:date>2012-03-14T07:11:22Z</dc:date>
    </item>
    <item>
      <title>Calling a WinAPI Macro problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-a-WinAPI-Macro-problem/m-p/791675#M33005</link>
      <description>The name of the macro in the Windows API has a _ in between the ListView and the GetCheckState. That macro is defined in the C headers for the Window's API in terms of other API functions (have a look at the definition of the macro in the relevant header (commctrl.h) for the details). From the C language point of view it is just a simple text subsitution thing - consequently there is no symbol in a library to link to. &lt;BR /&gt;&lt;BR /&gt;You can replicate the macro with something like:&lt;BR /&gt;&lt;BR /&gt;[fortran]FUNCTION ListView_GetCheckState(hwndLV, i) RESULT(state)
  USE IFWIN
  IMPLICIT NONE
  INTEGER(HANDLE), INTENT(IN) :: hwndLV
  INTEGER(UINT), INTENT(IN) :: i
  INTEGER(BOOL) :: state
  !----
  INTEGER(LRESULT) :: rc
  !****
  rc = SendMessage(hwndLV, LVM_GETITEMSTATE, KIND(i,UINT_PTR), LVIS_STATEIMAGEMASK)
  state = ISHFT(rc, -12) - 1
END FUNCTION ListView_GetCheckState[/fortran] &lt;BR /&gt;Note that BOOL is an integer kind, not a logical kind.</description>
      <pubDate>Wed, 14 Mar 2012 11:23:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-a-WinAPI-Macro-problem/m-p/791675#M33005</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2012-03-14T11:23:20Z</dc:date>
    </item>
    <item>
      <title>Calling a WinAPI Macro problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-a-WinAPI-Macro-problem/m-p/791676#M33006</link>
      <description>Hi Ian and thx for your answer.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Well sadly i dont need a solution for that anymore :)&lt;/DIV&gt;&lt;DIV&gt;I made it the "went by foot" way by using a HookUp Process on the main window and listen for WM_NOTIFY messages. By pointing the lparam to a t_nmhdr struct and controlling its code attribute comparing toLVN_ITEMCHANGED, i can then point lparam to a t_nmlv struct and controlling their uOldState and uNewState values which are 4096 for unchecked and 8192 for checked.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;But your solution was not complete for nothing :)&lt;/DIV&gt;&lt;DIV&gt;Because i have to set checkbox states to checked or unchecked during dialog initialization, i can use you way for ListView_SetCheckState macro :)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;So in that case...many thanks again :)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Greetz&lt;/DIV&gt;&lt;DIV&gt;Oliver&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Mar 2012 11:58:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-a-WinAPI-Macro-problem/m-p/791676#M33006</guid>
      <dc:creator>ratzeputz</dc:creator>
      <dc:date>2012-03-14T11:58:49Z</dc:date>
    </item>
    <item>
      <title>Calling a WinAPI Macro problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-a-WinAPI-Macro-problem/m-p/791677#M33007</link>
      <description>The macro is declared in '&lt;STRONG&gt;commctrl.h&lt;/STRONG&gt;' header file and it is a part of a&lt;STRONG&gt;Platform SDK&lt;/STRONG&gt;. Since this is a macro&lt;BR /&gt;it is always used as &lt;STRONG&gt;inline&lt;/STRONG&gt; and never stored in any &lt;STRONG&gt;Win32&lt;/STRONG&gt; API library.&lt;BR /&gt;&lt;BR /&gt;This is howthe macrois declared:&lt;BR /&gt;&lt;BR /&gt; ...&lt;BR /&gt; #if (_WIN32_IE &amp;gt;= 0x0300)&lt;BR /&gt;&lt;BR /&gt; #define &lt;STRONG&gt;ListView_GetCheckState&lt;/STRONG&gt;(hwndLV, i) \&lt;BR /&gt;  ((((UINT)(SNDMSG((hwndLV), LVM_GETITEMSTATE, (WPARAM)(i), LVIS_STATEIMAGEMASK))) &amp;gt;&amp;gt; 12) -1)&lt;BR /&gt; #endif&lt;BR /&gt; ...&lt;BR /&gt;&lt;BR /&gt;I think a linkererror text has to be posted even if it is in German.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Sergey&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Mar 2012 02:12:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-a-WinAPI-Macro-problem/m-p/791677#M33007</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2012-03-16T02:12:01Z</dc:date>
    </item>
  </channel>
</rss>

