Now Animation curosor.ani working with FWH

Post Reply
User avatar
HATHAL
Posts: 77
Joined: Tue Nov 15, 2005 3:38 pm
Location: The Kingdom Saudi Arabia -Riyadh
Contact:

Now Animation curosor.ani working with FWH

Post by HATHAL »

Code: Select all

[code=fw]Now Animation curosor.ani working with FWH
Full Source 
You need to download ANY  file *.ani From the site http://www.rw-designer.com/cursor-set/stickman
AND Rename File In test.rc To Your New File Name
update 2012-5-25
add load cursor from file *.ani  without file.rc 
********************
Do you have something like this
  If you like the source if I delete it!
Greetings
hathal.
********************* full source *********************************
file 1
******
****************
/*
 anicur.ch  command
 TO USE Cursor Animation  "curosor.ani"
 BY HATHAL 2012-5-25
 www.livesystem.net
*/
#xcommand DEFINE ANI CURSOR <oCursor> ;
             [ <resource: RESOURCE, RESNAME, NAME> <cResName> ] ;
        => ;
          <oCursor> := TAniCursor():New( <cResName>)
******************************************************           
#xcommand DEFINE ANI CURSOR <oCursor> ;
             [ <file:FILE,FILENAME,DISK> <cAnifile> ] ;
        => ;
                  <oCursor> := TAniCursor():Anifile( <cAnifile>)         
**********************
**********************
file 2
******
******
/*
 anicur.PRG  class + c source
 TO USE Cursor Animation "curosor.ani"
 BY HATHAL 2012-5-25
 www.livesystem.net
*/
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
CLASS TAniCursor
   DATA   hCursor
   METHOD New( cResName)  CONSTRUCTOR
   METHOD Anifile(cAnifile)  CONSTRUCTOR
   METHOD End() INLINE If( ::hCursor != 0,::hCursor := 0,) 
ENDCLASS

//----------------------------------------------------------------------------//

METHOD New( cResName ) CLASS TAniCursor
       ::hCursor := LOAD_ANI_CURSOR( GetResources(), cResName )  
return Self
METHOD Anifile(cAnifile) CLASS TAniCursor
if File(cAnifile)=.t.
       ::hCursor := LO_ANI_CU_FILE(cAnifile)
       else
       ::hCursor:=0
       endif
 return Self

//----------------------------------------------------------------------------//
************************************************************
 #pragma BEGINDUMP
// ********************************
#include "windows.h"
#include "hbapiitm.h"
#include "hbvm.h"
#include "hbstack.h"
#include "item.api"
#include "hbpcode.h" 
#include "hbvmpub.h"
#define IF(x,y,z) ((x)?(y):(z))
#include "hbinit.h"
HINSTANCE GetInstance( void );
//----------------------------------------------------------------------------//
HB_FUNC (LO_ANI_CU_FILE)
{
       HCURSOR  H_ani_cursor;
        H_ani_cursor=LoadCursorFromFile(hb_parc( 1 ));
  hb_retnl( ( LONG ) H_ani_cursor );
}
HB_FUNC (  LOAD_ANI_CURSOR )
{
       HRSRC H_Res;
       DWORD D_wSize;
       HGLOBAL H_Glob;
       LPBYTE P_Bytes;
       HINSTANCE H_Inst;
       HCURSOR  H_ani_cursor;
       H_Inst=( HINSTANCE ) hb_parnl( 1 );
       H_Res=FindResource(H_Inst,IF( ISCHAR( 2 ), hb_parc( 2 ),( LPSTR ) MAKEINTRESOURCE( hb_parnl( 2 ) ) ),"ANICURSORS");
        D_wSize=SizeofResource(H_Inst,H_Res);
       H_Glob=LoadResource(H_Inst,H_Res);
       P_Bytes=(LPBYTE)LockResource(H_Glob); 
       H_ani_cursor=CreateIconFromResource(P_Bytes,D_wSize,FALSE,0x00030000);
 hb_retnl( ( LONG ) H_ani_cursor );
 }
 #pragma ENDDUMP
*************************************
*************************************
file 4
*******
  // test.prg
#include "FiveWin.ch"
#include "anicur.ch"
Set Procedure To anicur.PRG
/*
 TEST.PRG
 TO USE Cursor Animation  "curosor.ani"
 BY HATHAL 2012-5-25
 www.livesystem.net
  */
function Main()
   local oWnd,ani_cursor
    DEFINE ANI CURSOR ani_cursor FILE "earth_w.ani" 
//  DEFINE ANI CURSOR ani_cursor RESOURCE "ID_ANI_CUR1"
      DEFINE WINDOW oWnd FROM 5, 5 TO 20, 60 ;
      TITLE "testing move curosor by hathal " ;
       CURSOR ani_cursor 
   ACTIVATE WINDOW oWnd 
return nil
// ***********************************************
file 5
******
test.rc
ID_ANI_CUR1        ANICURSORS   "SPACE.ani"
/*
  // DOWNLOAD ANY CUROSOR *.ANI FROM http://www.rw-designer.com/cursor-set/stickman
  */
 
[/code]
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: Now Animation curosor.ani working with FWH

Post by richard-service »

Nice job.
Regards,

Richard

Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
User avatar
Raymundo Islas M.
Posts: 590
Joined: Tue Mar 14, 2006 11:34 pm
Location: Acapulco, Gro. MEXICO

Re: Now Animation curosor.ani working with FWH

Post by Raymundo Islas M. »

Hathal,

Fantastic !!

I wonder if it is possible to switch from animated cursor to "regular" one and viceversa.
Right now, when I know the procedure to achieve it's gonna take several seconds I change the normal (pointer) cursor to busy (spinning) and when it finish I switch back to normal again.

Thanks a lot

Best regards
FWH 10.6 + xHarbour + Borland 582
User avatar
HATHAL
Posts: 77
Joined: Tue Nov 15, 2005 3:38 pm
Location: The Kingdom Saudi Arabia -Riyadh
Contact:

Re: Now Animation curosor.ani working with FWH

Post by HATHAL »

Code: Select all

This function 
Can deal with the cursor. 
Use it to return to *.cur
ani_cursor=: LO_ANI_CU_FILE("file.cur" ) // from file
Or 
ani_cursor=:LOAD_ANI_CURSOR("ID_CUR") //from  RESOURCE 
sysrefresh()
Reason for the delay in the presentation of the index due to the reduced load image layers layers
There are many free programs for making file. Ani
Regards,
HATHAL
User avatar
cuatecatl82
Posts: 614
Joined: Wed Mar 14, 2007 6:49 pm
Location: San Cristobal de las Casas, Chiapas México
Contact:

Re: Now Animation curosor.ani working with FWH

Post by cuatecatl82 »

Greetings:

In my code show error at execute anicursor from resource, if execute the sample fron anicursor fron file not problem, but fron resource is crash:

DEFINE ANI CURSOR oAni RESOURCE "AERO"

Code: Select all

