fsw wrote:@SFSxOI
you are using Win32 API, but I thought it's deprecated in Vista. (because it's obsolete)
Besides, GDI and GDI+ are not hardware accelarated anymore.
So if PB is using GDI or GDI+ any drawing will be slower than it was on XP, or not?
The API is alive and well in Vista, however, there are some items that were deprecated the same as always happens over time. In fact there have been new API's added for Vista, especially for file functions. Vista uses GDI+ for a lot of things, Vista renders everything off screen and it uses some GDI+ to do this, so no one needs to worry about porting stuff over the the new Windows Presentation Foundation just yet. there is more DirectX used in DWM then anything else however. Honestly, Vista probably, in a general minimum respect, means a vid card upgrade for some people and maybe an investment in more memory. I'm using an ATI 800 Pro series card and it supports Vista just fine. I haven't noticed any slow downs. GDI+ in Vista seems to work well, in fact some of the GDI examples posted in the forums are faster in Vista with DWM enabled then they ever were in XP (for me). Also, i'm working in the Aero Theme, so there are things used in the Aero theme that might not be used if i switched to the classic theme, and the DWM effects and API's are mostly used in the Aero theme even tho they can be used at any time. The Aero Glass theme was designed to speed up screen rendering, and it works great. You can read more about the new API's added with Vista, or changes in the API for Vista, in the MSDN at:
http://msdn2.microsoft.com/en-us/library/aa383874.aspx
Since you mention that i'm using API, heres another DWM example for the DwmExtendFrameIntoClientArea function. I'm using API, especially in this example, because there are some areas where PureBasic functions will not work in Vista with DWM. While this is an example of one of them i'm sure that PureBasic will offer more Vista support within a few years just like it has with other versions of windows. Read the comments in the code to find out why I used API here.
Code: Select all
#Style = #WS_VISIBLE | #WS_SYSMENU
Structure MARGINS
cxLeftWidth.l
cxRightWidth.l
cyTopHeight.l
cyBottomHeight.l
EndStructure
Procedure ExtendFrame(hWnd.l)
; the margin structure do -1 as shown below
; for sheet glass effect for whole window
pMargin.MARGINS
pMargin\cxLeftWidth = -1
pMargin\cxRightWidth = -1
pMargin\cyTopHeight = -1
pMargin\cyBottomHeight = -1
Lib = LoadLibrary_("dwmapi.dll") ; load the library
If Lib
*pAfunc = GetProcAddress_(Lib, "DwmExtendFrameIntoClientArea") ; get pointer to function
CallFunctionFast(*pAfunc, hWnd, pMargin) ; call the function
MessageRequester("Information", "Frame extended into window!", #PB_MessageRequester_Ok)
FreeLibrary_(Lib) ; free up the library
EndIf
EndProcedure
Procedure WindowCallback(Window, Message, wParam, lParam)
Select Message
Case #WM_CLOSE
If MessageBox_(Window, "You sure?", "EXIT", #MB_YESNO) = #IDYES
DestroyWindow_(Window)
Else
Result = 0
EndIf
Case #WM_DESTROY
PostQuitMessage_(0)
Result = 0
Default
Result = DefWindowProc_(Window, Message, wParam, lParam)
EndSelect
ProcedureReturn Result
EndProcedure
WindowClass.s = "dwmwclass"
wc.WNDCLASSEX
wc\cbSize = SizeOf(WNDCLASSEX)
wc\lpfnWndProc = @WindowCallback()
wc\hCursor = LoadCursor_(0, #IDC_ARROW)
wc\hbrBackground = #Null ; not #COLOR_WINDOW+1 an application must paint its own background for this example
wc\lpszClassName = @WindowClass
RegisterClassEx_(@wc)
hWnd.l = CreateWindowEx_(#WS_EX_DLGMODALFRAME, WindowClass, "DWM_Test", #Style, 10, 10, 200, 200, 0, 0, 0, 0)
ExtendFrame(hWnd.l)
; The "DwmExtendFrameIntoClientArea" DWM function
; does not work for windows produced by
; PureBasic commands.
; will work with windows produced by API as above
While GetMessage_(msg.MSG, #Null, 0, 0 )
TranslateMessage_(msg)
DispatchMessage_(msg)
Wend
You'll notice the window has no borders (frame), actually it does but the code above extends them into the window producing what is called the 'sheet glass' effect. After you do this you can draw on the surface, put gadgets, etc, and get a really neat looking GUI going, looks really 3D because the gadgets apear to be actually floating over the 'sheet glass' background.
Here's a pic showing the effect of extending the frame from the code above:
http://www.123pichosting.com/viewer.php ... tended.JPG
And...heres another pic showing the same extended frame window (over the Purebasic IDE, this very code in fact) but to point out something that DWM adds by default, a shadow effect around a window. The pic also shows a faint lighter band diagonally on the window, this is the reflective effect of the DWM Glass.
http://www.123pichosting.com/viewer.php ... nded_2.JPG
(These were captured from the screen with the built in 'screen capture' tool in Vista called the Snipping Tool.)