Canal5 Calendar

Canal5 Calendar

Postby Randal » Mon Feb 13, 2017 6:09 am

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
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Canal5 Calendar

Postby Silvio.Falconi » Mon Feb 13, 2017 8:11 am

Also I use calendar,Banner and other Canalfive controls
wich error you have ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Postby Randal » Mon Feb 13, 2017 2:36 pm

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
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Canal5 Calendar

Postby Silvio.Falconi » Mon Feb 13, 2017 2:59 pm

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  Expand view
#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)));


}
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Postby Randal » Mon Feb 13, 2017 7:10 pm

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
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Canal5 Calendar

Postby Silvio.Falconi » Tue Feb 14, 2017 12:02 am

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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Postby Randal » Tue Feb 14, 2017 12:41 pm

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
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Canal5 Calendar

Postby Silvio.Falconi » Tue Feb 14, 2017 2:16 pm

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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Postby Silvio.Falconi » Tue Feb 14, 2017 2:52 pm

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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Postby Randal » Tue Feb 14, 2017 5:45 pm

Silvio:

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

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

Re: Canal5 Calendar

Postby Silvio.Falconi » Tue Feb 14, 2017 7:13 pm

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.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Postby Randal » Wed Feb 15, 2017 1:02 am

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
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Canal5 Calendar

Postby Enrico Maria Giordano » Wed Feb 15, 2017 9:04 am

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
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Canal5 Calendar

Postby Silvio.Falconi » Wed Feb 15, 2017 9:20 am

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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Canal5 Calendar

Postby richard-service » Tue Oct 24, 2017 6:54 pm

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.
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests