No support For Aero snap
MS help sayes "Snap might not work on some programs that have custom window behaviors."
OK just in Case that somebody in need For this function
I inveted the wheel
Sorry
Code: Select all
#CDDS_ITEMPREPAINT = #CDDS_ITEM|#CDDS_PREPAINT
#CDDS_SUBITEMPREPAINT = #CDDS_SUBITEM|#CDDS_ITEMPREPAINT
#SB_SETBKCOLOR = $2001
Global Appname.s,wr.RECT,ListGadget,Button1,Color_1,Color_2,FontReg,FontBold,Fontname$
Dim SetParts.l(5)
SetParts(0) = 60
SetParts(1) = 120
SetParts(2) = 180
SetParts(3) = 260
SetParts(4) = 500
Appname = "Windows API Create"
Color_1 = RGB(255, 255, 224)
Color_2 = RGB(255, 240, 177)
Fontname$ = "Microsoft Sans Serif Regular"
FontReg = LoadFont(1, Fontname$, 12)
FontBold = LoadFont(2, Fontname$, 12, #PB_Font_HighQuality)
Procedure LoWord(value)
ProcedureReturn value & $FFFF
EndProcedure
Procedure HiWord(value)
ProcedureReturn value >> 16 & $FFFF
EndProcedure
Procedure WinProc(Wnd,Message,wParam,lParam)
Result = DefWindowProc_(Wnd, Message, wParam, lParam)
Select Message
;********************************* Change Row Color & Column Font ************************
Case #WM_NOTIFY
*pnmh.NMHDR = lParam
Select *pnmh\code
Case #NM_CUSTOMDRAW
*LVCDHeader.NMLVCUSTOMDRAW = lParam
If *LVCDHeader\nmcd\hdr\hWndFrom=ListGadget
Select *LVCDHeader\nmcd\dwDrawStage
Case #CDDS_PREPAINT
result = #CDRF_NOTIFYITEMDRAW
Case #CDDS_ITEMPREPAINT
Result = #CDRF_NOTIFYSUBITEMDRAW
Case #CDDS_SUBITEMPREPAINT
Row = *LVCDHeader\nmcd\dwItemSpec
Col = *LVCDHeader\iSubItem
If Col=0
SelectObject_(*LVCDHeader\nmcd\hDC, FontBold)
Else
SelectObject_(*LVCDHeader\nmcd\hDC, FontReg)
EndIf
If Row&1=1
*LVCDHeader\clrTextBk = Color_2
EndIf
Result = #CDRF_NEWFONT
EndSelect
EndIf
EndSelect
; ********************************* Max / Min Size *************************************
Case #WM_GETMINMAXINFO
*pMinMax.MINMAXINFO = lParam
*pMinMax\ptMinTrackSize\x=800
*pMinMax\ptMinTrackSize\y=600
*pMinMax\ptMaxTrackSize\x=GetSystemMetrics_(#SM_CXSCREEN)
*pMinMax\ptMaxTrackSize\y=GetSystemMetrics_(#SM_CYSCREEN)
; ********************************* Resizing ********************************************
Case #WM_SIZE
GetWindowRect_(Wnd, wr)
WinX = wr\right - wr\left
WinY = wr\bottom - wr\top
MoveWindow_(Button1,10,WinY-140,80,24,1)
MoveWindow_(ListGadget,10,30,WinX-35,WinY-190,1)
; ******************************** Commands *******************************************
Case #WM_COMMAND
Select LoWord(wParam)
Case 1
MessageRequester("Info","New pressed",0)
Case 2
MessageRequester("Info","Open pressed",0)
Case 3
MessageRequester("Info","Save pressed",0)
Case 4
PostQuitMessage_(0)
Case 5
MessageRequester("Info","Button pressed",0)
EndSelect
; ******************************** End *******************************************
Case #WM_CLOSE
UnregisterClass_(Appname,hInstance)
PostQuitMessage_(0)
EndSelect
ProcedureReturn Result
EndProcedure
win_0.WNDCLASS
win_0\style = #CS_OWNDC
win_0\lpfnWndProc = @WinProc()
win_0\cbClsExtra = 0
win_0\cbWndExtra = 0
win_0\hInstance = hInstance
win_0\hIcon = LoadIcon_(hInstance, "#1")
win_0\hCursor = LoadCursor_(0, #IDC_ARROW)
win_0\hbrBackground = CreateSolidBrush_(GetSysColor_(15))
win_0\lpszMenuName = 0
win_0\lpszClassName = @Appname
RegisterClass_(win_0)
hWnd = CreateWindowEx_(0,Appname,"API Windows Creation",#WS_OVERLAPPEDWINDOW,(GetSystemMetrics_(#SM_CXSCREEN)-1024)/2,(GetSystemMetrics_(#SM_CYSCREEN)-768)/2,1024,768,0,0,hInstance,0)
hMenu = CreateMenu(0,hWnd)
MenuTitle("File")
MenuItem( 1, "New")
MenuItem( 2, "Open")
MenuItem( 3, "Save")
MenuBar()
MenuItem( 4, "Quit")
hToolbar = CreateToolBar(1,hWnd)
SendMessage_(hToolbar,#TB_SETINDENT,8,0)
SendMessage_(hToolbar,#TB_SETSTYLE,0,SendMessage_(hToolbar,#TB_GETSTYLE,0,0)|#CCS_NODIVIDER|#CCS_NORESIZE)
ToolBarStandardButton(1, #PB_ToolBarIcon_New)
ToolBarStandardButton(2, #PB_ToolBarIcon_Open)
ToolBarStandardButton(3, #PB_ToolBarIcon_Save)
ToolBarToolTip(1, 1, "New document")
ToolBarToolTip(1, 2, "Open file")
ToolBarToolTip(1, 3, "Save file")
hStatusbar = CreateStatusBar(2,hWnd)
SendMessage_(hStatusbar, #SB_SETMINHEIGHT, 25, 0)
SendMessage_(hStatusbar, #WM_SIZE, 0,0)
SendMessage_(hStatusbar, #SB_SETPARTS, 5, @SetParts(0))
SendMessage_(hStatusbar,#SB_SETBKCOLOR ,0,$C2FFFF)
StatusBarText(2,4,"RASHAD",#PB_StatusBar_Center)
SendMessage_(hStatusbar,#WM_SETFONT,FontID(2),#True)
UseGadgetList(hWnd)
Button1 = ButtonGadget(5,10,700,80,24,"TEST")
ListGadget = ListIconGadget(6,10,40,1405,660,"Column 0", 400,#PB_ListIcon_FullRowSelect|#PB_ListIcon_GridLines)
SetGadgetColor(6, #PB_Gadget_BackColor, Color_1)
SetGadgetFont(6, FontID(1))
AddGadgetColumn(6,1,"Column 1",400)
AddGadgetColumn(6,2,"Column 2",400)
AddGadgetColumn(6,3,"Column 3",400)
AddGadgetColumn(6,4,"Column 4",400)
For i=0 To 50
AddGadgetItem(6, -1, "Line "+Str(i)+" column number zero"+Chr(10)+"Line "+Str(i)+" col 1"+Chr(10)+"Line "+Str(i)+" col 2"+Chr(10)+"Line "+Str(i)+" col 3"+Chr(10)+"Line "+Str(i)+" col 4"+Chr(10)+"Line "+Str(i)+" col 5"+Chr(10)+"Line "+Str(i)+" col 6"+Chr(10)+"Line "+Str(i)+" col 7")
Next
UpdateWindow_(hWnd)
ShowWindow_(hWnd,#SW_SHOWNORMAL)
SetForegroundWindow_(hWnd)
While GetMessage_(m.MSG, 0, 0, 0)
TranslateMessage_(m)
DispatchMessage_(m)
Wend
x86/x64
RASHAD