Microsoft INK Regcognizer

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Microsoft INK Regcognizer

Post by AUGE_OHR »

hi,

i try to re-write a Xbase++ Sample to HMG but i have "Problem" with this Syntax

Code: Select all

   aBin := myInkCollector:Ink:Save( IPF_GIF, IPCM_Default )
i try to "split" line

Code: Select all

   oInk := myInkCollector:Ink
   if hb_IsObject(oInk)
      aBin := oInk:Save( IPF_GIF, IPCM_Default )
but still fail ...

---

"draw" a Word, like "Hello" into upper Field and press "Recognize"
you will see in Editbox "Hello"
Hb_Ink.JPG
Hb_Ink.JPG (25.67 KiB) Viewed 3842 times
now i want to "save" Image where i have "draw" Word "Hello" ... but it crash
it does work under Xbase++ ( see \OLD )
HBINK.ZIP
(1.1 MiB) Downloaded 193 times

p.s. Xbase++ use a "Groupbox" -> WC_STATIC with Frame as "Parent" -> Hwnd
i use a LABEL ... not sure if it is "right" Control for it
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Microsoft INK Regcognizer

Post by AUGE_OHR »

hi,

have found a Workaroud to "save" Image

Code: Select all

   ACTION SaveInk( ThisWindow.Name,"Label_1","TEST.GIF",BT_FILEFORMAT_GIF )

PROCEDURE SaveInk( cForm, cControl, cFileName, nTypePicture )
LOCAL hBitmap
LOCAL nROW    := GetProperty(cForm, cControl, "ROW"   )
LOCAL nCOL    := GetProperty(cForm, cControl, "COL"   )
LOCAL nWIDTH  := GetProperty(cForm, cControl, "WIDTH" )
LOCAL nHEIGHT := GetProperty(cForm, cControl, "HEIGHT")

   hBitmap := BT_BitmapCaptureClientArea( cForm, nRow, nCol, nWidth, nHeight )
   BT_BitmapSaveFile( hBitmap, cFileName, nTypePicture )

   MsgInfo("Save " + cFileName)
RETURN
now i can get Signature and "identify" it and get a Image to store ino Database.
HBINK2.ZIP
(167.14 KiB) Downloaded 144 times
p.s. have made Help File InkObj.chm to get a Overview of MSINKAUT
have fun
Jimmy
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Microsoft INK Regcognizer

Post by edk »

AUGE_OHR wrote: Fri Mar 25, 2022 12:44 am hi,

i try to re-write a Xbase++ Sample to HMG but i have "Problem" with this Syntax

Code: Select all

   aBin := myInkCollector:Ink:Save( IPF_GIF, IPCM_Default )
i try to "split" line

Code: Select all

   oInk := myInkCollector:Ink
   if hb_IsObject(oInk)
      aBin := oInk:Save( IPF_GIF, IPCM_Default )
but still fail ...

---
HI.
Here you have a corrected prg:

Code: Select all

* modyfied by edk
*+--------------------------------------------------------------------
*+
*+ Source Module => c:\hmg.3.4.4\0\INK\\HBINK.PRG
*+
*+    Copyright(C) 1983-2021 by Auge & Ohr
*+
*+    Functions: Procedure MAIN()
*+               Procedure DoInitInk()
*+               Procedure RecognizeInk()
*+               Procedure SaveInk()
*+
*+    Reformatted by Click! 2.05.39 on Mar-25-2022 at  1:09 am
*+
*+--------------------------------------------------------------------

#include "HMG.CH"
#include "fileio.ch"
#include "inksdk.ch"

STATIC myRecognizers
STATIC myInkCollector

MEMVAR _HMG_SYSDATA

*+--------------------------------------------------------------------
*+
*+    Procedure MAIN()
*+
*+--------------------------------------------------------------------
*+
PROCEDURE MAIN

   DEFINE WINDOW InkMain ;
         AT 0, 0 ;
         WIDTH 550 ;
         HEIGHT 350 ;
         TITLE "" ;
         ICON NIL ;
         ON INIT DoInitInk() ;
         ON RELEASE Nil ;
         ON INTERACTIVECLOSE Nil ;
         NOSIZE ;
         NOMAXIMIZE ;
         NOMINIMIZE ;
         ON PAINT Nil ;
         BACKCOLOR { 192, 192, 192 }

