Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Drag a maximized form
Message
De
06/01/2016 18:24:40
 
 
À
06/01/2016 16:48:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows Server 2012 R2
Database:
MS SQL Server
Application:
Desktop
Virtual environment:
Hyper-V
Divers
Thread ID:
01629605
Message ID:
01629621
Vues:
80
to be pratical and demonstrate what i said this is a code to test:
(see image attached).
*this example is adapted from http://www.news2news.com/vfp/index.php?example=50
*it build a top level window with API createWindowEx and shows the behavior in docking and maximize
*the vfp9 window dont support the undocking  by dragging with mouse when maximized.
*this window  supports it.

Clea All
Do Declare
* Extended Window Styles (exhaustive here)
*#Define WS_EX_DLGMODALFRAME    1
*#Define WS_EX_NOPARENTNOTIFY   4
#Define WS_EX_TRANSPARENT     32
#Define SW_NORMAL  1
#Define WS_OVERLAPPED 0
#Define WS_CAPTION  0xC00000
#Define WS_SYSMENU  0x80000
#Define WS_THICKFRAME  0x40000
#Define WS_MINIMIZEBOX  0x20000
#Define WS_MAXIMIZEBOX  0x10000
#Define ANSI_CHARSET          0
#Define OUT_DEFAULT_PRECIS    0
#Define OUT_DEVICE_PRECIS     5
#Define OUT_OUTLINE_PRECIS    8
#Define CLIP_DEFAULT_PRECIS   0
#Define CLIP_STROKE_PRECIS    2
#Define DEFAULT_QUALITY       0
#Define PROOF_QUALITY         2
#Define DEFAULT_PITCH         0
#Define FW_BOLD             700
#Define TRANSPARENT           1
#Define OPAQUE                2

Local HWnd,lnSize,lcClass,dwExStyle,dwStyle
HWnd =  GetActiveWindow()
lcClass = Space(250)

lnSize = RealGetWindowClass (HWnd, @lcClass , Len(lcClass ))
lcClass = Strtran (Substr(lcClass, 1,lnSize), Chr(0),"")


dwExStyle=  WS_OVERLAPPED  && WS_CHILD style is not set, so it's a top-level window.
dwStyle   =  WS_CAPTION+WS_SYSMENU+WS_MAXIMIZEBOX+WS_MINIMIZEBOX +WS_THICKFRAME

Local hNew
hNew = CreateWindowEx (dwExStyle, lcClass, "A top level Window created with API createWindowEx dragged when maximized and dockable ",;
    dwStyle, 100, 100, 850, 300, 0, 0, 0, 0)  &&o for desktop hwnd

= ShowWindow (hNew, SW_NORMAL)
hDC = GetDC (hNew)
Local lpString
Set Memowidth To 180
TEXT to   lpString noshow
    the window created with API createWindowEx is top level and shown in taskbar
    if dragged toward the screen top its maximized (docked)
    if dragged from maximized its restored.

	try these shortcuts available in windows 7,8,10
	Windows + Up-Arrow: Maximizes the current window.
	Windows + Down-Arrow: Restores the original size of a maximized window - for other windows, minimizes them.
	Windows + Left-Arrow: Docks the current window on the left side of the screen
	Windows + Right-Arrow:Docks the current window on the right side of the screen

	Note:if you move the window the text is cleared (normal there is no persistent painting...to add with CallWindowProc API)
	Can build controls as textbox,editbox,image,label,....with APIs....as VFP does.

	I guess that is the "genese" of all standard windows and controls...maybe vfp is an exception (to confirm).
ENDTEXT

Local x,Y,xcolor
x=50
Y=40
For i=1 To Memlines(m.lpString)
    Do Case
        Case Between(i,1,4)
            m.xcolor=255
        Case Between(i,5,9)
            m.xcolor=Rgb(0,0,255)
        Otherwise
            m.xcolor=Rgb(255*Rand(),255*Rand(),255*Rand())
    Endcase
    = _print (hNew,x,Y,18,Mline(m.lpString,i), m.xcolor, 0)
    Y=Y+15
Endfor
= ReleaseDC (hNew, hDC)
_Screen.WindowState=1


Procedure  _print (HWnd,x,Y,Size,lcText, lnColor, lnAngle)
    hFont = CreateFont (;
        size,0, lnAngle,lnAngle, FW_BOLD, 0,0,0, ANSI_CHARSET,;
        OUT_OUTLINE_PRECIS, CLIP_STROKE_PRECIS,;
        PROOF_QUALITY, DEFAULT_PITCH, "Times New Roman")
    hDC = GetWindowDC (HWnd)
    * select new font into the device context
    * and delete the old one
    = DeleteObject (SelectObject (hDC, hFont))

    * set text color on a transparent background
    = SetTextColor (hDC, lnColor)
    = SetBkMode (hDC, TRANSPARENT)

    * the printing
    = TextOut (hDC, x, Y, lcText, Len(lcText))

    * release system resources
    = DeleteObject (hFont)
    = ReleaseDC (HWnd, hDC)
Endproc

Procedure  Declare
    Declare Integer RealGetWindowClass In user32;
        INTEGER  HWnd,;
        STRING @ pszType,;
        INTEGER  cchType
    Declare Integer GetActiveWindow In user32
    Declare Integer CreateWindowEx In user32;
        INTEGER dwExStyle,;
        STRING lpClassName,;
        STRING lpWindowName,;
        INTEGER dwStyle,;
        INTEGER x,;
        INTEGER Y,;
        INTEGER nWidth,;
        INTEGER nHeight,;
        INTEGER hWndParent,;
        INTEGER hMenu,;
        INTEGER hInstance,;
        INTEGER lpParam
    Declare Integer ShowWindow In user32;
        INTEGER HWnd,;
        INTEGER nCmdShow
    Declare Integer GetDC In user32 Integer HWnd
    Declare Integer TextOut In gdi32;
        INTEGER hdc,;
        INTEGER x,;
        INTEGER Y,;
        STRING  lpString,;
        INTEGER nCount
    Declare Integer ReleaseDC In user32;
        INTEGER HWnd, Integer hdc
    Declare Integer CreateFont In gdi32;
        INTEGER nHeight, Integer nWidth,;
        INTEGER nEscapement, Integer nOrientation,;
        INTEGER fnWeight, Integer fdwItalic,;
        INTEGER fdwUnderline, Integer fdwStrikeOut,;
        INTEGER fdwCharSet,;
        INTEGER fdwOutputPrecision,;
        INTEGER fdwClipPrecision,;
        INTEGER fdwQuality,;
        INTEGER fdwPitchAndFamily,;
        STRING  lpszFace

    Declare Integer GetWindowDC In user32 Integer hWindow
    Declare Integer SelectObject In gdi32 Integer hdc, Integer hObject
    Declare Integer DeleteObject In gdi32 Integer hObject
    Declare Integer SetTextColor In gdi32 Integer hdc, Integer crColor

    Declare Integer SetBkMode In gdi32;
        INTEGER hdc, Integer iBkMode

Endproc
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform