|  |  | 
|  | 
|  | 
| - Seite 1 - | 
| 
 
 | 
|  Julian
 Schmidt
 | | Hallo, ich würde gerne erfassen ob innerhalb eines bestimmten Bereichs eines Haupt-, oder Dialogfensters eine Links,- Rechts-, Doppel(links)klick gemacht wurde.
 Ich weiß das es etwa für Links und Rechtsklick die Messages WM_LButtonDown, WM_RButtonDown gibt. Nur wie ermittle ich einen Doppelklick innerhalb eines bestimmten Bereichs?
 KompilierenMarkierenSeparieren
 Def LinksImBereich(4) (%message=$201) and (%MouseX>@&(1)) and (%MouseX<@&(3)) and (%MouseY>@&(2)) and (%MouseY<@&(4))
Def RechtsImBereich(4) (%message=$204) and (%MouseX>@&(1)) and (%MouseX<@&(3)) and (%MouseY>@&(2)) and (%MouseY<@&(4))
Windowstyle 24
cls
UseBrush 7,RGB(153,153,153)
Rectangle 50,50 - (width(%hwnd)-50),(height(%hwnd)-50)
While 1
    Waitinput
    If LinksImBereich(50,50,width(%hwnd)-50,height(%hwnd)-50)'Links im Innen-Rechteck = Verschieben
        UseCursor 5
        SendMessage(%hwnd,$112,$F012,0)
        External("USER32","ReleaseCapture")
        UseCursor 0
    Elseif RechtsImBereich(50,50,width(%hwnd)-50,height(%hwnd)-50)=0'Rechts im Außen-Rechteck = Ende
        break
    EndIf
Endwhile
LG
 
 Julian57
 | 
 | 
|  | 
|  |  | 
|  | 
| 
 
 
 | 
|  | 
| « Dieser Beitrag wurde als Lösung gekennzeichnet. » | 
|  | 
|  Detlef
 Jagolski
 | | Und so mit SubClassing! KompilierenMarkierenSeparieren
  $P+
SetErrorLevel 0
 $H WINDOWS.PH
 $H MESSAGES.PH
 $H STRUCTS.PH
