in c:\fwh\source\function\fwbmp.c i found function MaskRegion() but no Sample.
i have a Xbase++ and HMG Sample for Region but my FiveWin Version display wrong
- Code: Select all Expand view
- Not Acceptable!
An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.
i can't post that Code
ok, found out that he do not like Comment like /* hello */ in Code Tag
in Xbase++ and HMG Version i use DLLCall like this
- Code: Select all Expand view
- STATIC FUNCTION API_SetRegion(nIDig, aRegion, nNr)
LOCAL hRgn, hAdd, nX, hComb, nRet, nDLL, nDLL2
LOCAL cIdx, cForm, cImage, cMacro
LOCAL hWnd
IF EMPTY( aRegion )
RETURN NIL
ENDIF
cIdx := STRZERO(nIDig,2)
cForm := "Form_" + cIdx
hWnd := GetFormHandle(cForm)
nDLL := DLLLOAD( 'GDI32.DLL' )
If !EMPTY(nDll)
// Create first region
hRgn := DLLCALL( nDll, DLL_OSAPI,"CreateRectRgn", aRegion[1,1],;
aRegion[1,2],;
aRegion[1,3],;
aRegion[1,4] )
FOR nX := 2 to Len( aRegion )
// create all the other regions and combine them with the first
hAdd := DLLCALL( nDll, DLL_OSAPI,"CreateRectRgn", aRegion[nX,1],;
aRegion[nX,2],;
aRegion[nX,3],;
aRegion[nX,4] )
nRet := DLLCALL( nDll, DLL_OSAPI, "CombineRgn", hRgn, hRgn, hAdd, RGN_OR )
// discard this region (no longer needed)
DLLCALL( nDll, DLL_OSAPI,"DeleteObject", hAdd )
NEXT
nDll2 := DLLLoad( 'USER32.DLL' )
// call windows to create the region
DLLCALL( nDll2, DLL_OSAPI, "SetWindowRgn", hWnd, hRgn, 1 )
DLLUNLOAD( nDll )
DLLUNLOAD( nDll2 )
ENDIF
RETURN NIL
under FiveWin i have reduce DllCall
- Code: Select all Expand view
- STATIC FUNCTION API_SetRegion(nIDig, aRegion, nNr)
LOCAL hRgn, hAdd, nX, nRet
LOCAL hWnd
IF EMPTY( aRegion )
RETURN NIL
ENDIF
hWnd := a_Forms[nIDig][My_FormObj]:hwnd
// Create first region
hRgn := CreateRectRgn( aRegion[1,1],;
aRegion[1,2],;
aRegion[1,3],;
aRegion[1,4] )
FOR nX := 2 to Len( aRegion )
// create all the other regions and combine them with the first
hAdd := CreateRectRgn( aRegion[nX,1],;
aRegion[nX,2],;
aRegion[nX,3],;
aRegion[nX,4] )
nRet := CombineRgn(hRgn, hRgn, hAdd, RGN_OR )
// discard this region (no longer needed)
DeleteObject( hAdd )
NEXT
// call windows to create the region
SetWindowRgn( hWnd, hRgn, 1 )
RETURN NIL
it does not crash ... but Result display wrong 7-Segment Area
while there is MaskRegion() in FiveWin i like to ask if somebody have a Sample.
here my Region data
- Code: Select all Expand view
- STATIC FUNCTION LoadMask()
LOCAL aMask := {}
LOCAL aMIA := MaskItemArray()
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 0 ) ) )
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 1 ) ) )
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 2 ) ) )
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 3 ) ) )
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 4 ) ) )
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 5 ) ) )
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 6 ) ) )
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 7 ) ) )
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 8 ) ) )
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 9 ) ) )
AADD( aMask, GetMaskArray( aMIA, ZahlArray( 10 ) ) )
RETURN aMask
- Code: Select all Expand view
- STATIC FUNCTION MaskItemArray()
LOCAL aRegion := {}
// 1
AADD( aRegion, { 5, 160, 20 + 9, 250 } ) // Balken links Oben
AADD( aRegion, { 5 + 8, 251, 21, 259 } ) // Nase Balken links Oben oben
AADD( aRegion, { 5 + 8, 151, 21, 159 } ) // Nase Balken links Oben unten
// 4
AADD( aRegion, { 5, 39, 20 + 9, 128 } ) // Balken links unten
AADD( aRegion, { 5 + 8, 129, 21, 137 } ) // Nase Balken links unten oben
AADD( aRegion, { 5 + 8, 30, 21, 38 } ) // Nase Balken links unten unten
// 7
AADD( aRegion, { 21 + 9, 252, 70 + 9, 280 } ) // Balken Mitte Oben
AADD( aRegion, { 21, 260, 29, 272 } ) // Nase Balken Mitte Oben links
AADD( aRegion, { 80, 260, 88, 272 } ) // Nase Balken Mitte Oben rechts
// 10
AADD( aRegion, { 21 + 9, 130, 70 + 9, 158 } ) // Balken Mitte Mitte
AADD( aRegion, { 21, 138, 29, 150 } ) // Nase Balken Mitte Mitte links
AADD( aRegion, { 80, 138, 88, 150 } ) // Nase Balken Mitte Mitte rechts
// 13
AADD( aRegion, { 21 + 9, 9, 70 + 9, 37 } ) // Balken Mitte Unten
AADD( aRegion, { 21, 17, 29, 29 } ) // Nase Balken Mitte Unten links
AADD( aRegion, { 80, 17, 88, 29 } ) // Nase Balken Mitte Unten rechts
// 16
AADD( aRegion, { 81, 160, 96 + 9, 250 } ) // Balken Rechts oben
AADD( aRegion, { 81 + 8, 251, 97, 259 } ) // Nase Balken Rechts oben oben
AADD( aRegion, { 81 + 8, 151, 97, 159 } ) // Nase Balken Rechts oben unten
// 19
AADD( aRegion, { 81, 39, 96 + 9, 128 } ) // Balken Rechts unten
AADD( aRegion, { 81 + 8, 129, 97, 137 } ) // Nase Balken Rechts unten oben
AADD( aRegion, { 81 + 8, 30, 97, 38 } ) // Nase Balken Rechts unten unten
// 22
AADD( aRegion, { 40, 70, 60, 100 } )
AADD( aRegion, { 40, 200, 60, 230 } )
#IFDEF Use_BottomLeft
#ELSE
AEVAL(aRegion, {|x| x[4] := ABS(aSubSize[2]-x[4]) } )
AEVAL(aRegion, {|x| x[2] := ABS(aSubSize[2]-x[2]) } )
#ENDIF
RETURN aRegion
- Code: Select all Expand view
- STATIC FUNCTION GetMaskArray( aMIA, aZeig )
LOCAL i, iMax := LEN( aMIA )
LOCAL aRet := {}
FOR i := 1 TO iMax
IF ASCAN( aZeig, { | e | e = i } ) > 0
AADD( aRet, aMIA[ i ] )
ENDIF
NEXT
RETURN aRet
- Code: Select all Expand view
- STATIC FUNCTION ZahlArray( nNo )
LOCAL aZeig
#IFDEF Use_BottomLeft
DO CASE
CASE nNo = 0
aZeig := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
CASE nNo = 1
aZeig := { 16, 17, 18, 19, 20, 21 }
CASE nNo = 2
aZeig := { 1, 2, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 19, 20, 21 }
CASE nNo = 3
aZeig := { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
CASE nNo = 4
aZeig := { 4, 5, 6, 10, 11, 12, 16, 17, 18, 19, 20, 21 }
CASE nNo = 5
aZeig := { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }
CASE nNo = 6
aZeig := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }
CASE nNo = 7
aZeig := { 13, 14, 15, 16, 17, 18, 19, 20, 21 }
CASE nNo = 8
aZeig := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
CASE nNo = 9
aZeig := { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
CASE nNo = 10
aZeig := { 22, 23 } // ":"
ENDCASE
#ELSE // Windows use Topleft as 0,0
DO CASE
CASE nNo = 0
aZeig := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
CASE nNo = 1
aZeig := { 16, 17, 18, 19, 20, 21 }
CASE nNo = 2
aZeig := { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }
CASE nNo = 3
aZeig := { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
CASE nNo = 4
aZeig := { 1, 2, 3, 10, 11, 12, 16, 17, 18, 19, 20, 21 }
CASE nNo = 5
aZeig := { 1, 2, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 19, 20, 21 }
CASE nNo = 6
aZeig := { 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 19, 20, 21 }
CASE nNo = 7
aZeig := { 7, 8, 9, 16, 17, 18, 19, 20, 21 }
CASE nNo = 8
aZeig := { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }
CASE nNo = 9
aZeig := { 1, 2, 3, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21 }
CASE nNo = 10
aZeig := { 22, 23 } // ":"
ENDCASE
#ENDIF
RETURN aZeig