Application Internal Error - Z:\Pruebas\TAniCursor\Prueba.Exe
Terminated at: 2015-11-24 08:19:20
Unrecoverable error 6005: Exception error:

    Exception Code:C0000005 ACCESS_VIOLATION
    Exception Address:7E39D392
    EAX:00000020  EBX:00000020  ECX:00000000  EDX:00000050
    ESI:00000000  EDI:00008040  EBP:0012FC94
    CS:EIP:001B:7E39D392  SS:ESP:0023:0012FC88
    DS:0023  ES:0023  FS:003B  GS:0000
    Flags:00010246
    Exception Parameters: 00000000 00000000
    CS:EIP: 81 39 52 49 46 46 57 50 53 0F 84 CA 79 02 00 FF
    SS:ESP: 00000000 00000000 00400000 0012FCB8 7E3D7153 00000000 00000000 00000000 00030000 00000000 00000000 00008040 0012FCF4 004014AF 00000000 00000000

    C stack:
    EIP:     EBP:       Frame: OldEBP, RetAddr, Params...
    7E39D392 0012FC94   0012FCB8 7E3D7153 00000000 00000000 00000000 00030000 00000000 00000000 00008040
    7E3D7153 0012FCB8   0012FCF4 004014AF 00000000 00000000 00000000 00030000 0054F2C1 00000000 006CD738 0045AC10
    004014AF 0012FCF4   0012FE08 00454A9E 00000002 0054F550 00000000 0054F444 006CD738 00000000 00000000 0012FD54
    00454A9E 0012FE08   0012FE34 00401404 0054F2AD 0054F000 0045ADCD 006CD738 00000001 00000000 00C34424 00030004
    00401404 0012FE34   0012FF48 00454B5C 00000001 00320036 00000001 00558034 00003570 005585E0 00C3AE6C 006CDAA4
    00454B5C 0012FF48   0012FF70 004014EC 0054F538 0054F434 0045AC10 00000000 00000000 00000000 00000000 00000012
    004014EC 0012FF70   0012FF84 00453D73 00000000 0054F6F8 0014238B
    00453D73 0012FF84   0012FF90 0048521A 00000001
    0048521A 0012FF90   0012FFB8 00512E0E 00400000 00000000 0014238B 00000005 00360037 7FFDD000 0012FFE0 00513EFC
    00512E0E 0012FFB8   0012FFF0 00000000 0054F6F8 7C817067 00320036 00360037 7FFDD000 C0000005 0012FFC8 0012F8AC


Modules:
00400000 0030C000 Z:\Pruebas\TAniCursor\Prueba.Exe
7C910000 000B5000 C:\WINDOWS\system32\ntdll.dll
7C800000 00103000 C:\WINDOWS\system32\kernel32.dll
77DA0000 000AC000 C:\WINDOWS\system32\ADVAPI32.DLL
77E50000 00092000 C:\WINDOWS\system32\RPCRT4.dll
77FC0000 00011000 C:\WINDOWS\system32\Secur32.dll
72F80000 00026000 C:\WINDOWS\system32\WINSPOOL.DRV
77EF0000 00049000 C:\WINDOWS\system32\GDI32.dll
7E390000 00091000 C:\WINDOWS\system32\USER32.dll
77BE0000 00058000 C:\WINDOWS\system32\msvcrt.dll
58C30000 0009A000 C:\WINDOWS\system32\COMCTL32.DLL
76360000 0004A000 C:\WINDOWS\system32\COMDLG32.DLL
7E6A0000 00821000 C:\WINDOWS\system32\SHELL32.dll
77F40000 00076000 C:\WINDOWS\system32\SHLWAPI.dll
76330000 00005000 C:\WINDOWS\system32\MSIMG32.DLL
774B0000 0013D000 C:\WINDOWS\system32\OLE32.DLL
770F0000 0008B000 C:\WINDOWS\system32\OLEAUT32.DLL
4EBA0000 001A6000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.2600.5512_x-ww_dfb54e0c\GDIPLUS.DLL
773A0000 00103000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll
5B150000 00038000 C:\WINDOWS\system32\UxTheme.dll

Called from LOAD_ANI_CURSOR(0)
Called from TANICURSOR:NEW(27) in TAniCur.prg
Called from MAIN(18) in Prueba.prg
------------------------------------------------------------------------
 

Code: Select all

/*
 anicur.PRG  class + c source
 TO USE Cursor Animation "curosor.ani"
 BY HATHAL 2012-5-25
 www.livesystem.net
*/

#Include "FiveWin.ch"



//----------------------------------------------------------------------------//
CLASS TAniCursor

   DATA   hCursor
   METHOD New(cResName)  CONSTRUCTOR
   METHOD Anifile(cAnifile)  CONSTRUCTOR
   METHOD END() INLINE IF( ::hCursor != 0,::hCursor := 0,)
   
