Code: Select all
Procedure IsDrawing()
!extrn _PB_2DDrawing_CurrentDC
!MOV eax, dword [_PB_2DDrawing_CurrentDC]
ProcedureReturn
EndProcedure
Code: Select all
Procedure IsDrawing()
!extrn _PB_2DDrawing_CurrentDC
!MOV eax, dword [_PB_2DDrawing_CurrentDC]
ProcedureReturn
EndProcedure
sec wrote:I tried above code, but failed. How get current DC now?Code: Select all
Procedure IsDrawing() !extrn _PB_2DDrawing_CurrentDC !MOV eax, dword [_PB_2DDrawing_CurrentDC] ProcedureReturn EndProcedure
Code: Select all
Procedure StartDrawing_replacement(Output)
Shared _PB_2DDrawing_CurrentDC
_PB_2DDrawing_CurrentDC = StartDrawing(Output)
ProcedureReturn _PB_2DDrawing_CurrentDC
EndProcedure
Procedure StopDrawing_replacement()
Shared _PB_2DDrawing_CurrentDC
_PB_2DDrawing_CurrentDC = 0
StopDrawing()
EndProcedure
Macro StartDrawing(Output) : StartDrawing_replacement(Output) : EndMacro
Macro StopDrawing() : StopDrawing_replacement() : EndMacro
Procedure IsDrawing()
Shared _PB_2DDrawing_CurrentDC
ProcedureReturn _PB_2DDrawing_CurrentDC
EndProcedure
Debug IsDrawing()
If CreateImage(1,100,100)
If StartDrawing(ImageOutput(1))
Debug IsDrawing()
StopDrawing()
Debug IsDrawing()
EndIf
EndIf
Thanks Danilo for codeDanilo wrote:sec wrote:I tried above code, but failed. How get current DC now?Code: Select all
Procedure IsDrawing() !extrn _PB_2DDrawing_CurrentDC !MOV eax, dword [_PB_2DDrawing_CurrentDC] ProcedureReturn EndProcedure
Code: Select all
Procedure StartDrawing_replacement(Output) Shared _PB_2DDrawing_CurrentDC _PB_2DDrawing_CurrentDC = StartDrawing(Output) ProcedureReturn _PB_2DDrawing_CurrentDC EndProcedure Procedure StopDrawing_replacement() Shared _PB_2DDrawing_CurrentDC _PB_2DDrawing_CurrentDC = 0 StopDrawing() EndProcedure Macro StartDrawing(Output) : StartDrawing_replacement(Output) : EndMacro Macro StopDrawing() : StopDrawing_replacement() : EndMacro Procedure IsDrawing() Shared _PB_2DDrawing_CurrentDC ProcedureReturn _PB_2DDrawing_CurrentDC EndProcedure Debug IsDrawing() If CreateImage(1,100,100) If StartDrawing(ImageOutput(1)) Debug IsDrawing() StopDrawing() Debug IsDrawing() EndIf EndIf
Not as future compatible as the solution above:sec wrote:Thanks Danilo for code
Code: Select all
Procedure IsDrawing()
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
!extern _PB_2DDrawing_Pointer
CompilerElse
!extrn _PB_2DDrawing_Pointer
CompilerEndIf
!MOV eax, dword [_PB_2DDrawing_Pointer]
ProcedureReturn
EndProcedure
Debug IsDrawing()
If CreateImage(1,100,100)
If StartDrawing(ImageOutput(1))
Debug IsDrawing()
StopDrawing()
Debug IsDrawing()
EndIf
EndIf
@Danilo: great, i have updated the code here: http://www.purebasic.fr/english/viewtop ... 58#p106258Danilo wrote:Not as future compatible as the solution above:sec wrote:Thanks Danilo for codeCode: Select all
Procedure IsDrawing() CompilerIf #PB_Compiler_OS = #PB_OS_MacOS !extern _PB_2DDrawing_Pointer CompilerElse !extrn _PB_2DDrawing_Pointer CompilerEndIf !MOV eax, dword [_PB_2DDrawing_Pointer] ProcedureReturn EndProcedure Debug IsDrawing() If CreateImage(1,100,100) If StartDrawing(ImageOutput(1)) Debug IsDrawing() StopDrawing() Debug IsDrawing() EndIf EndIf