by cuatecatl82 » Tue Nov 24, 2015 2:30 pm
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 Expand view
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 Expand view
/*
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..