<?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 Win32 Subclassing with CVF in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843031#M61000</link>
    <description>I need to subclass a window in a different process.  Evidently, the way to do this is to inject my DLL via a hook into the target process' address space.  For this to work, my DLL needs to be able to pass a few data values (the hook and target window handles) between the source and target process' address spaces. &lt;BR /&gt;&lt;BR /&gt;There is a fair amount of chat (MSDN, Richter, etc.) on how to do this in C, which apparently allows linker directives to be imbedded directly into the source code to create a named data segment for any variable, which can then be given the "/section:myseg,RWS" link attribute, so data in that segment will be identically available (shared) among all process instances of the DLL.&lt;BR /&gt;&lt;BR /&gt;Can this be done in F90?  I cannot find any means within DevStudio to name data segments and set their sharing attributes, and the CVF documentation doesn't address this issue.  Alternatively, if anyone can provide a working example of DLL injection which solves this problem in some other way, that would be greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;TIA,&lt;BR /&gt;Paul Curtis, pcurtis@kiltel.com&lt;BR /&gt;</description>
    <pubDate>Wed, 10 Jul 2002 22:17:32 GMT</pubDate>
    <dc:creator>pcurtis</dc:creator>
    <dc:date>2002-07-10T22:17:32Z</dc:date>
    <item>
      <title>Win32 Subclassing with CVF</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843031#M61000</link>
      <description>I need to subclass a window in a different process.  Evidently, the way to do this is to inject my DLL via a hook into the target process' address space.  For this to work, my DLL needs to be able to pass a few data values (the hook and target window handles) between the source and target process' address spaces. &lt;BR /&gt;&lt;BR /&gt;There is a fair amount of chat (MSDN, Richter, etc.) on how to do this in C, which apparently allows linker directives to be imbedded directly into the source code to create a named data segment for any variable, which can then be given the "/section:myseg,RWS" link attribute, so data in that segment will be identically available (shared) among all process instances of the DLL.&lt;BR /&gt;&lt;BR /&gt;Can this be done in F90?  I cannot find any means within DevStudio to name data segments and set their sharing attributes, and the CVF documentation doesn't address this issue.  Alternatively, if anyone can provide a working example of DLL injection which solves this problem in some other way, that would be greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;TIA,&lt;BR /&gt;Paul Curtis, pcurtis@kiltel.com&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Jul 2002 22:17:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843031#M61000</guid>
      <dc:creator>pcurtis</dc:creator>
      <dc:date>2002-07-10T22:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 Subclassing with CVF</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843032#M61001</link>
      <description>I know you can specify /section by just typing it in on the Link settings page.  I don't know offhand how you would create your own section.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Wed, 10 Jul 2002 22:59:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843032#M61001</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2002-07-10T22:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 Subclassing with CVF</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843033#M61002</link>
      <description>I've only read about this dll injection business but I have no direct experience in doing it.&lt;BR /&gt;&lt;BR /&gt;Search for /SECTION in the VC++ docs to find out how to set the attributes of a section, including 'sharing' with the target process(es).</description>
      <pubDate>Thu, 11 Jul 2002 07:29:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843033#M61002</guid>
      <dc:creator>gfthomas8</dc:creator>
      <dc:date>2002-07-11T07:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 Subclassing with CVF</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843034#M61003</link>
      <description>I know about global hooking technique only in general; I've never used it myself. Perhaps the attached file could help establish a global memory segment (via MapViewOfFile). Disclaimer: I didn't use it and I forgot where I downloaded it from (probably &lt;A href="https://community.intel.com/www.fortranlib.com)" target="_blank"&gt;www.fortranlib.com)&lt;/A&gt;. On a quick glance, you should create your own DllEntryPoint:&lt;BR /&gt;[/pre]&lt;BR /&gt;INTEGER FUNCTION DllEntryPoint(hModule, fdwReason, lpvReserved)&lt;BR /&gt;!DEC$ATTRIBUTES STDCALL::  DllEntryPoint&lt;BR /&gt;USE DFWIN&lt;BR /&gt;&lt;BR /&gt;IMPLICIT NONE&lt;BR /&gt;&lt;BR /&gt;INTEGER::   hModule, fdwReason, lpvReserved&lt;BR /&gt;&lt;BR /&gt;SELECT CASE (fdwReason)&lt;BR /&gt;CASE(DLL_PROCESS_ATTACH)&lt;BR /&gt;      DllEntryPoint=1&lt;BR /&gt;CASE DEFAULT&lt;BR /&gt;      DllEntryPoint=1&lt;BR /&gt;END SELECT      &lt;BR /&gt;&lt;BR /&gt;END FUNCTION DllEntryPoint[/pre]&lt;BR /&gt;On DLL_PROCESS_ATTACH, try to OpenShareBuffer, and if it fails CreateShareBuffer. Use cray pointers to read from *bufferAddress. Of course, bufferAddress must be global to DllEntryPoint and hook routine.&lt;BR /&gt;HTH&lt;BR /&gt;Jugoslav&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Jul 2002 16:43:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843034#M61003</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2002-07-11T16:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 Subclassing with CVF</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843035#M61004</link>
      <description>Thanks for the replies. However... DLL injection is evidently too complicated and I needed a quick fix, so I dropped back &amp;amp; punted.&lt;BR /&gt;&lt;BR /&gt;The original goal was to subclass the other (child) process, launched from my main thread, to trap SC_MINIMIZE messages and prevent its being minimized (my app gets rid of the taskbar, start button, etc.).  The other process is typically Notepad, Excel or Paint.&lt;BR /&gt;&lt;BR /&gt;Here is a poor-man's method of doing the same thing; it works fine, but lacks elegance:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TYPE(T_WINDOWPLACEMENT)   :: wp&lt;BR /&gt;INTEGER                               :: rval&lt;BR /&gt;&lt;BR /&gt;IF (IsWindow(hwnd_ChildProcess) /= 0) THEN&lt;BR /&gt;	wp%length = SIZEOF(wp)&lt;BR /&gt;	rval = GetWindowPlacement (hwnd_ChildProcess, wp)&lt;BR /&gt;	IF (wp%showCmd == SW_SHOWMINIMIZED) THEN&lt;BR /&gt;		wp%showCmd = SW_SHOWNORMAL&lt;BR /&gt;		rval = SetWindowPlacement (hwnd_ChildProcess, wp)&lt;BR /&gt;		CALL SetFocus (hwnd_ChildProcess)&lt;BR /&gt;	END IF&lt;BR /&gt;END IF&lt;BR /&gt;</description>
      <pubDate>Sun, 14 Jul 2002 01:01:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843035#M61004</guid>
      <dc:creator>pcurtis</dc:creator>
      <dc:date>2002-07-14T01:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 Subclassing with CVF</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843036#M61005</link>
      <description>Now I see what you were doing. You don't need to subclass for this. If I want the character map, say, to be always available and not minimized I do:&lt;BR /&gt;&lt;BR /&gt;integer id !global&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;! poll Windows for the app; if it's not running, start it, and if it is, restore it&lt;BR /&gt;&lt;BR /&gt;use ... !whatever api mods required&lt;BR /&gt;type(T_STARTUPINFO) StartInfo&lt;BR /&gt;type(T_PROCESS_INFORMATION) ProcessInfo&lt;BR /&gt;integer r&lt;BR /&gt;...&lt;BR /&gt;If (FindWindow(NULL, "Unicode Character Map") /= 0) then&lt;BR /&gt;	StartInfo%wShowWindow = SW_NORMAL&lt;BR /&gt;	StartInfo%cb = len(StartInfo)&lt;BR /&gt;	r = CreateProcess(NULL, "charmap.exe"C, 0, 0, 0, 0, CREATE_SEPARATE_WOW_VDM, NULL, StartInfo, ProcessInfo)&lt;BR /&gt;	Sleep(500)&lt;BR /&gt;	id = ProcessInfo%hProcess&lt;BR /&gt;        r = CloseHandle(ProcessInfo%hThread)&lt;BR /&gt;Else&lt;BR /&gt;        r = ShowWindow(FindWindow(NULL, "Unicode Character Map"), SW_RESTORE)&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;... &lt;BR /&gt;!Do cleanup&lt;BR /&gt;integer r&lt;BR /&gt;use ... !whatever api mods required&lt;BR /&gt;If id &amp;gt; 0 Then&lt;BR /&gt;     r = TerminateProcess(id, 0)&lt;BR /&gt;     r = CloseHandle(id)&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;The user is free to minimize or close the app and you respond by opening it up again. In the case of Excel, etc. they could loose data but the app will let them know and they'll soon get the message.&lt;BR /&gt;&lt;BR /&gt;This is similar to what you've been doing. I don't consider it inelegant.</description>
      <pubDate>Sun, 14 Jul 2002 08:19:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843036#M61005</guid>
      <dc:creator>gfthomas8</dc:creator>
      <dc:date>2002-07-14T08:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 Subclassing with CVF</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843037#M61006</link>
      <description>Maybe changing Excel's window styles (remove WS_MINIMIZEBUTTON &amp;amp; WS_THICKFRAME, add possibly WS_DLGFRAME) could be a more ellegant solution?</description>
      <pubDate>Mon, 15 Jul 2002 16:28:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-Subclassing-with-CVF/m-p/843037#M61006</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2002-07-15T16:28:06Z</dc:date>
    </item>
  </channel>
</rss>

