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

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

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

Post by quartz565 »

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

os: Windows Server 2019 - 64
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

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

Post by Pablo César »

ΠΑΡΑΚΑΛΩ :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: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

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

Post by Anand »

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

Anand

Image
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

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

Post by Pablo César »

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: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

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

Post by Anand »

Thanks Pablo,

Patched and done :D

Regards,

Anand
Regards,

Anand

Image
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

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

Post by serge_girard »

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
There's nothing you can do that can't be done...
RPC
Posts: 282
Joined: Fri Feb 10, 2017 4:12 am
DBs Used: DBF

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

Post by RPC »

Hi Pablo
I am getting following error while compiling
Errror.png
Errror.png (49.98 KiB) Viewed 4633 times
Pls advice what is to be done.
Thanks
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

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

Post by Anand »

Hi RPC

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

Regards,

Anand
Regards,

Anand

Image
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

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

Post by Pablo César »

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: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

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

Post by serge_girard »

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
There's nothing you can do that can't be done...
Post Reply