Page 1 of 2

Canal5 Calendar

Posted: Mon Feb 13, 2017 6:09 am
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

Re: Canal5 Calendar

Posted: Mon Feb 13, 2017 8:11 am
by Silvio.Falconi
Also I use calendar,Banner and other Canalfive controls
wich error you have ?

Re: Canal5 Calendar

Posted: Mon Feb 13, 2017 2:36 pm
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

Re: Canal5 Calendar

Posted: Mon Feb 13, 2017 2:59 pm
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)));


}

Re: Canal5 Calendar

Posted: Mon Feb 13, 2017 7:10 pm
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

Re: Canal5 Calendar

Posted: Tue Feb 14, 2017 12:02 am
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

Re: Canal5 Calendar

Posted: Tue Feb 14, 2017 12:41 pm
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

Re: Canal5 Calendar

Posted: Tue Feb 14, 2017 2:16 pm
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

Re: Canal5 Calendar

Posted: Tue Feb 14, 2017 2:52 pm
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

Re: Canal5 Calendar

Posted: Tue Feb 14, 2017 5:45 pm
by Randal
Silvio:

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

Randal

Re: Canal5 Calendar

Posted: Tue Feb 14, 2017 7:13 pm
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.

Re: Canal5 Calendar

Posted: Wed Feb 15, 2017 1:02 am
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

Re: Canal5 Calendar

Posted: Wed Feb 15, 2017 9:04 am
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

Re: Canal5 Calendar

Posted: Wed Feb 15, 2017 9:20 am
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

Re: Canal5 Calendar

Posted: Tue Oct 24, 2017 6:54 pm
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.