Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SET LIBRARY TO xmsg71 2

Status
Not open for further replies.

Mandy_crw

Programmer
Jul 23, 2020
578
PH
Hi Everyone... Still trying to enhance my application and while researchin from the internet, i came accross this site that teaches how to enhance messagebox command thru the use of xmsg71.FLL file... i've used it and saw the extended capability of the messagebox, but while testing it, everytime i edit or save it always says invalid path... so i need to close foxpro and reopen the file for me to save other edition... i noticed that everytime i run the program and try to edit again it always says invalid path... Please help me be enlightened with this error... Thanks and God bless...

heres the code ive gotten from the internet...

*MEESAGEBOX ESPECIAL
*-------------------
SET LIBRARY TO xmsg71
**If This.Value=0
** * turn extended dialog off
** xmsg_SetDlgMonitor(.F.)
**ELSE
* Set dialog font and color
xmsg_AssignMessageFont('Times',16,.T.)
xmsg_AssignMessageFontColor(RGB(0,74,128))

* set dialog background color
xmsg_EnableUdfBackColors(.T.)
xmsg_LoadBackcolorFromSolidColor(1,RGB(210,235,253))
xmsg_LoadBackcolorFromSolidColor(2,RGB(107,174,221))

* set dialog icon
xmsg_EnableUdfIcons(.T.)
xmsg_LoadIconFromResourceFile(0x80, _vfp.ServerName, 0) &&UDF

* set button caption
xmsg_EnableUdfButtonCaptions(.T.)
xmsg_AssignButtonCaption(1, 'Agree?')
xmsg_AssignButtonFont(1, 'Arial',11)

* limit the width of the dialog
xmsg_AssignDlgMaxSize(400)

* turn extended dialog on
xmsg_SetDlgMonitor(.T.)
**ENDIF

=MESSAGEBOX('A picture is worth a thousand words...',;
64, 'MessageBox Dialog')
xmsg_SetDlgMonitor(.F.)
 
SET LIBRARY TO something only works, if the FLL file is found, just like any command using a file depends on it being found. Just like USE or SET PROCEDURE fail if they don't find the file.

So, SET LIBRARY TO xmsg71 only works in the short form, if you CD into or SET PATH to the directory of the FLL or if you have the FLL in one of the paths you have in your SET PATH.

Chriss
 
Mandy, I'm not familiar with XMSG71, but if you are looking for a way of issuing enhanced message boxes, I suggest you take a look at FoxyDialogs. If you follow that link, you'll see that it can produce some very attractive results. It also has the advantage of being well documented.

I appreciate you might have already invested some time in learning XMSG71, but I do think FoxyDialogs is worth a look.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Chriss... i think i found the culprit... i edited the fll file using notepad 3 in hex.... because i want to remove the "demo" word in title bar... so everytime i edit and remove that word, it will have that error.. but when i use the original file which is downloaded from the internet, everything works well... Thank you Chris...

Hi Mike... yes I will still try to look what you have suggested... and learn more... thank you and god bless...
 
Well, Mandy.

That explains very well why the FLL stops working. I didn't think of such a reason,, I thought you just missed to address the file correctly. Or have included it into the project an embedded it into the EXE, which doesn't work as far as I know.

An FLL is a DLL dynamic link library and one of the major features of a dynamic link library is having "entry points", Adresses where the functions of a DLL start. By removing just a single byte you make those addresses invalid and the DLL stops working, of course. You don't hack a DLL that easy, forget it. Since the whole of news2news doesn't exist anymore and was integraated into the VFPX project, a lot of samples are still not yet completely working, so you could address that and may get at the full version of the FLL.

First notice the old site news2news.com already migrated twice to codeplex and now github. So things are all out of whack, but the current maintainers of the github project likely have all the original files from news2news and could reorganize what's missing. See It says:

Github Win32API said:
Note that this document contains some links to the old news2news website which does not work at the moment. This material will be available sometime in the future.

