<?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 Using  DLL in MDI  project in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Using-DLL-in-MDI-project/m-p/857320#M2153</link>
    <description>&lt;P&gt;Iam using CVF to built an MDI project and I have a problem to call a Dialog Box written in a DLL wich is a subproject of the main project.&lt;/P&gt;
&lt;P&gt;The source code of the DLL called BurnersClass.dll is :&lt;/P&gt;
&lt;P&gt;integer*4 function ComponentBurner(BurnerTyp,GlobalIcon)&lt;/P&gt;
&lt;P&gt;!DEC$ ATTRIBUTES STDCALL, REFERENCE,ALIAS :"ComponentBurner":: ComponentBurner&lt;/P&gt;
&lt;P&gt;!DEC$ ATTRIBUTES DLLEXPORT::ComponentBurner&lt;/P&gt;
&lt;P&gt;include 'resource.fd'&lt;/P&gt;
&lt;P&gt;integer BurnerTyp&lt;/P&gt;
&lt;P&gt;integer GlobalIcon&lt;/P&gt;
&lt;P&gt;BurnerMenu%handle=CreateDialogParam(HandleAndInstance%ghInstance,IDD_Component_Tab, &amp;amp;&lt;/P&gt;
&lt;P&gt;  MDI_WINDOW_Current%Handle, loc(BurnerTab),0)     &lt;/P&gt;
&lt;P&gt;.......&lt;/P&gt;
&lt;P&gt;ComponentBurner=0&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;end function ComponentBurner&lt;/P&gt;
&lt;P&gt;!======================================================!&lt;/P&gt;
&lt;P&gt;integer*4 function BurnerTab( hDlg,message,uParam,lParam )&lt;/P&gt;
&lt;P&gt;!DEC$ ATTRIBUTES STDCALL, REFERENCE,ALIAS :"BurnerTab":: BurnerTab&lt;/P&gt;
&lt;P&gt;!DEC$ ATTRIBUTES DLLEXPORT::BurnerTab&lt;/P&gt;
&lt;P&gt;use user32&lt;/P&gt;
&lt;P&gt;use kernel32&lt;/P&gt;
&lt;P&gt;implicit none&lt;/P&gt;
&lt;P&gt;include "Resource.fd"&lt;/P&gt;
&lt;P&gt;integer hDlg&lt;/P&gt;
&lt;P&gt;integer message&lt;/P&gt;
&lt;P&gt;integer uparam,lparam &lt;/P&gt;
&lt;P&gt;type (T_NMHDR) itabmessage&lt;/P&gt;
&lt;P&gt;select case(message)&lt;/P&gt;
&lt;P&gt; case( WM_INITDIALOG)&lt;/P&gt;
&lt;P&gt; ....&lt;/P&gt;
&lt;P&gt;  BurnerTab=1&lt;/P&gt;
&lt;P&gt;  return&lt;/P&gt;
&lt;P&gt; case (WM_COMMAND)&lt;/P&gt;
&lt;P&gt; select case (LOWORD(uParam))&lt;/P&gt;
&lt;P&gt; case (IDOK,ID_ESCAPE)  &lt;/P&gt;
&lt;P&gt; ....     &lt;/P&gt;
&lt;P&gt;  end select&lt;/P&gt;
&lt;P&gt; case(WM_move) &lt;/P&gt;
&lt;P&gt; ....&lt;/P&gt;
&lt;P&gt; ....&lt;/P&gt;
&lt;P&gt; return         &lt;/P&gt;
&lt;P&gt;end select&lt;/P&gt;
&lt;P&gt;BurnerTab=0 &lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;end function BurnerTab&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The source code of the main program part that used this dll is :&lt;/P&gt;
&lt;P&gt;integer*4 function BurnersPreprocessing(BurnerTyp)&lt;/P&gt;
&lt;P&gt; !DEC$ IF DEFINED(_X86_)&lt;/P&gt;
&lt;P&gt; !DEC$ ATTRIBUTES STDcall, ALIAS : '_BurnersPreprocessing@16' :: BurnersPreprocessing&lt;/P&gt;
&lt;P&gt; !DEC$ ELSE&lt;/P&gt;
&lt;P&gt; !DEC$ ATTRIBUTES STDcall, ALIAS : 'BurnersPreprocessing' :: BurnersPreprocessing&lt;/P&gt;
&lt;P&gt; !DEC$ ENDIF&lt;/P&gt;
&lt;P&gt; use user32&lt;/P&gt;
&lt;P&gt; use kernel32&lt;/P&gt;
&lt;P&gt; use comctl32&lt;/P&gt;
&lt;P&gt; use DFWIN&lt;/P&gt;
&lt;P&gt; use THESSGlobals&lt;/P&gt;
&lt;P&gt; use HeatLibDrawingVar&lt;/P&gt;
&lt;P&gt; use MDI_WindowsVar&lt;/P&gt;
&lt;P&gt; use FuelClass&lt;/P&gt;
&lt;P&gt; implicit none&lt;/P&gt;
&lt;P&gt; include 'resource.fd'&lt;/P&gt;
&lt;P&gt; integer iret&lt;/P&gt;
&lt;P&gt; integer BurnerTyp&lt;/P&gt;
&lt;P&gt; logical bret&lt;/P&gt;
&lt;P&gt; integer(HANDLE) dll_handle(2)&lt;/P&gt;
&lt;P&gt; integer(BOOL) free_status&lt;/P&gt;
&lt;P&gt; pointer(p_ComponentBurner, ComponentBurner)&lt;/P&gt;
&lt;P&gt; interface&lt;/P&gt;
&lt;P&gt; integer*4 function ComponentBurner(BurnerTyp,GlobalIcon)&lt;/P&gt;
&lt;P&gt; !DEC$ ATTRIBUTES DLLIMPORT::ComponentBurner&lt;/P&gt;
&lt;P&gt; integer BurnerTyp&lt;/P&gt;
&lt;P&gt; integer GlobalIcon &lt;/P&gt;
&lt;P&gt; end function ComponentBurner&lt;/P&gt;
&lt;P&gt; end interface&lt;/P&gt;
&lt;P&gt; dll_handle(1) = LoadLibrary ("BurnersClass.dll"C)&lt;/P&gt;
&lt;P&gt; if (dll_handle(1) == NULL) then&lt;/P&gt;
&lt;P&gt; ! Failure&lt;/P&gt;
&lt;P&gt; stop&lt;/P&gt;
&lt;P&gt; end if&lt;/P&gt;
&lt;P&gt; p_ComponentBurner = GetProcAddress (dll_handle(1), "ComponentBurner"C)&lt;/P&gt;
&lt;P&gt; if (p_ComponentBurner == NULL) then&lt;/P&gt;
&lt;P&gt; ! Failure&lt;/P&gt;
&lt;P&gt; stop&lt;/P&gt;
&lt;P&gt; end if  &lt;/P&gt;
&lt;P&gt; iret = ComponentBurner(BurnerTyp,GlobalIcon,IDD_component_tab)&lt;/P&gt;
&lt;P&gt; BurnersPreprocessing=0&lt;/P&gt;
&lt;P&gt; return&lt;/P&gt;
&lt;P&gt;end function BurnersPreprocessing&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;When I debug the main program and I execute the line code :&lt;/P&gt;
&lt;P&gt;BurnerMenu%handle=CreateDialogParam(HandleAndInstance%ghInstance,IDD_Component_Tab, &amp;amp;&lt;/P&gt;
&lt;P&gt;  MDI_WINDOW_Current%Handle, loc(BurnerTab),0)&lt;/P&gt;
&lt;P&gt;I receive the message : Unhandelded exception in Main.exe (called BurnersClass.dll):0x000005:Acces Violation.&lt;/P&gt;
&lt;P&gt;And inside the DLL when I check the values of the function BurnerTab arguments : hDlg message, uParam, lParam I obtains :&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;hDlg = Undefined Adress&lt;/P&gt;
&lt;P&gt;message = Undefined Adress&lt;/P&gt;
&lt;P&gt;uParam = Undefined Adress&lt;/P&gt;
&lt;P&gt;lParam = Undefined Adress&lt;/P&gt;
&lt;P&gt;If you have a solution, or a simple example of using DLL with MDI project send it me&lt;/P&gt;
&lt;P&gt;thanks in advance&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 25 Jan 2009 14:51:40 GMT</pubDate>
    <dc:creator>moncef</dc:creator>
    <dc:date>2009-01-25T14:51:40Z</dc:date>
    <item>
      <title>Using  DLL in MDI  project</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Using-DLL-in-MDI-project/m-p/857320#M2153</link>
      <description>&lt;P&gt;Iam using CVF to built an MDI project and I have a problem to call a Dialog Box written in a DLL wich is a subproject of the main project.&lt;/P&gt;
&lt;P&gt;The source code of the DLL called BurnersClass.dll is :&lt;/P&gt;
&lt;P&gt;integer*4 function ComponentBurner(BurnerTyp,GlobalIcon)&lt;/P&gt;
&lt;P&gt;!DEC$ ATTRIBUTES STDCALL, REFERENCE,ALIAS :"ComponentBurner":: ComponentBurner&lt;/P&gt;
&lt;P&gt;!DEC$ ATTRIBUTES DLLEXPORT::ComponentBurner&lt;/P&gt;
&lt;P&gt;include 'resource.fd'&lt;/P&gt;
&lt;P&gt;integer BurnerTyp&lt;/P&gt;
&lt;P&gt;integer GlobalIcon&lt;/P&gt;
&lt;P&gt;BurnerMenu%handle=CreateDialogParam(HandleAndInstance%ghInstance,IDD_Component_Tab, &amp;amp;&lt;/P&gt;
&lt;P&gt;  MDI_WINDOW_Current%Handle, loc(BurnerTab),0)     &lt;/P&gt;
&lt;P&gt;.......&lt;/P&gt;
&lt;P&gt;ComponentBurner=0&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;end function ComponentBurner&lt;/P&gt;
&lt;P&gt;!======================================================!&lt;/P&gt;
&lt;P&gt;integer*4 function BurnerTab( hDlg,message,uParam,lParam )&lt;/P&gt;
&lt;P&gt;!DEC$ ATTRIBUTES STDCALL, REFERENCE,ALIAS :"BurnerTab":: BurnerTab&lt;/P&gt;
&lt;P&gt;!DEC$ ATTRIBUTES DLLEXPORT::BurnerTab&lt;/P&gt;
&lt;P&gt;use user32&lt;/P&gt;
&lt;P&gt;use kernel32&lt;/P&gt;
&lt;P&gt;implicit none&lt;/P&gt;
&lt;P&gt;include "Resource.fd"&lt;/P&gt;
&lt;P&gt;integer hDlg&lt;/P&gt;
&lt;P&gt;integer message&lt;/P&gt;
&lt;P&gt;integer uparam,lparam &lt;/P&gt;
&lt;P&gt;type (T_NMHDR) itabmessage&lt;/P&gt;
&lt;P&gt;select case(message)&lt;/P&gt;
&lt;P&gt; case( WM_INITDIALOG)&lt;/P&gt;
&lt;P&gt; ....&lt;/P&gt;
&lt;P&gt;  BurnerTab=1&lt;/P&gt;
&lt;P&gt;  return&lt;/P&gt;
&lt;P&gt; case (WM_COMMAND)&lt;/P&gt;
&lt;P&gt; select case (LOWORD(uParam))&lt;/P&gt;
&lt;P&gt; case (IDOK,ID_ESCAPE)  &lt;/P&gt;
&lt;P&gt; ....     &lt;/P&gt;
&lt;P&gt;  end select&lt;/P&gt;
&lt;P&gt; case(WM_move) &lt;/P&gt;
&lt;P&gt; ....&lt;/P&gt;
&lt;P&gt; ....&lt;/P&gt;
&lt;P&gt; return         &lt;/P&gt;
&lt;P&gt;end select&lt;/P&gt;
&lt;P&gt;BurnerTab=0 &lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;end function BurnerTab&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The source code of the main program part that used this dll is :&lt;/P&gt;
&lt;P&gt;integer*4 function BurnersPreprocessing(BurnerTyp)&lt;/P&gt;
&lt;P&gt; !DEC$ IF DEFINED(_X86_)&lt;/P&gt;
&lt;P&gt; !DEC$ ATTRIBUTES STDcall, ALIAS : '_BurnersPreprocessing@16' :: BurnersPreprocessing&lt;/P&gt;
&lt;P&gt; !DEC$ ELSE&lt;/P&gt;
&lt;P&gt; !DEC$ ATTRIBUTES STDcall, ALIAS : 'BurnersPreprocessing' :: BurnersPreprocessing&lt;/P&gt;
&lt;P&gt; !DEC$ ENDIF&lt;/P&gt;
&lt;P&gt; use user32&lt;/P&gt;
&lt;P&gt; use kernel32&lt;/P&gt;
&lt;P&gt; use comctl32&lt;/P&gt;
&lt;P&gt; use DFWIN&lt;/P&gt;
&lt;P&gt; use THESSGlobals&lt;/P&gt;
&lt;P&gt; use HeatLibDrawingVar&lt;/P&gt;
&lt;P&gt; use MDI_WindowsVar&lt;/P&gt;
&lt;P&gt; use FuelClass&lt;/P&gt;
&lt;P&gt; implicit none&lt;/P&gt;
&lt;P&gt; include 'resource.fd'&lt;/P&gt;
&lt;P&gt; integer iret&lt;/P&gt;
&lt;P&gt; integer BurnerTyp&lt;/P&gt;
&lt;P&gt; logical bret&lt;/P&gt;
&lt;P&gt; integer(HANDLE) dll_handle(2)&lt;/P&gt;
&lt;P&gt; integer(BOOL) free_status&lt;/P&gt;
&lt;P&gt; pointer(p_ComponentBurner, ComponentBurner)&lt;/P&gt;
&lt;P&gt; interface&lt;/P&gt;
&lt;P&gt; integer*4 function ComponentBurner(BurnerTyp,GlobalIcon)&lt;/P&gt;
&lt;P&gt; !DEC$ ATTRIBUTES DLLIMPORT::ComponentBurner&lt;/P&gt;
&lt;P&gt; integer BurnerTyp&lt;/P&gt;
&lt;P&gt; integer GlobalIcon &lt;/P&gt;
&lt;P&gt; end function ComponentBurner&lt;/P&gt;
&lt;P&gt; end interface&lt;/P&gt;
&lt;P&gt; dll_handle(1) = LoadLibrary ("BurnersClass.dll"C)&lt;/P&gt;
&lt;P&gt; if (dll_handle(1) == NULL) then&lt;/P&gt;
&lt;P&gt; ! Failure&lt;/P&gt;
&lt;P&gt; stop&lt;/P&gt;
&lt;P&gt; end if&lt;/P&gt;
&lt;P&gt; p_ComponentBurner = GetProcAddress (dll_handle(1), "ComponentBurner"C)&lt;/P&gt;
&lt;P&gt; if (p_ComponentBurner == NULL) then&lt;/P&gt;
&lt;P&gt; ! Failure&lt;/P&gt;
&lt;P&gt; stop&lt;/P&gt;
&lt;P&gt; end if  &lt;/P&gt;
&lt;P&gt; iret = ComponentBurner(BurnerTyp,GlobalIcon,IDD_component_tab)&lt;/P&gt;
&lt;P&gt; BurnersPreprocessing=0&lt;/P&gt;
&lt;P&gt; return&lt;/P&gt;
&lt;P&gt;end function BurnersPreprocessing&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;When I debug the main program and I execute the line code :&lt;/P&gt;
&lt;P&gt;BurnerMenu%handle=CreateDialogParam(HandleAndInstance%ghInstance,IDD_Component_Tab, &amp;amp;&lt;/P&gt;
&lt;P&gt;  MDI_WINDOW_Current%Handle, loc(BurnerTab),0)&lt;/P&gt;
&lt;P&gt;I receive the message : Unhandelded exception in Main.exe (called BurnersClass.dll):0x000005:Acces Violation.&lt;/P&gt;
&lt;P&gt;And inside the DLL when I check the values of the function BurnerTab arguments : hDlg message, uParam, lParam I obtains :&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;hDlg = Undefined Adress&lt;/P&gt;
&lt;P&gt;message = Undefined Adress&lt;/P&gt;
&lt;P&gt;uParam = Undefined Adress&lt;/P&gt;
&lt;P&gt;lParam = Undefined Adress&lt;/P&gt;
&lt;P&gt;If you have a solution, or a simple example of using DLL with MDI project send it me&lt;/P&gt;
&lt;P&gt;thanks in advance&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jan 2009 14:51:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Using-DLL-in-MDI-project/m-p/857320#M2153</guid>
      <dc:creator>moncef</dc:creator>
      <dc:date>2009-01-25T14:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using  DLL in MDI  project</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Using-DLL-in-MDI-project/m-p/857321#M2154</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
This would be topical only on the Windows Fortran forum.&lt;BR /&gt;</description>
      <pubDate>Sun, 25 Jan 2009 16:00:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Using-DLL-in-MDI-project/m-p/857321#M2154</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2009-01-25T16:00:21Z</dc:date>
    </item>
  </channel>
</rss>

