YouTube | Facebook | X(Twitter) | RSS

コマンドから表示するフォームをアプリケーションの最上位に設定する方法

2016/9/1 (木)

Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
Public Declare Function GetParent Lib "user32" (ByVal hWnd As Integer) As Integer
Public Const GWL_HWNDPARENT = -8
 
'ArcMapの最上位にフォームを表示してタスクバー切り替えをArcMapに追従
Sub ShowWindowOnTopOfArcMap()
    Dim pApplication As IApplication
    Set pApplication = m_hook
     
    '特定のウィンドウハンドルの親ウィンドウハンドルを取得(Engineの場合)
    Dim pToolbarControl As IToolbarControl
    Set pToolbarControl = m_hookHelper.hook
     
    Dim intParent As Integer
    intParent = GetParent(pToolbarControl.hWnd)
     
    '親フォームのウィンドウハンドルと関連付け
    Dim intOriginal As Integer
    intOriginal = SetWindowLong(OriginalForm.hWnd, GWL_HWNDPARENT, pApplication.hWnd)
    OriginalForm.Show
     
'    '元のウィンドウハンドルを返す場合
'    SetWindowLong OriginalForm.hWnd, GWL_HWNDPARENT, intOriginal
 
End Sub
 
 
'Dim pGeometricNetwork As IGeometricNetwork
'Set pGeometricNetwork = pNetworkAnalysisExt.CurrentNetwork
 
'Dim pNetwork As INetwork
'Set pNetwork = pGeometricNetwork.Network
'
'Dim pNetElements As INetElements
'Set pNetElements = pNetwork
'
'
'Dim UserClassID As Long
'Dim UserID As Long
'Dim UserSubID As Long
'
'pNetElements.QueryIDs 0, esriETNone, UserClassID, UserID, UserSubID
'
'Debug.Print UserClassID, UserID, UserSubID

関連記事

  • この記事を書いた人

羽田 康祐

伊達と酔狂のGISエンジニア。GIS上級技術者、Esri認定インストラクター、CompTIA CTT+ Classroom Trainer、潜水士、PADIダイブマスター、四アマ。WordPress は 2.1 からのユーザーで歴だけは長い。 代表著書『地図リテラシー入門―地図の正しい読み方・描き方がわかる』 GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、元青山学院大学非常勤講師を兼務。日本地図学会第31期常任委員。発言は個人の見解です。

-プログラミング
-

WINGFIELD since1981をもっと見る

今すぐ購読し、続きを読んで、すべてのアーカイブにアクセスしましょう。

続きを読む