You may acccelerate that b opening an issue with this problem. In fact it is already an open issue, if you look into Looking into the discussion, that's from 2018 and nothing changed until then, sadly. And the last comment of Tore Bleken may be the final word on it:

Tore Bleken said:
Some of the samples which were available at News2news.com are not presently available here since they depend on custom made libraries. Some of these samples may be added later, [highlight #FCE94F]if the necessary libraries are released to the public[/highlight].

I think this FLL has not been released to the bpublic and remains one of the thingss news2news didn't release for free, so this will always remain incomplete.

If that's the case you're far better helped by taking Mikes advice to take a look into using FoxyDialogs, which offers way more than the xmsg71.fll, if you ask me. Also, I think that stems back from your old thread Some of the samples which were available at News2news.com are not presently available here since they depend on custom made libraries. Some of these samples may be added later, if the necessary libraries are released to the public.

And there I showed you tht VFPs MEssagebox is simply a Windows API function, but more importantly than that I put in bold
myself said:
Well, instead, do your own Messagebox form class.

I repeat that. If it took you from end of October 22 to now, April 23 and still trying to use an enhanced messagebox you really should give up and give in. I mean what hinders you to see the biggest advantage of creating your own Messagebox form? A system or FLL messagebox also is just a form, and you can design forms on your own, you don't need a library or FLL for that. PLus the forms you design can by simplest use of the forms you already have done. Reuse the same color scheme, fonts, graphics, icons etc. is simple, if you make the messagebox forms on your own. What is stopping you from using that? You seem to fear you have to do every single messagebox with every text ever. No, you can use a function, parameters, set a label.caption to the text passed in and use its wordwrap feature to automatically layout the text.

It can't be any simpler to get the desired looks of the messageboxes you want to have in your application by making them your own forms. You want the freedom of designing those messagebox to integrate into the look of the rest of your application. You have the maximum freedom in that way and only in that way. So what are you waiting for, Mandy?

We even had a discussion there how it can all integrate into the code you already have thanked for that part of the thread, so you have already noticed it.

Chriss
 
Chris said:
I mean what hinders you to see the biggest advantage of creating your own Messagebox form? A system or FLL messagebox also is just a form, and you can design forms on your own, you don't need a library or FLL for that
.

Mandy, although I personally like FoxyDialogs and am happy to recommend it to you, I do agree with Chris that creating your own message form is often a good way to go.

You can do that quite easily wihthout changing any of your existing code. You create a form that takes the same parameters as the native MESSAGEBOX() function and returns the same value. Make it a modal form, and add whatever controls you want to make it look attractive.

Then write a function that does nothing other than calling your form, passing the same parameters and returning the same result. Name the function, for example, MyMessage. Finally, add this line to your Include file (if you don't know what an Include file is, we can explain it):

[tt]#DEFINE MESSAGEBOX MyMessage[/tt]

From now on, whenever you call the native MESSAGEBOX() function in your program. your custom form will be invoked instead.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike did explain the steps to do very well, easier to follow than what I wrote back in October. I just want to mention I already described how you can even minimize how many times you'd need to add this definition #DEFINE MESSAGEBOX MyMessage into your code by using includes.

I can imagine there are a ton of questions that led you to not go this route, but it pays to ask them. For example, the first question that should come up is how to take any message text and display it in a form. It seems like it's a hard task already, but text is just data and you know the Editbox - hopefully, can display text, any text, with word wrap and within the size of itself. It can fail on text so long, that it doesn't display fully, so instead you get a scrollbar. You could react to an editbox having a scrollbar. You could higher its height until the scrollbar disappears. And there is something that's able to render text even more automatically in the size needed: A label caption with a label set to use wordwrap and autosize, so it extemds in height, if the text doesn't fit.

Anyway, I can imagine you have questions. But you're not afraid of asking questions, are you? The major advantage still is, you have the full control about colors and graphics in the design of all your forms, strting wiht the font and fontsize and color to use for this label caption.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top