#define Use_Label
#ifdef Use_Label
      DEFINE LABEL Label_1
         ROW 10
         COL 15
         WIDTH 500
         HEIGHT 120
         VALUE ""
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "write or draw something"
         VISIBLE .T.
         TRANSPARENT .F.
         ACTION Nil
         AUTOSIZE .F.
         BACKCOLOR Nil
         FONTCOLOR Nil
      END LABEL
#else
      DEFINE IMAGE Image_1
         ROW 10
         COL 15
         WIDTH 500
         HEIGHT 120
         PICTURE nil
         VISIBLE .T.
         //          STRETCH .T.
         ACTION nil
         TRANSPARENT .T.
         BACKGROUNDCOLOR WHITE
         TOOLTIP "write or draw something"
      END IMAGE
#endif
      DEFINE BUTTON Button_Ink
         ROW 134
         COL 15
         WIDTH 230
         HEIGHT 40
         ACTION RecognizeInk()
         CAPTION "&Recognize"
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "Recognize what have input"
         ONGOTFOCUS Nil
         ONLOSTFOCUS Nil
         FLAT .F.
         TABSTOP .T.
         VISIBLE .T.
         TRANSPARENT .F.
         MULTILINE .F.
         PICTURE Nil
         PICTALIGNMENT TOP
      END BUTTON

      DEFINE BUTTON Button_Save
         ROW 134
         COL 285
         WIDTH 230
         HEIGHT 40
         ACTION SaveInk()
         CAPTION "&Save"
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "Save Input to GIF"
         ONGOTFOCUS Nil
         ONLOSTFOCUS Nil
         FLAT .F.
         TABSTOP .T.
         VISIBLE .T.
         TRANSPARENT .F.
         MULTILINE .F.
         PICTURE Nil
         PICTALIGNMENT TOP
      END BUTTON

      DEFINE EDITBOX Edit_1
         ROW 180
         COL 15
         WIDTH 500
         HEIGHT 120
         VALUE ""
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "Result Recognize"
         ONCHANGE Nil
         ONGOTFOCUS Nil
         ONLOSTFOCUS Nil
         TABSTOP .T.
         VISIBLE .T.
         READONLY .F.
         HSCROLLBAR .T.
         VSCROLLBAR .T.
         DISABLEDBACKCOLOR Nil
         DISABLEDFONTCOLOR Nil
         BACKCOLOR Nil
         FONTCOLOR Nil
      END EDITBOX

   END WINDOW

   CENTER WINDOW InkMain
   ACTIVATE WINDOW InkMain

RETURN

*+--------------------------------------------------------------------
*+
*+    Procedure DoInitInk()
*+
*+    Called from ( hbink.prg )   1 - procedure main()
*+
*+--------------------------------------------------------------------
*+
PROCEDURE DoInitInk()

LOCAL nHwnd

#ifdef Use_Label
   nHwnd := GetControlHandle( "Label_1", "InkMain" )
#else
   nHwnd := GetControlHandle( "Image_1", "InkMain" )
#endif

   // Create the recognizers collection
   myRecognizers := CreateObject( "msinkaut.InkRecognizers" )

   // Create a new ink collector that uses the Frame's window
   myInkCollector := CreateObject( "msinkaut.InkCollector" )
   myInkCollector:hWnd := nHwnd

   // Turn the ink collector on
   myInkCollector:Enabled = .T.

RETURN

*+--------------------------------------------------------------------
*+
*+    Procedure RecognizeInk()
*+
*+    Called from ( hbink.prg )   1 - procedure main()
*+
*+--------------------------------------------------------------------
*+
PROCEDURE RecognizeInk()

LOCAL nHwnd   := GetControlHandle( "Edit_1", "InkMain" )
LOCAL cString

   // Check to ensure that the user has at least one recognizer installed
   // Note that this is a preventive check - otherwise, an exception will
   // occur during recognition
   IF 0 == myRecognizers:Count
      MsgInfo( "There are no handwriting recognizers installed." + CRLF + ;
               "You need to have at least one in order to run this sample." )
   ELSE
      // Note that the Strokes' ToString() method is a
      // shortcut  for retrieving the best match using the
      // default recognizer.  The same result can also be
      // obtained using the RecognizerContext.
      //
      cString := myInkCollector:Ink:Strokes:ToString()

      SetProperty( "InkMain", "Edit_1", "Value", cString )

      // If the mouse is pressed, do not perform the recognition -
      // this prevents deleting a stroke that is still being drawn
      
      * ? wrong ? * IF .NOT. myInkCollector:CollectingInk
      IF myInkCollector:CollectingInk
          // Delete the ink from the ink collector
          myInkCollector:Ink:DeleteStrokes( myInkCollector:Ink:Strokes )

          // Force the Frame to redraw (so the deleted ink will go away)
         InvalidateRect( nHwnd, 0 )
      ENDIF
   ENDIF

RETURN

*+--------------------------------------------------------------------
*+
*+    Procedure SaveInk()
*+
*+    Called from ( hbink.prg )   1 - procedure main()
*+
*+--------------------------------------------------------------------
*+
PROCEDURE SaveInk()

LOCAL oInk

   ALTD()
   oInk := myInkCollector:Ink
   
   IF hb_IsObject( oInk )
      IF oInk:Strokes:Count > 0
      	StrFile ( oInk:Save( IPF_GIF, IPCM_Default ), "testfile.gif" )
      ELSE
      	MsgInfo ( "No Strokes" )
      ENDIF
   ELSE
      MsgInfo( "no Ink Object" )
   ENDIF

RETURN

*+ EOF: HBINK.PRG
  1. I think, you used myInkCollector:CollectingInk incorrectly. After recognizing the ink, you deleted the strokes :?:
  2. Before the Save method, get the number of strokes. If there are no strokes then you cannot use this method.
  3. Saving the result of the Save method does not require serialization, you get a pure string of bytes to save.
User avatar
serge_girard
Posts: 3420
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Microsoft INK Regcognizer

Post by serge_girard »

Edward,

missing inksdk.ch ?

Serge
There's nothing you can do that can't be done...
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Microsoft INK Regcognizer

Post by edk »

serge_girard wrote: Tue Mar 29, 2022 8:47 am Edward,

missing inksdk.ch ?

Serge
My code complements the Jimmy's snippet (post viewtopic.php?p=68385#p68385). There you have all the files: https://www.hmgforum.com/download/file.php?id=11211
User avatar
mustafa
Posts: 1177
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Microsoft INK Regcognizer

Post by mustafa »

Hola jimmy :
Felicidades por tu código
He modificado tu código para poder
"Limpiar pantalla" no se si está correcto ?
1-Botón Borra solo Tinta
2-Botón Borra Tinta y Editor

Hay 4 diferentes maneras de Salvar el fichero
==> Gif,Jpg,Png,Bmp en Carpeta ==> Organize

he incorporado un sencillo fichero DBF
para que haga de Contador de los ficheros

Espero que sea de tu aprobación

Un cordial saludo
Mustafa

**************** Google ******************

Hi jimmy :
Congratulations for your code

I have modified your code to be able to
"Clean screen" I don't know if it's correct?
1-Button Erase Ink only
2-Button Erase Ink and Editor

There are 4 different ways to save the file
==> Gif,Jpg,Png,Bmp in Folder ==> Organize

I have incorporated a simple DBF file
to act as file counter

I hope it is of your approval

Cordial greeting
Mustafa
Attachments
HBINK3.ZIP
(26.17 KiB) Downloaded 166 times
User avatar
serge_girard
Posts: 3420
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Microsoft INK Regcognizer

Post by serge_girard »

Hi Mustafa,

Great, that was I also wanted. Did you work on Edward's version?

Serge
There's nothing you can do that can't be done...
User avatar
mustafa
Posts: 1177
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Microsoft INK Regcognizer

Post by mustafa »

hi serge
oui monsieur , je... je...

I'm doing tests
User avatar
mustafa
Posts: 1177
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Microsoft INK Regcognizer

Post by mustafa »

Hi Serge
With the permission of mr. Edward (edk)
here my contribution

Code: Select all

* modyfied by edk
*+--------------------------------------------------------------------
*+
*+ Source Module => c:\hmg.3.4.4\0\INK\\HBINK.PRG
*+
*+    Copyright(C) 1983-2021 by Auge & Ohr
*+
*+    Functions: Procedure MAIN()
*+               Procedure DoInitInk()
*+               Procedure RecognizeInk()
*+               Procedure SaveInk()
*+
*+    Reformatted by Click! 2.05.39 on Mar-25-2022 at  1:09 am
*+
*+--------------------------------------------------------------------

#include "HMG.CH"
#include "fileio.ch"
#include "inksdk.ch"

STATIC numeroQ := 0
STATIC cFileName 
STATIC DirNc , aStruct 

STATIC miras := ".Gif"

STATIC myRecognizers
STATIC myInkCollector

MEMVAR _HMG_SYSDATA

*+--------------------------------------------------------------------
*+
*+    Procedure MAIN()
*+
*+--------------------------------------------------------------------
*+
PROCEDURE MAIN

