Trainee
Date of registration: Nov 24th 2008
Location: Cologne, Germany
Occupation: Second Vice President of Distributed Junk and Trash Development
Jabaco Source |
|
1 |
myHandle = Me.hWnd
|
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
Private WinApi Function WindowFromPoint Lib "user32.dll" ( _ ByVal xPoint As Integer, ByVal yPoint As Integer) As Integer Private WinApi Function GetDC Lib "user32.dll" ( _ ByVal hwnd As Integer) As Integer Private WinApi Function LineTo Lib "gdi32.dll" ( _ ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer) As Integer Private m_bhwnd As Boolean Private m_hWnd As Integer Private m_bhDC As Boolean Private m_hDC As Integer Public Sub Command1_Click() Label1.Caption = CStr(Me.hwnd) Label2.Caption = CStr(Me.hDC) Call LineTo(Me.hDC,10,10) Call LineTo(Me.hDC,100,20) Call LineTo(Me.hDC,110,100) Call LineTo(Me.hDC,10,90) Call LineTo(Me.hDC,10,10) End Sub Public Property Get hWnd() As Integer If Not m_bhwnd Then Dim x As Integer, y As Integer x = Me.Left + Me.Width - Me.ScaleWidth + 1 y = Me.Top + Me.Height - Me.ScaleHeight + 1 m_hWnd = WindowFromPoint(x, y) m_bhwnd = True End If hWnd = m_hWnd End Property Public Property Get hDC() As Integer If Not m_bhDC Then m_hDC = GetDC(Me.hWnd) m_bhDC = True End If hDC = m_hDC End Property |
Trainee
Date of registration: Nov 24th 2008
Location: Cologne, Germany
Occupation: Second Vice President of Distributed Junk and Trash Development
if all else fails you can try it this way:
Quoted
what if there is another window overlapping my window?
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
Private WinApi Function GetDC Lib "user32.dll" ( _ ByVal hwnd As Integer) As Integer Private WinApi Function LineTo Lib "gdi32.dll" ( _ ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer) As Integer Private WinApi Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _ ByVal lpClassName As Integer, ByVal lpWindowName As String) As Integer Private m_bhwnd As Boolean Private m_hWnd As Integer Private m_bhDC As Boolean Private m_hDC As Integer Public Sub Command1_Click() Label1.Caption = CStr(Me.hwnd) Label2.Caption = CStr(Me.hDC) Call LineTo(Me.hDC,10,10) Call LineTo(Me.hDC,100,20) Call LineTo(Me.hDC,110,100) Call LineTo(Me.hDC,10,90) Call LineTo(Me.hDC,10,10) End Sub Public Property Get hWnd() As Integer If Not m_bhwnd Then Dim title As String title = Me.Caption m_hWnd = FindWindow(0, Me.Caption) m_bhwnd = True End If hWnd = m_hWnd End Property Public Property Get hDC() As Integer If Not m_bhDC Then m_hDC = GetDC(Me.hWnd) m_bhDC = True End If hDC = m_hDC End Property |
Administrator
Date of registration: Jul 16th 2008
Location: Erlangen, Germany
Occupation: Software Developer
Hobbies: Jabaco, game theory, text-mining
In Swing benötigst du in der Regel kein Fensterhandle und auch keinen Device Context. Nur dein eigentliches Formular besitzt ein Handle und dieses leitet die Ein-/Ausgabe an eine Java-Klassen weiter.Quoted
wie kann man das Handle des eigenen Fensters oder UserControls ermitteln?
Es gibt sicher eine vergleichbare Lösung für dein Problem, aber dafür müsstest du dein Ziel etwas genauer beschreiben.Quoted
Gibt es in Jabaco was vergleichbares?
Administrator
Date of registration: Jul 16th 2008
Location: Erlangen, Germany
Occupation: Software Developer
Hobbies: Jabaco, game theory, text-mining
Dafür gibt es verschiedene Möglichkeiten, wenn es eine Java-Klasse ist, dann musst du nur einen Verweis hinzufügen. Wenn es eine C++ Klasse ist, dann solltest du nach einem Java-Wrapper dafür suchen, oder du musst dir einen schreiben. Du kannst auch eine VB6 / ActiveX-Klasse in Java verwenden. Eine Möglichkeit dafür wäre zum Beispiel JavaActiveX-Bridge. Es kommt sehr stark auf deine Problemstellung an. Ich persönlich würde immer den Java-Weg bevorzugen. Für die meisten Controls wirst du eine Alternative in Java finden.Quoted
Wie sieht das denn mit fremden Fensterklassen aus, kann ich diese denn, ohne ein Fensterhandle,
auf bzw in ein Usercontrol einbauen?