I'm now reading <Programming Windows> by Charles Petzold and have converted the code snippet about Ehanced Metafile to pb format ,but it doesn't workd, why?
thanks!!
Code: Select all
hwnd.l=OpenWindow(0,0,0,640,480,#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_SystemMenu,"emf test")
;CreateGadgetList(WindowID())
hdcEmf=createEnhMetaFile_(#Null,#Null,#Null,#Null)
Rectangle_(hdcEmf,100,100,200,200)
MoveToEx_(hdcEmf,100,100,#Null)
lineTo_(hdcEmf,200,200)
MoveToEx_(hdcEmf,200,100,#Null)
lineTo_(hdcEmf,100,200)
hemf.l=closeEnhMetafile_(hdcEmf)
quit.l=0
Repeat
event=WaitWindowEvent()
If event=#PB_Event_Repaint
ps.PAINTSTRUCT
r.RECT
hdc=BeginPaint_(hwnd,@ps);
GetclientRect_(hwnd,@r);
r\left=r\right/4;
r\right=3*r\right/4;
r\top=r\bottom/4;
r\bottom=3*r\bottom/4;
PlayEnhMetaFile_(hdc,hemf,@rect)
EndPaint_(hwnd,@ps)
;Debug "asdf"
EndIf
If event=#PB_Event_CloseWindow
DeleteEnhMetaFile_(hemf)
quit=1
EndIf
Until quit