SET TOOLTIPSTYLE BALLOON 

   DirNc  := HB_Curdrive() +":\"+Rtrim(Curdir() ) + "\"

   IF !HB_DirExists(".\Organize" ) 
           DirMake( ".\Organize" )          
   ENDIF

   DIRCHANGE( DirNc ) 

   IF ! FILE("CapNum.dbf")  
        Contador_1()
   ENDIF

   DEFINE WINDOW InkMain  ;
         AT 0, 0          ;
         WIDTH  537       ;
         HEIGHT 430       ; 
         TITLE ""         ;
         ICON NIL         ;
         ON INIT DoInitInk() ;      
         ON RELEASE Nil   ;
         ON INTERACTIVECLOSE Nil ;
         NOSIZE           ;
         NOMAXIMIZE       ;
         NOMINIMIZE       ;
         ON PAINT Nil     ;
         BACKCOLOR { 192, 192, 192 }

         ON KEY ESCAPE ACTION  ThisWindow.Release 

#define Use_Label
#ifdef Use_Label
      DEFINE LABEL Label_1
         ROW 10
         COL 15
         WIDTH 500
         HEIGHT 120
         VALUE ""
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "write or draw something"
         VISIBLE .T.
         TRANSPARENT .F.
         ACTION Nil
         AUTOSIZE .F.
         BACKCOLOR Nil
         FONTCOLOR Nil
      END LABEL
#else
      DEFINE IMAGE Image_1
         ROW 10
         COL 15
         WIDTH 500
         HEIGHT 120
         PICTURE nil
         VISIBLE .T.
         //          STRETCH .T.
         ACTION nil
         TRANSPARENT .T.
         BACKGROUNDCOLOR WHITE
         TOOLTIP "write or draw something"
      END IMAGE
#endif

      DEFINE RADIOGROUP Radio_1
         ROW   136 
         COL   150                                 
         OPTIONS   { 'Gif','Jpg','Png','Bmp' }   
         BACKCOLOR { 192, 192, 192 }                  
         VALUE 1 
         WIDTH 110
         FONTNAME "Arial"
         FONTSIZE 10
         TOOLTIP '' 
         HORIZONTAL .T.
         SPACING 055 
         ONCHANGE Busca_Format()
     END RADIOGROUP

      DEFINE BUTTON Button_Ink
         ROW 167 
         COL 15
         WIDTH 232
         HEIGHT 40
         ACTION RecognizeInk()
         CAPTION "&Regcognize"
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "Regcognize what have input"
         ONGOTFOCUS Nil
         ONLOSTFOCUS Nil
         FLAT .F.
         TABSTOP .T.
         VISIBLE .T.
         TRANSPARENT .F.
         MULTILINE .F.
         PICTURE Nil
         PICTALIGNMENT TOP
      END BUTTON

      DEFINE BUTTON Button_Save
         ROW 167  
         COL 283
         WIDTH 232
         HEIGHT 40
         ACTION SaveInk()
         CAPTION "&Save"
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "Save Input to GIF"
         ONGOTFOCUS Nil
         ONLOSTFOCUS Nil
         FLAT .F.
         TABSTOP .T.
         VISIBLE .T.
         TRANSPARENT .F.
         MULTILINE .F.
         PICTURE Nil
         PICTALIGNMENT TOP
      END BUTTON
    

      DEFINE EDITBOX Edit_1
         ROW   216  
         COL   15
         WIDTH 500
         HEIGHT 120
         VALUE ""
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "Result Regcognize"
         ONCHANGE Nil
         ONGOTFOCUS Nil
         ONLOSTFOCUS Nil
         TABSTOP .T.
         VISIBLE .T.
         READONLY .F.
         HSCROLLBAR .T.
         VSCROLLBAR .T.
         DISABLEDBACKCOLOR Nil
         DISABLEDFONTCOLOR Nil
         BACKCOLOR Nil
         FONTCOLOR Nil
      END EDITBOX

      DEFINE BUTTON Button_Clea1
         ROW   346 
         COL   015
         WIDTH 111 
         HEIGHT 40
         ACTION Cleaner1()
         CAPTION "&Cleaner-1"
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "Clean Ink Only"
         ONGOTFOCUS Nil
         ONLOSTFOCUS Nil
         FLAT .F.
         TABSTOP .T.
         VISIBLE .T.
         TRANSPARENT .F.
         MULTILINE .F.
         PICTURE Nil
         PICTALIGNMENT TOP
      END BUTTON

     DEFINE BUTTON Button_Clea2
         ROW   346  
         COL   136  
         WIDTH 111 
         HEIGHT 40
         ACTION Cleaner2()
         CAPTION "&Cleaner-2"
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "Cleaner Ink and Editor"
         ONGOTFOCUS Nil
         ONLOSTFOCUS Nil
         FLAT .F.
         TABSTOP .T.
         VISIBLE .T.
         TRANSPARENT .F.
         MULTILINE .F.
         PICTURE Nil
         PICTALIGNMENT TOP
      END BUTTON

      DEFINE BUTTON Button_Exit
         ROW 346 
         COL 283
         WIDTH 232
         HEIGHT 40
         ACTION ThisWindow.Release 
         CAPTION "&Exit"
         FONTNAME "Arial"
         FONTSIZE 12
         TOOLTIP "Exit"
         ONGOTFOCUS Nil
         ONLOSTFOCUS Nil
         FLAT .F.
         TABSTOP .T.
         VISIBLE .T.
         TRANSPARENT .F.
         MULTILINE .F.
         PICTURE Nil
         PICTALIGNMENT TOP
      END BUTTON
      
   END WINDOW

   CENTER WINDOW InkMain
   ACTIVATE WINDOW InkMain