ENDCLASS



//----------------------------------------------------------------------------//

METHOD New( cResName ) CLASS TAniCursor
       ::hCursor := LOAD_ANI_CURSOR( GetResources(), cResName )  
RETURN Self



//----------------------------------------------------------------------------//
METHOD Anifile(cAnifile) CLASS TAniCursor

   IF FILE(cAnifile)=.t.
       ::hCursor := LO_ANI_CU_FILE(cAnifile)
 ELSE
       ::hCursor:= 0
ENDIF

 RETURN Self



//----------------------------------------------------------------------------//



#pragma BEGINDUMP

#include "windows.h"
#include "hbapiitm.h"
#include "hbvm.h"
#include "hbstack.h"
#include "item.api"
#include "hbpcode.h"
#include "hbvmpub.h"
#define IF(x,y,z) ((x)?(y):(z))
#include "hbinit.h"



HINSTANCE GetInstance( VOID );
//----------------------------------------------------------------------------//
HB_FUNC (LO_ANI_CU_FILE)
{
       HCURSOR  H_ani_cursor;
        H_ani_cursor=LoadCursorFromFile(hb_parc( 1 ));
  hb_retnl( ( LONG ) H_ani_cursor );
}
HB_FUNC (  LOAD_ANI_CURSOR )
{
       HRSRC H_Res;
       DWORD D_wSize;
       HGLOBAL H_Glob;
       LPBYTE P_Bytes;
       HINSTANCE H_Inst;
       HCURSOR  H_ani_cursor;
       H_Inst=( HINSTANCE ) hb_parnl( 1 );
       H_Res=FindResource(H_Inst,IF( HB_ISCHAR( 2 ), hb_parc( 2 ),( LPSTR ) MAKEINTRESOURCE( hb_parnl( 2 ) ) ),"ANICURSORS");
        D_wSize=SizeofResource(H_Inst,H_Res);
       H_Glob=LoadResource(H_Inst,H_Res);
       P_Bytes=(LPBYTE)LockResource(H_Glob);
       H_ani_cursor=CreateIconFromResource(P_Bytes,D_wSize,FALSE,0x00030000);
 hb_retnl( ( LONG ) H_ani_cursor );
}
 
#pragma ENDDUMP
The unique change in the original code is: ISCHAR() to HB_ISCHAR()


Any idea..?

Thankyou..
Soluciones y Diseño de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Diseñador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Now Animation curosor.ani working with FWH

Post by Antonio Linares »

Victor,

Pruébalo asi:

Code: Select all

#include <windows.h>


HB_FUNC (  LOAD_ANI_CURSOR )
{
       HRSRC H_Res;
       DWORD D_wSize;
       HGLOBAL H_Glob;
       LPBYTE P_Bytes;
       HINSTANCE H_Inst;
       HCURSOR  H_ani_cursor;
       H_Inst=( HINSTANCE ) hb_parnl( 1 );
       H_Res=FindResource(H_Inst,IF( HB_ISCHAR( 2 ), hb_parc( 2 ),( LPSTR ) MAKEINTRESOURCE( hb_parnl( 2 ) ) ),"ANICURSORS");

       if( H_Res )
       { 
          D_wSize=SizeofResource(H_Inst,H_Res);
          H_Glob=LoadResource(H_Inst,H_Res);
          P_Bytes=(LPBYTE)LockResource(H_Glob);
          H_ani_cursor=CreateIconFromResource(P_Bytes,D_wSize,FALSE,0x00030000);
          hb_retnl( ( LONG ) H_ani_cursor );
       } 
       else
       {
          MessageBox( 0, "resource not found", "error", 0 );
          hb_retnl( 0 );
       }
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
horacio
Posts: 1270
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Now Animation curosor.ani working with FWH

Post by horacio »

He probado la solución de Antonio para cursores desde recursos pero me dice que no lo encuentra. Y el recurso se encuentra definido. Uso Pelles-C

Saludos
Post Reply