STRUCT TRect         = ~Rect
STRUCT TPoint        = ~Point
Declare appexit%
Declare Point#
Declare Rect#
Declare Punkt&
Dim Point#,TPoint
Dim Rect#,TRect
SubClassProc
    If SubClassMessage(%hwnd, ~WM_LBUTTONDBLCLK)
        Point#.X& = LOWORD(&sLParam)
        Point#.Y& = HIWORD(&sLParam)
        ~SetRect(Rect#,70,70,200,200)
        Case ~PtInRect(Rect#,Point#.X&,Point#.Y&) <> 0: Print "Doppelklick Links"
    ElseIf SubClassMessage(%hwnd, ~WM_RBUTTONDBLCLK)
        Point#.X& = LOWORD(&sLParam)
        Point#.Y& = HIWORD(&sLParam)
        ~SetRect(Rect#,70,70,200,200)
        Case ~PtInRect(Rect#,Point#.X&,Point#.Y&) <> 0: Print "Doppelklick Rechts"
    EndIf
    Set("WinProc",1)
EndProc
SetTrueColor 1
WindowStyle $003F
WindowTitle "DesignForm"
Window %maxX + 5,114 - 498,415
Cls ~GetSysColor(15)
~SetClassLong(%hwnd,~GCL_STYLE,(~GetClassLong(%hwnd, ~GCL_STYLE) + ~CS_DBLCLKS))
Rectangle 70,70 - 200,200
UseFont "MS Sans Serif",13,0,0,0,0
SetDialogFont 1
SubClass %hwnd,1
SetWindowPos %hwnd = 207,114 - 498,415;0
WhileNot appexit%
    WaitInput
    If %key = 2
        appexit%=1
    ElseIf %key = 4
        ' Fenstergröße
    ElseIf %key = 5
        ' Hilfe
    EndIf
Wend
SubClass %hwnd,0
Dispose Point#
Dispose Rect#
 | 
 | 
|  | 
|  | | XProfan X4,  PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11 | 25.09.2011  ▲ | 
 | 
|  | 
|  | 
| 
 
 
 | 
|  | 
|  Detlef
 Jagolski
 | | Aus der API Hilfe! 
 WM_NCLBUTTONDBLCLK
 WM_MBUTTONDBLCLK
 WM_RBUTTONDBLCLK
 WM_LBUTTONDBLCLK
 | 
 | 
|  | 
|  | | XProfan X4,  PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11 | 24.09.2011  ▲ | 
 | 
|  | 
| 
 
 
 | 
|  | 
|  Julian
 Schmidt
 |  | 
|  | 
|  |  | 
|  | 
| 
 
 
 | 
|  | 
|  | | Kannst z.B. wm_lButtonDblClk als UserMessage festlegen... | 
 | 
|  | 
|  |  | 
|  | 
| 
 
 
 | 
|  | 
|  Julian
 Schmidt
 |  | 
|  | 
|  |  | 
|  | 
| 
 
 
 | 
|  | 
|  | | WindowStyle 512 oder SubClassProc... | 
 | 
|  | 
|  |  | 
|  | 
| 
 
 
 | 
|  | 
|  Julian
 Schmidt
 |  | 
|  | 
|  |  | 
|  | 
| 
 
 
 | 
|  | 
|  Dieter
 Zornow
 |  | 
|  | 
|  | | Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2 | 25.09.2011  ▲ | 
 | 
|  | 
| 
 
 
 | 
|  | 
|  Detlef
 Jagolski
 | | Und so mit SubClassing! KompilierenMarkierenSeparieren
  $P+
SetErrorLevel 0
 $H WINDOWS.PH
 $H MESSAGES.PH
 $H STRUCTS.PH
STRUCT TRect         = ~Rect
STRUCT TPoint        = ~Point
Declare appexit%
Declare Point#
Declare Rect#
Declare Punkt&
Dim Point#,TPoint
Dim Rect#,TRect
SubClassProc
    If SubClassMessage(%hwnd, ~WM_LBUTTONDBLCLK)
        Point#.X& = LOWORD(&sLParam)
        Point#.Y& = HIWORD(&sLParam)
        ~SetRect(Rect#,70,70,200,200)
        Case ~PtInRect(Rect#,Point#.X&,Point#.Y&) <> 0: Print "Doppelklick Links"
    ElseIf SubClassMessage(%hwnd, ~WM_RBUTTONDBLCLK)
        Point#.X& = LOWORD(&sLParam)
        Point#.Y& = HIWORD(&sLParam)
        ~SetRect(Rect#,70,70,200,200)
        Case ~PtInRect(Rect#,Point#.X&,Point#.Y&) <> 0: Print "Doppelklick Rechts"
    EndIf
    Set("WinProc",1)
EndProc
SetTrueColor 1
WindowStyle $003F
WindowTitle "DesignForm"
Window %maxX + 5,114 - 498,415
Cls ~GetSysColor(15)
~SetClassLong(%hwnd,~GCL_STYLE,(~GetClassLong(%hwnd, ~GCL_STYLE) + ~CS_DBLCLKS))
Rectangle 70,70 - 200,200
UseFont "MS Sans Serif",13,0,0,0,0
SetDialogFont 1
SubClass %hwnd,1
SetWindowPos %hwnd = 207,114 - 498,415;0
WhileNot appexit%
    WaitInput
    If %key = 2
        appexit%=1
    ElseIf %key = 4
        ' Fenstergröße
    ElseIf %key = 5
        ' Hilfe
    EndIf
Wend
SubClass %hwnd,0
Dispose Point#
Dispose Rect#
 | 
 | 
|  | 
|  | | XProfan X4,  PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11 | 25.09.2011  ▲ | 
 | 
|  | 
| 
 
 
 | 
|  | 
|  Julian
 Schmidt
 | | Ok, die beiden Quelltexte funktionieren super! Besonders die Variante von Detlef
  | 
 | 
|  | 
|  |  | 
|  | 
| 
 
 
 | 
|  | 
|  | | iF hats doch geschrieben...WindowStyle 512 oder SubClassProc... 
 Darauf schreibst Du Funktioniert aber trotzdem nicht in einem Beispiel was weder winstyle 512 oder die Proc nutzt.
 
 Soll man sich schwer an kopf fassen.
  | 
 | 
|  | 
|  |  | 
|  | 
| 
 
 
 | 
|  | 
|  Julian
 Schmidt
 | | Unbenannt  (25.09.11) 
 iF hats doch geschrieben...WindowStyle 512 oder SubClassProc... Darauf schreibst Du Funktioniert aber trotzdem nicht in einem Beispiel was weder winstyle 512 oder die Proc nutzt. Soll man sich schwer an kopf fassen. 
 Wo ist in dem Beispiel kein SubClassProc?
 
 Julian57  (25.09.11)
 
 
 So hätte es richtig lauten müssen...
 KompilierenMarkierenSeparieren
 Es hat nur der CS_DBLCLKS Class-Style gefehlt
 | 
 | 
|  | 
|  |  | 
|  | 
| 
 
 
 |