请救救小弟!!!

andykwok 2002-11-13 01:59:07
======================================
前言
======================================
小弟在搞Solidworks的二次开发,但由于VC++对数据库方面的支持不及DELPHI,所以
我把Solidworks的API封装成Delphi的XXX_TLB.PAS,一切都好象和C++一样的能实现对
Solidworks的二次开发,但小弟还有一个技术没有掌握。
如果谁帮小弟解决这以下的问题,我将会把我对Solidworks封装的源码公开:)这应该能
给Solidworks二次开发人员一些帮助吧。:)
======================================
问题:
======================================
在Solidworks的API中有一个函数FeatMgrView::GetFeatMgrViewWnd,它能近回一个CWND HANDLE。
请问我如何才能把Delphi开发的FORM放置到它(CWND HANDLE)上呢。
======================================
函数的说明(英文)
======================================
Description
This method will get the FeatureManager design tree window handle as a CWnd object. You may use this CWnd in combination with standard MFC calls to draw into this view as desired.
Syntax (OLE Automation)
retval = FeatMgrView.GetFeatMgrViewWnd ()
Return:
(long) retval
The CWnd handle of the FeatureManager design tree view
Syntax (COM)
status = FeatMgrView->GetFeatMgrViewWnd ( &retval )
Output:
(long) retval
The CWnd handle of the FeatureManager design tree view
Return:
(HRESULT)status
S_OK if successful
Remarks
You should make this call when the FeatureManager design tree view is created with ModelDoc::CreateFeatureMgrView. This method is not needed with ModelDoc::AddFeatureMgrView since you created the view and would, therefore, already have its handle.

...全文
83 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
bear_c 2002-11-26
  • 打赏
  • 举报
回复
用API设置父窗口:
HWND SetParent(HWND hWndChild,HWND hWndNewParent);
silverwonder 2002-11-16
  • 打赏
  • 举报
回复
up
甜在心馒头 2002-11-15
  • 打赏
  • 举报
回复
晕,看不懂:~(
andykwok 2002-11-15
  • 打赏
  • 举报
回复
ICreateFeatureMgrView3 是建立一个FeatureManager 设计页,
GetFeatMgrViewWnd是取得刚才新建的设计页的窗口句柄。
andykwok 2002-11-15
  • 打赏
  • 举报
回复
这是CFMView的.H
// -------------------------------------------------------------------
//
// Filename: RootFeatureManagerView.h
// Description: Defines the CFMView, CFMTreeCtrl, and
// FMFeatureManagerEvents classes that
// are implemented to generate FeatureMgrViews
//
// -------------------------------------------------------------------
#include "ccitem.h"

// Call this function whenever a new window is created to add
// our custom TAB to the Feature Manager View
extern void CreateFeatureManagerView();
extern void TraverseAssemblyComponent01();

// --------------------------------
// CLASS DEFINITIONS
// --------------------------------

// Forward definitions
class CFMView; // The class that controls our Feature Manager Tab
class CFMTreeCtrl; // SubClass of CTreeCtrl for the Tree Control
class FMFeatureManagerEvents; // Handles Feature Manager Notifications

// --------------------------------
// SubClass the CTreeCtrl so that we can find when the user is starting to
// do a Label Edit operation and set the focus.
// --------------------------------

// Class definition
class CFMTreeCtrl : public CTreeCtrl
{
LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam );
};

// --------------------------------
// Class CFMView
// Manage creation/destruction and activation of the Feature Manager View
// Also gets the TVN_ENDLABELEDIT when the user finishes editing a label
// in the tree control.
// --------------------------------
class CFMView : public CWnd
{
public:
BOOL Create();
private:
BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
protected:
BOOL OnDestroyNotify(bool bDeleteNotificationObject);

// Data
public:
CFMTreeCtrl m_TreeCtrl; // The actual Tree control
private:
CWnd *m_pParent; // Parent View of our window
CBitmap m_Bitmap; // Holds the image in the SolidWorks Tab
FMFeatureManagerEvents* m_pEventHandler;// Receives notifications from SolidWorks

friend class FMFeatureManagerEvents;


afx_msg void OnPaint();

DECLARE_MESSAGE_MAP()



};

// --------------------------------
// Class to handle notifications from SolidWorks for the Feature Manager View
// --------------------------------

class FMFeatureManagerEvents : public CControlItem
{
public:
~FMFeatureManagerEvents();
DECLARE_EVENTSINK_MAP()

// ole event handlers
HRESULT ActivateNotify(VARIANT* View);
HRESULT DeactivateNotify(VARIANT* View);
HRESULT DestroyNotify(VARIANT* view);

// Data
protected:
CFMView *m_pFMView;

friend class CFMView;
};
andykwok 2002-11-15
  • 打赏
  • 举报
回复
BOOL CFMView::Create()
{
LPMODELDOC2 pModelDoc;
LPFEATMGRVIEW pFeatMgr;
CRect rect;

// Get the active doc and create a feature manager view in it
if (TheApplication->GetSWApp()->get_IActiveDoc2( &pModelDoc ) == S_OK)
{
TheApplication->SetResources(); // Ensure we are using our resources
//m_Bitmap.LoadMappedBitmap(IDB_BITMAP1);
m_Bitmap.LoadMappedBitmap(IDB_BITMAP1, 0, NULL);
TheApplication->ResetResources(); // Reset to SolidWorks resources
if (pModelDoc->ICreateFeatureMgrView3 ((long *)&m_Bitmap, auT("自定义FeatureManager"), swFeatMgrPaneBottom, &pFeatMgr) == S_OK)
{
if ( pFeatMgr == NULL )
{
AfxMessageBox(_T("ICreateFeatureMgrView returned S_OK and NULL pointer"));
}
else
{
// Create a control item to handle events for the PartDoc
m_pEventHandler = new FMFeatureManagerEvents;
m_pEventHandler->OnCreate(pFeatMgr);
m_pEventHandler->m_pFMView = this;

// Create a window in the Feature Manager window
pFeatMgr->GetFeatMgrViewWnd((long*)&m_pParent);
m_pParent->GetClientRect (&rect);

CWnd::Create (NULL, TEXT(""), WS_CHILD | WS_VISIBLE, rect, m_pParent, 1);

// Create the Tree Control in our new window
m_TreeCtrl.Create (TVS_HASLINES | TVS_HASBUTTONS | TVS_EDITLABELS, rect, this, 1);
// Display the windows
ShowWindow (SW_SHOW);
MoveWindow (&rect);
m_TreeCtrl.ShowWindow (SW_SHOW);
m_TreeCtrl.MoveWindow (&rect);
pFeatMgr->Release();
}
}
pModelDoc->Release();
}

return true;
}
tonnyue 2002-11-15
  • 打赏
  • 举报
回复
sorry
hfycl 2002-11-14
  • 打赏
  • 举报
回复
up
newyj 2002-11-14
  • 打赏
  • 举报
回复
你把 c的源码贴出来参考一下

16,747

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