RETURN

*+--------------------------------------------------------------------
*+
*+    Procedure DoInitInk()
*+
*+    Called from ( hbink.prg )   1 - procedure main()
*+
*+--------------------------------------------------------------------
*+
PROCEDURE DoInitInk()

LOCAL nHwnd

#ifdef Use_Label
   nHwnd := GetControlHandle( "Label_1", "InkMain" )
#else
   nHwnd := GetControlHandle( "Image_1", "InkMain" )
#endif

   // Create the recognizers collection
   myRecognizers := CreateObject( "msinkaut.InkRecognizers" )

   // Create a new ink collector that uses the Frame's window
   myInkCollector := CreateObject( "msinkaut.InkCollector" )
   myInkCollector:hWnd := nHwnd

   // Turn the ink collector on
   myInkCollector:Enabled = .T.

RETURN

*+--------------------------------------------------------------------
*+
*+    Procedure RecognizeInk()
*+
*+    Called from ( hbink.prg )   1 - procedure main()
*+
*+--------------------------------------------------------------------
*+
PROCEDURE RecognizeInk()

LOCAL nHwnd   := GetControlHandle( "Edit_1", "InkMain" )
LOCAL cString

   // Check to ensure that the user has at least one recognizer installed
   // Note that this is a preventive check - otherwise, an exception will
   // occur during recognition
   IF 0 == myRecognizers:Count
      MsgInfo( "There are no handwriting recognizers installed." + CRLF + ;
               "You need to have at least one in order to run this sample." )
   ELSE
      // Note that the Strokes' ToString() method is a
      // shortcut  for retrieving the best match using the
      // default recognizer.  The same result can also be
      // obtained using the RecognizerContext.
      //
      cString := myInkCollector:Ink:Strokes:ToString()

      SetProperty( "InkMain", "Edit_1", "Value", cString )

      // If the mouse is pressed, do not perform the recognition -
      // this prevents deleting a stroke that is still being drawn
      
      * ? wrong ? * IF .NOT. myInkCollector:CollectingInk
      IF myInkCollector:CollectingInk
          // Delete the ink from the ink collector
          myInkCollector:Ink:DeleteStrokes( myInkCollector:Ink:Strokes )

          // Force the Frame to redraw (so the deleted ink will go away)
         InvalidateRect( nHwnd, 0 )
      ENDIF
   ENDIF

RETURN

*+--------------------------------------------------------------------
*+
*+    Procedure SaveInk()
*+
*+    Called from ( hbink.prg )   1 - procedure main()
*+
*+--------------------------------------------------------------------
*+


PROCEDURE SaveInk()

