FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour OT: Strange Windows Issue - SOLVED
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
OT: Strange Windows Issue - SOLVED
Posted: Mon Mar 10, 2014 10:58 PM

This is a strange one and I hope someone has seen this before and can help....

In my app I open a file via \MyLocalPc\MyFolder\MyFile.dbf
This works on almost every computer I have installed my app on.

Here is the strange part.... One customer can open the file when they are connected to a network but not when they have no network connection.
Just to be clear, this file is local. My app is not trying to access any networked files on this system.

I can reproduce this on one of my laptops if I disable the network adapter.

Stranger still .....
If I type in the \MyLocalPC in explorer it will show me all the "shares". One of which is the folder where MyFile.dbf is located.
If I double click on MyFolder I get the typical windows network error.
Now, I enable the network adapter, go into the MyFolder and all is well.
I disable the network adapter again, while in the MyFolder and everything works.

If I change my code to open "C:\MyFolder\MyFile.dbf" everything works regardless of the network adapter being enabled or disabled (as would be expected).

I do have a reason for using the UNC type connection so switching to C:... is not an option.

Has anyone had this issue before ?
Any suggestions ?

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: OT: Strange Windows Issue
Posted: Tue Mar 11, 2014 01:54 PM

Probably a DNS issue. You can try adding entry in hosts file.
Directory: c:\windows\system32\driver\etc\
Filename: hosts
Add this info: 127.0.0.1 MyLocalPc

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: OT: Strange Windows Issue
Posted: Tue Mar 11, 2014 02:00 PM

I just thought of another option.
Use \localhost\MyFolder\MyFile.dbf instead of \MyLocalPc\MyFolder\MyFile.dbf

localhost should always reference local computer at address 127.0.0.1

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: OT: Strange Windows Issue
Posted: Tue Mar 11, 2014 02:11 PM

Thanks Gale.

I would need to stick with the first option as I need the actual computer name :)

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: OT: Strange Windows Issue
Posted: Wed Mar 12, 2014 12:48 PM

Unfortunately it didn't make a difference :(

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: OT: Strange Windows Issue
Posted: Wed Mar 12, 2014 02:24 PM
Jeff,

I do have a reason for using the UNC type connection so switching to C:\... is not an option.


Could you explain the reason?

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: OT: Strange Windows Issue
Posted: Wed Mar 12, 2014 02:33 PM

Hi James,

When my systems are networked there are data and report files that would be accessed by other systems.
If the system goes off-line then some files would need to be stored locally.

So, if let's say a report is stored and I save the file location to "C:\" when they are back on the network and a networked system tried to access the report it would look in C: on its own drive. No report would be found. If I use the Computer Name then there is no problem of opening the report from a networked system.

Also, some users want to keep the reports stored locally regardless if they are on the network or not.

I do have a routine that will move the reports to the network but for the users that keep reports locally using C: would cause issues.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: OT: Strange Windows Issue
Posted: Wed Mar 12, 2014 03:03 PM

Jeff,

OK. It seems your file access error problem is a Windows issue that may be difficult or impossible to solve (as evidenced by the fact that Windows Explorer has the same issue). So, I suggest checking for a network connection, then using a different path depending on the result. If you are using the SET PATH command, then this would be a very simple change.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: OT: Strange Windows Issue
Posted: Wed Mar 12, 2014 04:44 PM

how about using "net use" command?
So with network it is on drive f:
Without network use command below before your program
net use f: \MyLocalPc\MyFolder

Then when you run your program it is still looking for dbf on drive f:

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: OT: Strange Windows Issue - SOLVED
Posted: Fri Mar 14, 2014 01:33 PM
I found the solution...

Installing a Network Loopback adapter solves the problem.

Here are the steps for anyone not sure how to install one:

http://www.howto-tutorials.net/how-to-create-loopback-adapter-in-windows-7-step-by-step/

The only real difference in Windows 8 is that the Loopback adapter is called "Microsoft KM-Test Loopback adapter" where in Windows 7 it's called the "Microsoft Loopback Adapter"

Hope that helps anyone else that runs into this problem :-)
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion