Canal5 Calendar

Randal
Posts: 250
Joined: Mon Oct 24, 2005 8:04 pm

Canal5 Calendar

Post by Randal »

All,

I've been using Canal5 calendar for years. Using xharbour commercial and just upgraded to last fwh. Everything compiles fine. I can call up he calendar however, as soon as I move the mouse over the calendar control it crashes. I have all the source, 4 .prg's and one .c file.

I'm not a C programmer and I was wondering if anyone saw anything about the .c source that may cause a problem.

#include <hbapi.h>
#include <windows.h>

BOOL WINAPI StretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);

HB_FUNC( COMPATDC ) // ( hDC )
{
hb_retnl( ( LONG ) CreateCompatibleDC( ( HDC ) hb_parnl( 1 ) ) );
// hb_retni( CreateCompatibleDC( hb_parnl( 1 ) ) );

}


HB_FUNC( COMPATBMP ) // ( hDC, nWidth, nHeight )
{

hb_retnl( (LONG) CreateCompatibleBitmap( (HDC) hb_parnl(1),hb_parni(2), hb_parni(3) ) );

}


HB_FUNC( BITBLT ) // ( hdcDest, nXDest, nYDest, nWidth, nHeight,hdcSrc, nXSrc , nYSrc, dwRop )
{
hb_retl( BitBlt( ( HDC ) hb_parnl( 1 ), hb_parni( 2 ), hb_parni( 3 ),
hb_parni( 4 ), hb_parni( 5 ), ( HDC ) hb_parnl( 6 ),
hb_parni( 7 ), hb_parni( 8 ), hb_parnl( 9 ) ) );
}



HB_FUNC( STRETCHBLT )
{
hb_retl(StretchBlt( ( HDC ) hb_parnl(1),hb_parni(2),hb_parni(3),hb_parni(4),hb_parni(5),
( HDC ) hb_parnl(6),hb_parni(7),hb_parni(8),hb_parni(9),hb_parni(10),
hb_parni(11)));
}




Thanks,
Randal
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Post by Silvio.Falconi »

Also I use calendar,Banner and other Canalfive controls
wich error you have ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Randal
Posts: 250
Joined: Mon Oct 24, 2005 8:04 pm

Re: Canal5 Calendar

Post by Randal »

Silvio:

Thank you for your reply. I can compile and display the calendar however, I get GPF as soon as I move the mouse over the calendar control. It must be some kind of paint problem. This worked fine until this FWH upgrade. The other source that might be a culprit is c5bmp.prg.

Do you have the source? How does your .c file compare to mine?

Do you have the source for c5bmp.prg?

Thanks,
Randal
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Post by Silvio.Falconi »

I not modified c5Bmp.prg
to build calendar.lib you must have :
c5Bmp.prg
c5fun.prg
c5tip.prg
c5hb.c
calendar.prg

c5hb.c

Code: Select all

#include <hbapi.h>
#include <windows.h>



BOOL    WINAPI StretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);

HB_FUNC( COMPATDC ) // ( hDC )
{
   hb_retnl( ( LONG ) CreateCompatibleDC( ( HDC ) hb_parnl( 1 ) ) );
   // hb_retni( CreateCompatibleDC( hb_parnl( 1 ) ) );

}


HB_FUNC( COMPATBMP ) // ( hDC, nWidth, nHeight )
{

    hb_retnl( (LONG) CreateCompatibleBitmap( (HDC) hb_parnl(1),hb_parni(2), hb_parni(3) ) );

}


HB_FUNC( BITBLT ) // ( hdcDest, nXDest, nYDest, nWidth, nHeight,hdcSrc,  nXSrc , nYSrc, dwRop )
{
     hb_retl( BitBlt( ( HDC ) hb_parnl( 1 ), hb_parni( 2 ), hb_parni( 3 ),
                  hb_parni( 4 ), hb_parni( 5 ), ( HDC ) hb_parnl( 6 ),
                  hb_parni( 7 ), hb_parni( 8 ), hb_parnl( 9 ) ) );
}



HB_FUNC( STRETCHBLT )
{
   hb_retl(StretchBlt( ( HDC ) hb_parnl(1),hb_parni(2),hb_parni(3),hb_parni(4),hb_parni(5),
                     ( HDC ) hb_parnl(6),hb_parni(7),hb_parni(8),hb_parni(9),hb_parni(10),
                     hb_parni(11)));


}
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Randal
Posts: 250
Joined: Mon Oct 24, 2005 8:04 pm

Re: Canal5 Calendar

Post by Randal »

Silvio:

Your source for C5hb.c is the same as mine. I do have all the other source files however, I don't create a lib I just include the .prg's in my project.

Are you using xharbour?

Randal
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Post by Silvio.Falconi »

Yes i use xharbour but it run also with harbour
I use bcc7 and last fwh
I use xmate to compile exe dl and lib no problem
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Randal
Posts: 250
Joined: Mon Oct 24, 2005 8:04 pm

Re: Canal5 Calendar

Post by Randal »

Silvio:

Well, just to let you know I tracked it down to a problem with c5tip. The CheckToolTip method in windows.prg references a member named :lShowAgain which is not a member of the c5tip class. So I added it. Then the CheckToolTip method calls ::ToolTip:Show(). The c5tip show method takes hWnd, nRow, nCol as parameters, which windows.prg does not pass. Both of these problems caused the program to gpf.

This is the Show method from my c5tip source. You must have an updated source.

******************************************
METHOD Show( nRow, nCol, cPrompt, oWnd )
******************************************

Local n
Local aPoint := { nRow, nCol }
Local aAux, nMaxLen
Local nHeight
Local nWidth
Local nHScreen := GetSysMetrics( 1 )
Local nWScreen := GetSysMetrics( 0 )
Local nLines

if ::lVisible
::Hide()
endif

if cPrompt != nil
::cPrompt := cPrompt
aAux := ::MaxLen( cPrompt )
nMaxLen := aAux[1]
nLines := aAux[2]
nWidth := nMaxLen + 4
nHeight := ( nLines * ::nHRow ) + 2
endif

ClientToScreen( oWnd:hWnd, aPoint ) // CRASHES HERE BECAUSE oWn:hWnd is nil and apoint is empty.
if aPoint[ 1 ] == nRow
aPoint := ClientToScreen( oWnd:hWnd, aPoint )
endif

nRow := aPoint[ 1 ]
nCol := aPoint[ 2 ]

if nRow + nHeight > nHScreen
nRow := nHScreen - nHeight - 10
endif

if nCol + nWidth > nWScreen
nCol := nWScreen - nWidth - 10
endif

::Move( nRow, nCol, nWidth, nHeight , .t. )

Super:Show()

::lVisible := .t.

Return nil

I don't use tooltips on my calendar so I'm just returning nil from this method. Thanks again for your help.

Randal
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Post by Silvio.Falconi »

you must not compile c5tip you have allready TC5ToolTip class on Fwh

method default of c5calendar

if ::oTooltip == nil
// ::oToolTip := TC5Tip():New(Self )
::oToolTip := TC5ToolTip():New( 0, 0, 1, 5, Self, .f., CLR_WHITE, RGB(228,229,240), RGB(100,100,100), 2, 2 )
endif

METHOD MouseMove( nRow, nCol, nKeyFlags ) of c5calendar

found these lines

if ::lTooltips
if ::oToolTip != nil
::oToolTip:Show( nBottom - 6, nRight - 6, ::acTooltips[ nDia ], Self )


and paste these

if ::lTooltips
if ::oToolTip != nil
// ::oToolTip:Show( nBottom - 6, nRight - 6, ::acTooltips[ nDia ], Self )
::oToolTip:cHeader := "Calendar"
::oToolTip:cBody := ::acTooltips[ nDia ]
::oToolTip:Move(nTop, nLeft,nBottom - 6, nRight - 6, .f. )
::oToolTip:cFoot :="Fwh Power"
::oToolTip:Default()
::oToolTip:Show()
hToolTip = ::oToolTip:hWnd



here run ok


Image
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Post by Silvio.Falconi »

good this :

local a, aPos
---
a := ::oTooltip:GetSize()
aPos = { nRow, nCol }
aPos := ClientToScreen( ::hWnd, aPos )

if aPos[2]+a[1] > GetSysMetrics(1)
aPos[2] := GetSysMetrics(0) - a[1] - 20
endif

::oToolTip:cHeader := nil//"Calendar"
::oToolTip:cBody := ::acTooltips[ nDia ]
::oToolTip:cFoot :=nil //"Fwh Power"
*::oToolTip:Move(nTop, nLeft,nBottom , nRight , .t. )
::oToolTip:Move( aPos[1], aPos[2],a[1],a[2], .f. )
::oToolTip:Default()
::oToolTip:Show()

hToolTip = ::oToolTip:hWnd
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Randal
Posts: 250
Joined: Mon Oct 24, 2005 8:04 pm

Re: Canal5 Calendar

Post by Randal »

Silvio:

I didn't realize I could just use the c5tooltip class included with FWH. Thanks for the sample code.

Randal
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Post by Silvio.Falconi »

I not understood what you cannot realize ?
I sad you the oldest c5tip class of paco is no compatible with c5calendar if you use fwh last version.(2017) because fwh have a c5tioltip class changed by fivetech.

To use c5calendar you must modify the class as i wrote.
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Randal
Posts: 250
Joined: Mon Oct 24, 2005 8:04 pm

Re: Canal5 Calendar

Post by Randal »

Silvio:

I'm sorry for the miscommunication. What I mean is I did not realize I could use the fwh c5tooltip class until you showed me that. I got it all working, thank you very much helping me get this fixed and for the sample code.

Best Regards,
Randal
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Canal5 Calendar

Post by Enrico Maria Giordano »

Silvio,

"I didn't realize" means "I didn't understand".

In italiano: "non avevo realizzato che...", nel senso di "non avevo capito che...", "non mi ero reso conto che...".

:-)

EMG
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Post by Silvio.Falconi »

Grazie Emg
Adesso sono più tranquillo.
Se però rileggi le frasi di Randal puoi trovare che lui pensava fosse un esempio "test" mentre io gli avevo modificato direttamente la classe
Ecco cosa cercavo di far capire al Randal

Thanks Emg
Now I am quieter.
However, if you re-read the sentences of Randal can find that he thought was an example "test" of calendar while I had changed the class directly
Here is what I tried to explain to Mr Randal
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: Canal5 Calendar

Post by richard-service »

Silvio.Falconi wrote:Also I use calendar,Banner and other Canalfive controls
wich error you have ?
Hi Silvio,
Did you had CanalFive C5Folder sample code? if you had it, could you send to me? Thank you.
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
Post Reply