LOCAL oInk

  Contador_2()

   ALTD()
   oInk := myInkCollector:Ink
   
   IF hb_IsObject( oInk )
      IF oInk:Strokes:Count > 0
              StrFile ( oInk:Save( IPF_GIF, IPCM_Default ), cFileName  )  

  MsgInfo("Save " + cFileName)

  dbCloseAll()
  SELECT 1
  USE CapNum
  UNLOCK ALL
  IF CAPNUM->REC1  == 99999
     CapNum->( FLOCK() )

  IF CapNum->( RLOCK() )
     REPLACE CAPNUM->REC1 WITH 1 
     REPLACE CAPNUM->REC2 WITH ALLTRIM( STRZERO( CAPNUM->REC1  ,5 ) )  
     REPLACE CAPNUM->DATE WITH DATE()  
     REPLACE CAPNUM->HORA WITH TIME() 
     CapNum->( dbCOMMIT() )
  ENDIF
  UNLOCK ALL

  ELSE

  CapNum->( FLOCK() )
  IF CapNum->( RLOCK() )
     REPLACE CAPNUM->REC1 WITH CAPNUM->REC1  + 1 
     REPLACE CAPNUM->REC2 WITH ALLTRIM( STRZERO( CAPNUM->REC1  ,5 ) )  
     REPLACE CAPNUM->DATE WITH DATE()  
     REPLACE CAPNUM->HORA WITH TIME() 
     CapNum->( dbCOMMIT() )
  ENDIF
  UNLOCK ALL

  ENDIF

      ELSE
      	MsgInfo ( "No Strokes" )
      ENDIF
   ELSE
      MsgInfo( "no Ink Object" )
   ENDIF

RETURN

*+ EOF: HBINK.PRG


*----------------------------------------------*
PROCEDURE Cleaner1()
*----------------------------------------------*

 LOCAL cString

 DoInitInk()
 InkMain.Label_1.Value := " "

 cString := myInkCollector:Ink:Strokes:ToString()
 SetProperty( "InkMain", "Label_1", "Value", cString )

Return 

*----------------------------------------------*
PROCEDURE Cleaner2()
*----------------------------------------------*

 LOCAL cString

 DoInitInk()
 RecognizeInk()

 InkMain.Label_1.Value := " "

 cString := myInkCollector:Ink:Strokes:ToString()
 SetProperty( "InkMain", "Label_1", "Value", cString )

Return 

*----------------------------------------------*
PROCEDURE Contador_1()
*----------------------------------------------*

   aStruct := { ;
  { "REC1"      , "N", 5, 0 }, ;
  { "REC2"      , "C", 5, 0 }, ;
  { "DATE"      , "D", 8, 0 }, ;
  { "HORA"      , "C", 8, 0 }  ;
  }

  DbCreate( "CapNum", aStruct, .T. )

   dbCloseAll()  
   SELECT 1
   USE CapNum
   UNLOCK ALL
   CapNum->( FLOCK() )
   IF CapNum->( RLOCK() )
      ZAP
      dbAppend()
      REPLACE CAPNUM->REC1 WITH 1   
      REPLACE CAPNUM->REC2 WITH STRZERO( CAPNUM->REC1 ,5)      
      REPLACE CAPNUM->DATE WITH DATE()  
      REPLACE CAPNUM->HORA WITH TIME() 
      CapNum->( dbCOMMIT() )
   ENDIF

   UNLOCK ALL

   numeroQ   :=  ALLTRIM( CAPNUM->REC2 )
  
   cFileName := "Organize\" + numeroQ + miraS 


Return  


*----------------------------------------------*
PROCEDURE Contador_2()
*----------------------------------------------*

   UNLOCK ALL
   SELECT 1
   USE CapNum
   dbGoTop()

   IF CAPNUM->REC1 == 0
      dbCloseAll()
      FileDelete("CapNum.dbf")
      Contador_1()
   ENDIF

   numeroQ   :=  ALLTRIM( CAPNUM->REC2 )

   cFileName := "Organize\"+ numeroQ + miraS                  


Return 


*---------------------------------------------------------*
 FUNCTION Busca_Format()
*---------------------------------------------------------*

DO CASE 

CASE InkMain.Radio_1.Value == 1
     miraS := ALLTRIM('.Gif')
  
CASE InkMain.Radio_1.Value == 2
     miraS := ALLTRIM('.Jpg')

CASE InkMain.Radio_1.Value == 3
     miraS := ALLTRIM('.Png')

CASE InkMain.Radio_1.Value == 4
     miraS := ALLTRIM('.Bmp')
 
OTHERWISE

ENDCASE

RETURN(.F.)

Regards, Regards, Salam :lol: :D

Mustafa
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Microsoft INK Regcognizer

Post by AUGE_OHR »

hi Edward,

Thx for your Comment.

i have upload INK Sample while i had Problem to "save" Image which work under Xbase++
Sample is "just" a Part of much bigger Project which will include Codepage to recognize more than English Words

Note : under Xbase++ i have Problem when use Chinese Sign with DBCS

---

@Mustafa

Thx for upload
have fun
Jimmy
Post Reply