Win_Msg - A kind of Notification message so easy and friendly Demo

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

User avatar
quartz565
Posts: 563
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Has thanked: 174 times
Been thanked: 20 times
Contact:

Re: Win_Msg - A kind of Notification message so easy and friendly Demo

Post by quartz565 » Wed Mar 22, 2017 1:50 pm

Ευχαριστώ φίλε !
Best Regards,
Nikos.

os: Windows Server 2012 - 64
hw: HP Server E5606, 2.13GHz, 8.00 GB - Intel Xeon CPU

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Wed Mar 22, 2017 2:05 pm

ΠΑΡΑΚΑΛΩ :D

You are welcome Dave.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Anand
Posts: 411
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 112 times
Been thanked: 60 times

Post by Anand » Thu Mar 23, 2017 12:30 pm

Hi Pablo,

I got below error, obviously thread lib needed. How to add it ?

Harbour 3.2.0dev (r1601151502)
Copyright (c) 1999-2015, http://harbour-project.org/
<snip>
hbmk2: Error: Referenced, missing, but unknown function(s):
GETCURRENTTHREADID(), GETCURRENTTHREADHANDLE(), SETTHREADPRIORITY(),
ATTACHTHREADINPUT(), HMG_THREADHBTOWINID()

Regards,

Anand
Image

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Thu Mar 23, 2017 12:52 pm

Hello Anand,

As you can see at source Demo3.prg saying: Compiled with...: HMG 3.4.3 + added patches #1 and #2

I think patch #2 is missing to be added at your HMG. See this: viewtopic.php?p=50091#p50091 and please considere also this: viewtopic.php?p=50218#p50218

Now in HMG Harbour and C functions be added to work with THREADs properlly thanks to Dr. Claudio. :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Anand
Posts: 411
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 112 times
Been thanked: 60 times

Post by Anand » Thu Mar 23, 2017 4:05 pm

Thanks Pablo,

Patched and done :D

Regards,

Anand
Image

User avatar
serge_girard
Posts: 2344
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 589 times
Been thanked: 124 times
Contact:

Post by serge_girard » Fri Mar 24, 2017 12:49 pm

Hi Pablo,

I changed a bit:

Code: Select all

nHeight := LEN(cMsg) * 1.3
IF nHeight < 82 
   nHeight  := 82
ENDIF
nTop := GetDesktopRealHeight() - nHeight
For longer text messages. Maybe there is a better way to do it?
Thanks for nice piece of handy messaging, it looks really professional now !

Serge

RPC
Posts: 129
Joined: Fri Feb 10, 2017 4:12 am
DBs Used: DBF
Has thanked: 31 times
Been thanked: 7 times

Post by RPC » Fri Mar 24, 2017 5:05 pm

Hi Pablo
I am getting following error while compiling
Errror.png
Errror.png (49.98 KiB) Viewed 1963 times
Pls advice what is to be done.
Thanks

User avatar
Anand
Posts: 411
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 112 times
Been thanked: 60 times

Post by Anand » Fri Mar 24, 2017 5:23 pm

Hi RPC

Patch it. See http://hmgforum.com/viewtopic.php?p=50240#p50217 for Pablo's answer.

Regards,

Anand
Image

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Fri Mar 24, 2017 6:37 pm

serge_girard wrote:
Fri Mar 24, 2017 12:49 pm
Hi Pablo,

I changed a bit:

Code: Select all

nHeight := LEN(cMsg) * 1.3
IF nHeight < 82 
   nHeight  := 82
ENDIF
nTop := GetDesktopRealHeight() - nHeight
For longer text messages. Maybe there is a better way to do it?
Thanks for nice piece of handy messaging, it looks really professional now !

Serge
Nice idea Serge. :) :P
I guess there is better way to calculate number of lines, specially when CRLF is introduced in the cMsg.
I tried a bit more with this code... but unsuccessfuly... :oops:

Code: Select all

cMsg := "Printing file xxxxx.xxx "+CRLF+"sent to EPSON LX-300"+CRLF+"3rd line"+CRLF+"4th line"+CRLF+"5th line"

FUNCTION Notifier( cMsg, aBcolor, nSeconds, lCenter, nTransparency )
LOCAL cParentWindowName, hWnd, hWndhMain := 0
LOCAL nWidth := 204, nTimeIni
LOCAL nLeft := GetDesktopRealWidth() - nWidth

LOCAL nLines, hFont, nTop, nHeight, nMsgWidth
LOCAL cFontName := "MS Shell Dlg"
LOCAL nFontSize := 10
LOCAL lBold := .T., lItalic := .F., lUnderline := .F., lStrikeOut := .F.

DEFAULT cMsg          := ""
DEFAULT nSeconds      := 2
DEFAULT lCenter       := .F.
DEFAULT nTransparency := 255

If Empty(cMsg)
   Return Nil
Endif

*nHeight := HMG_Len(cMsg) * 1.3

nLines := hb_TokenCount(cMsg, .T. /*lEOL*/)
hFont := HMG_CreateFont ( , cFontName, nFontSize, lBold, lItalic, lUnderline, lStrikeOut )

nMsgWidth := GetTextWidth( , cMsg, hFont)
nMsgWidth := nMsgWidth / (nWidth - 20)
If !( Int(nMsgWidth/(nWidth - 20)) == nMsgWidth )
   nMsgWidth := Int( nMsgWidth ) + 1
Endif

nLines := nLines + nMsgWidth

nHeight := XGetTextHeight( , cMsg, hFont) * nLines
I borrow some Krzysztof's function... but I got tired to try... :|

RPC wrote:
Fri Mar 24, 2017 5:05 pm
I am getting following error while compiling
Hi Rajeev,

Probably you did not applied yet the two patches of 3.4.3 version as it said already Anand. (By the way: thank you Anand).
It's incomplete info in your screen captured.

As a result of this lack of visibility, let me know something:
have you already tested the ViewError - HMG building utility ? For me it's useful, if not for you may you tell me what did you dislike about it ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
serge_girard
Posts: 2344
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 589 times
Been thanked: 124 times
Contact:

Post by serge_girard » Sat Mar 25, 2017 8:48 am

Yes, Pablo I used a quick and dirty method. Perhaps CRLF should be count as a complete line.
Also yesterday I added an image (kind of company logo) so I'm testing it with your new code from above.

Serge

Post Reply