Adding DLLs in desktop IDE

Caravelle

Active Member
Licensed User
Longtime User
I'm still having problems loading libraries, and yes I have read the tutorial. I'm using version 6.8. I'm trying to use FilesEx but not having any success.

I downloaded the zip, unzipped it to Basic4ppc Desktop/Libraries, where Windows Explorer now shows FilesEx.dll, FilesEx.cs and FilesEx.chm. The chm file shows as the last item on the list in the program help.

This is the entire text of the simple test program:
B4X:
Sub Globals
End Sub

Sub App_Start
  FilesEx1.New1
  Form1.Show   
End Sub

' Copy entire card without renaming files
Sub Button1_Click
  FilesEx1.DirectoryCopy("F:\DCIM\100CANON", "H:\Documents\Card1")
End Sub

I saved it in Basic4ppc Desktop/Projects.

Tools/Components leads me to the DLL dialog. I click "Add DLL". It leads me straight to /Libraries where I select FilesEx.dll for both device and desktop. I now have "FilesEx.dll" in both columns of the dialog. I click "OK". Immediately I get an error: "Could not load file or assembly 'file:///C:\Program Files\Anywhere Software\Basic4ppc Desktop\Projects\FilesEx.dll' or one of its dependencies. The system cannot find the file specified.".

The tutorial says "When you add a library to your project, Basic4ppc will copy the the libraries file to your project folder. This is the reason why you should save your project prior to adding a library (otherwise there is no project folder). From this moment on, Basic4ppc uses the copy held under the project's folder. (Versions prior to 6.8: a message will appear indicating success or failure to copy the files.)"

I have looked in the /Projects folder and FilesEx.dll is quite clearly present and correct along with the program, "CopyFiles.sbp". So why am I being told that the system cannot find it? And just as with the device when I reported a problem a few days ago, the "Add Object" menu item is greyed out.

If I try adding "AddObject("FilesEx1", "FilesEx")" in my App_Start sub I get exactly the same message. The system cannot find a file which I can see is present - I can even read it with a hex viewer.

I have followed the tutorial to the letter, have I not? Oh my aching head... :BangHead:

Thanks in advance for a solution.

Caravelle
 

Caravelle

Active Member
Licensed User
Longtime User
This will teach me to program when I should be in bed, sleeping.

No, it's not a Vista permissions thing, but Andrew's suggestion set off a train of thought. My PDA is synchonised with my Vista desktop, because that is where all my e-mail, contacts and so on are kept. The desktop is vital to my existence and so far I have managed to keep it free of any problems - and I intend to keep it that way. For a long time now I have done all my programming and testing on a non-essential laptop - Delphi, SQLite, php/MySQL - just in case I inadvertently mess up or crash the system. Earlier machines, Win 3 and Win 95/98, seemed to suffer the blue screen of death at every opportunity and steadily got worse and worse until a complete re-installation was required, which usually took days of work. My e-mail files in particular were constantly being corrupted. I admit that the latest XP laptop has been very well-behaved despite everything I have thrown at it, but that's no reason to break the habit. And it's more comfortable to program in my armchair :)
When I have a B4P program working fine on the laptop I can send it to the desktop over the network and synchronise with the PDA.

So I tried out my FilesEx project on the Vista desktop and everything worked according to the tutorial. The dll was found, added, compiled. My program ran after some minor tinkering with the file names ("F:\" and "H:\" are something different on the desktop). A couple of dozen 2 megabyte jpgs transferred from the CF card to the USB stick at a rate of about 2 seconds each, the light in the USB stick flashing on and off very reassuringly.

Hmm. So what's different about the copy of B4P desktop on the laptop, that it shouldn't do the same thing? Light began to dawn, rapidly becoming a blinding and embarrassing glare :eek: The copy on the laptop is the evaluation version, not registered... :sign0161: I uninstalled it completely, copied over the files I had downloaded to the desktop after registering, installed, registered, copied over the FilesEx files, loaded my sbp and now everything works according to the tutorial. Maybe the tutorial says somewhere that you can't add libraries with the evaluation version, but I didn't see it. I know you can't download them unless registered, so normally a person using libraries would be using a registered version of B4P, but some of us aren't very normal o). Or maybe just a little forgetful.

Another problem resolved. I think the next questions will involve FilesEx, in a different thread.

Thanks all.

Caravelle
 

Cableguy

Expert
Licensed User
Longtime User
This will teach me to program when I should be in bed, sleeping.

The copy on the laptop is the evaluation version, not registered... :sign0161: I uninstalled it completely, copied over the files I had downloaded to the desktop after registering, installed, registered, copied over the FilesEx files, loaded my sbp and now everything works according to the tutorial. Maybe the tutorial says somewhere that you can't add libraries with the evaluation version, but I didn't see it.
Thanks all.

Caravelle

Hi Caravelle..

You are as right as you are wrong....
To me it seems that your eval version of b4p got somehow corrupted...
The "Extra" Dll's work fine with the eval version...I have it installed in my work PC, and when I need a particular dll that isn't available in it, I just logon to b4p forum and download it..
It has happened to me that exact same error more than once, usually when I tryed to add a DLL to the "project", that was already in the project folder...It drove me crazy...I had to close b4p, re-start b4p, re-load the project, verify if the Dll was added, and then add the object, wich would also error, again...
I've done this for some time now, as the ONLY diference between the eval and the registered is the ability to compile the Apps.
 
Last edited:

Caravelle

Active Member
Licensed User
Longtime User
I'd better keep the original zip file handy on my desktop then!

Caravelle
 

Caravelle

Active Member
Licensed User
Longtime User
Cableguy wrote:

It has happened to me that exact same error more than once, usually when I tryed to add a DLL to the "project", that was already in the project folder...It drove me crazy...I had to close b4p, re-start b4p, re-load the project, verify if the Dll was added, and then add the object, wich would also error, again...

Well, I have been writing bits and pieces. I managed to get Agraham's new library working on my laptop and on my device with no problem at all. I added the charting library to the laptop, again no problem, the samples run perfectly. I moved the charts dll, sbp and chm to the Vista desktop to synchronise them with the device, synchronised, tried the sample, again no problem. I went back to the Vista desktop, moved the charting dll & chm to the library folder, put the sbp file in the Projects folder, tried to run it - and guess what? It can't find the file that is without any shadow of a doubt there. :sign0148:

So I have now experienced the problem at different times, with different dlls on my device, my Win XP laptop and my Vista desktop. It seems to happen at random. Sometimes the process goes smoothly, sometimes it refuses to cooperate. I have tried closing down B4P and retarting, to no avail. I have tried re-starting the PC, it made no difference.

If no-one here can explain this odd behaviour, surely it must count as a bug? We are, after all, following the guidance given and the program is not. Well, not every time, anyway :)

Caravelle
 
Last edited:

agraham

Expert
Licensed User
Longtime User
put the sbp file in the Projects folder, tried to run it - and guess what? It can't find the file that is without any shadow of a doubt there.
Where is this Projects folder located? If it is under either Progam Files or ProgramData than move it elsewhere, Vista does some strange things to protect itself but still let programs written for XP and earlier to "appear" to run OK. Also, if you are not already, try running Basic4ppc as Administrator.

For example I have to run Excel from Office XP as Administrator to see some files that another program has written to a folder under ProgramData. Vista seems to make two copies of some (not all :confused:) of the files but only shows one of them to an application so Excel sees an older version while another program sees a newer version - very strange! However things are fine when I avoid Program Files and ProgramData as a folder location.
 

Caravelle

Active Member
Licensed User
Longtime User
B4P Desktop will find and load the sbp - it's the dll it says it can't find. Some files become "blocked" when transferred into the Libraries folder with permission from the UAC, but they can be "unblocked" using Properties and I did this.

However, I just tried another tack in Vista. I tried to save a self-written sbp to the Program Files/Anywhere Software/Basic4ppc desktop/Samples folder from the B4P IDE. It told me I didn't have permission and to contact myself as Administrator :sign0137: But the machine knows I am the Administrator, the UAC has twice today asked my permission to do something, and has accepted my response.

A shall mess around with my folders and see what happens. Most documents on this PC end up in "Public".

Thanks

Caravelle
 

Caravelle

Active Member
Licensed User
Longtime User
Didn't know there was such an option. I've been the only person to use any of my machines and am used to automatically being regarded as the Administrator! Never not been recognised as Administrator before.

Anyway, I now stick new projects into a B4P Projects folder under (MyName)/Documents and it seems to work.

Doubtless there is a good (?) reason why the Windows filing system has got more and more complicated over the years, but I'm far from convinced. Never had this trouble on the ZX81... :cool:

Thanks

Caravelle
 

agraham

Expert
Licensed User
Longtime User
Never not been recognised as Administrator before.
It does know you are an Administrator otherwise it wouldn't accept your OK for things. Vista doesn't do Administrator level actions just because you are an Administrator - it often asks you to confirm them. Also it doesn't automatically start programs you run with administrator properties unless you specify it, or have specified it in the programs' properties in which case it still asks you before running it!
Anyway, I now stick new projects into a B4P Projects folder under (MyName)/Documents and it seems to work.
That's what I've been trying to tell you, avoid Program Files and ProgramData :)
Doubtless there is a good (?) reason why the Windows filing system has got more and more complicated over the years, but I'm far from convinced.
It's not the filing system thats got more complicated but the way UAC is designed to work (or get in your way depending upon whether you like it or not!). I believe it has changed to be a bit less obvious in Windows 7 but I don't know any details as I haven't tried that yet. You can turn it off if you want in Settings -> Control Panel -> User accounts but I for one wouldn't advise it.
 

Caravelle

Active Member
Licensed User
Longtime User
It's not the filing system thats got more complicated

We'll have to disagree on that one. I have a Win 3.1 laptop running here which gives me all the evidence I need to justify what I said! I suppose it depends on your point of view.

Caravelle
 
Top