<?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 Re: How to get hWnd to my arx application in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852057#M22247</link>
    <description>That is a window handle -- it doesn't belong to an "application" per se. &lt;BR /&gt;
Does your application create any windows?  If yes, how does it create the &lt;BR /&gt;
window?&lt;BR /&gt;
-- &lt;BR /&gt;
Owen Wengerd&lt;BR /&gt;
President, ManuSoft ==&amp;gt; http://www.manusoft.com&lt;BR /&gt;
VP Americas, CADLock, Inc. ==&amp;gt; http://www.cadlock.com</description>
    <pubDate>Sun, 31 Dec 2006 12:30:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-12-31T12:30:05Z</dc:date>
    <item>
      <title>How to get hWnd to my arx application</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852056#M22246</link>
      <description>To use GetWindowPlacement I need the handle to my arx application as the first parameter. But how do get that one?&lt;BR /&gt;
&lt;BR /&gt;
To get the handle to AutoCad I use:&lt;BR /&gt;
acedGetAcadFrame()-&amp;gt;m_hWnd&lt;BR /&gt;
I need something similiar</description>
      <pubDate>Sun, 31 Dec 2006 12:01:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852056#M22246</guid>
      <dc:creator>hericson</dc:creator>
      <dc:date>2006-12-31T12:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get hWnd to my arx application</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852057#M22247</link>
      <description>That is a window handle -- it doesn't belong to an "application" per se. &lt;BR /&gt;
Does your application create any windows?  If yes, how does it create the &lt;BR /&gt;
window?&lt;BR /&gt;
-- &lt;BR /&gt;
Owen Wengerd&lt;BR /&gt;
President, ManuSoft ==&amp;gt; http://www.manusoft.com&lt;BR /&gt;
VP Americas, CADLock, Inc. ==&amp;gt; http://www.cadlock.com</description>
      <pubDate>Sun, 31 Dec 2006 12:30:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852057#M22247</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-31T12:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get hWnd to my arx application</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852058#M22248</link>
      <description>somewhere in acrxEntryPoint.cpp I have these lines:&lt;BR /&gt;
&lt;BR /&gt;
if( modelessMainDialog ) &lt;BR /&gt;
      {&lt;BR /&gt;
   // dialog was already created, just display it&lt;BR /&gt;
   // (the dialog only gets deallocated when the arx is unloaded)&lt;BR /&gt;
     modelessMainDialog-&amp;gt;ShowWindow( SW_SHOWNORMAL );&lt;BR /&gt;
   return;&lt;BR /&gt;
  }&lt;BR /&gt;
&lt;BR /&gt;
   if( !modelessMainDialog &amp;amp;&amp;amp; !startMainDialog() ) &lt;BR /&gt;
      {&lt;BR /&gt;
         ads_printf( _T("HEProfil: Failed to create modeless main dialog box.\n") );&lt;BR /&gt;
   }&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
modelessMainDialog is first defined as (also in acrxEntryPoint.cpp)&lt;BR /&gt;
// the following global will point to our modeless main dialog&lt;BR /&gt;
CDialog_Main* modelessMainDialog = NULL; // MDI Safe&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
the function startMainDialog is also defined in acrxEntryPoint&lt;BR /&gt;
Adesk::Boolean startMainDialog()&lt;BR /&gt;
{&lt;BR /&gt;
	CAcModuleResourceOverride resOverride;&lt;BR /&gt;
	HWND hwndAcad = adsw_acadMainWnd();&lt;BR /&gt;
&lt;BR /&gt;
	if ( !hwndAcad ) &lt;BR /&gt;
   {&lt;BR /&gt;
      AfxMessageBox( _T("HEProfil: Unable to locate AutoCAD parent window.") );&lt;BR /&gt;
		return Adesk::kFalse;&lt;BR /&gt;
	}&lt;BR /&gt;
&lt;BR /&gt;
	CWnd *pWnd = CWnd::FromHandle ( hwndAcad );&lt;BR /&gt;
	if( modelessMainDialog == NULL ) &lt;BR /&gt;
   {&lt;BR /&gt;
		if ( (modelessMainDialog = new CDialog_Main ( pWnd )) == NULL ) &lt;BR /&gt;
      {&lt;BR /&gt;
         AfxMessageBox ( _T("HEProfil: Unable to allocate a CDialog_Main.") );&lt;BR /&gt;
			return Adesk::kFalse;&lt;BR /&gt;
		}&lt;BR /&gt;
&lt;BR /&gt;
		BOOL succeeded = modelessMainDialog-&amp;gt;Create ( pWnd );&lt;BR /&gt;
		if ( !succeeded ) &lt;BR /&gt;
      {&lt;BR /&gt;
         AfxMessageBox ( _T("HEProfil: Unable to create the main dialog.") );&lt;BR /&gt;
			return Adesk::kFalse;&lt;BR /&gt;
		}&lt;BR /&gt;
	}&lt;BR /&gt;
	modelessMainDialog-&amp;gt;ShowWindow(SW_SHOWNORMAL);&lt;BR /&gt;
&lt;BR /&gt;
	return Adesk::kTrue;&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The GetWindowPlacement call is in the Dialog_Main.cpp file</description>
      <pubDate>Sun, 31 Dec 2006 12:53:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852058#M22248</guid>
      <dc:creator>hericson</dc:creator>
      <dc:date>2006-12-31T12:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to get hWnd to my arx application</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852059#M22249</link>
      <description>If i run GetWindowPlacement in the BOOL CDialog_Main::OnInitDialog() function or any other function that belongs to my CDialog_Main, it only takes one parameter like GetWindowPlacement(&amp;amp;WP); and it works.</description>
      <pubDate>Sun, 31 Dec 2006 13:08:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852059#M22249</guid>
      <dc:creator>hericson</dc:creator>
      <dc:date>2006-12-31T13:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to get hWnd to my arx application</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852060#M22250</link>
      <description>Your CDialog_Main is derived from CWnd, which has a member m_hWnd that &lt;BR /&gt;
stores the window handle.  You can use it directly, or just call the CDialog &lt;BR /&gt;
member functions. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
-- &lt;BR /&gt;
Owen Wengerd&lt;BR /&gt;
President, ManuSoft ==&amp;gt; http://www.manusoft.com&lt;BR /&gt;
VP Americas, CADLock, Inc. ==&amp;gt; http://www.cadlock.com</description>
      <pubDate>Sun, 31 Dec 2006 17:50:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-get-hwnd-to-my-arx-application/m-p/1852060#M22250</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-12-31T17:50:47Z</dc:date>
    </item>
  </channel>
</rss>

