🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17765

Re: local network problem

#17765
From: Nico Bendlin
Date: Wed, 05 Mar 2003 01:18
42 lines
2150 bytes
Paul Dadah wrote:
>>What you could try:
>>
>>Omit the FileExists() and just do a
>>        int iFileHandle = FileOpen(FileIn, fmOpenRead);
>>or a
>>Memo1->Lines->LoadFromFile ( FileIn );
> 
> 
> I tried both of your suggestions and still had same problem.
> I solved my problem by adding a TCppWebBrowser component and adding the
> following code:
> 
>    WideString URLstr = "\\\\comp2\\c";
>    CppWebBrowser1->Navigate( URLstr );
> 
> but is this an ugly way to solve my problem?

Try something like (written from scratch)...


NETRESOURCE NetResource = {
     RESOURCE_GLOBALNET,
     RESOURCETYPE_DISK,
     RESOURCEDISPLAYTYPE_SHARE,
     RESOURCEUSAGE_CONNECTABLE,
     NULL,
     TEXT("\\\\foo\\bar"),
     NULL,
     NULL
};
DWORD BufferSize = 0;

::WNetUseConnection(WindowHandle, &NetResource,
     NULL, NULL, CONNECT_INTERACTIVE, NULL,
     &BufferSize, &Result);


...before accessing the share.

-- 
codito, ergo sum :]
Technical Details
Message-ID: <3e655074$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e640957@newsgroups.borland.com> <3e64619f@newsgroups.borland.com> <3e64eb3f$1@newsgroups.borland.com> <3e650533$1@newsgroups.borland.com> <3e6517c9@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,fd9439bf2e17e166
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-04 17:24:27 PST
Date: Wed, 05 Mar 2003 02:18:43 +0100
From: Nico Bendlin <nicode@gmx.net>
Organization: Piranha Bytes
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2.1) Gecko/20021130
X-Accept-Language: de, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: local network problem
References: <3e640957@newsgroups.borland.com> <3e64619f@newsgroups.borland.com> <3e64eb3f$1@newsgroups.borland.com> <3e650533$1@newsgroups.borland.com> <3e6517c9@newsgroups.borland.com>
In-Reply-To: <3e6517c9@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 213.68.93.66
Message-ID: <3e655074$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1046827124 213.68.93.66 (4 Mar 2003 17:18:44 -0800)
Lines: 43
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail