🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Create a shared network folder?

#3421
From: Ed Mulroy
Date: Fri, 23 Jun 2006 14:45
53 lines
2756 bytes
The arguments in the function prototype I found are:

  NetShareAdd (
    const char *,
    short ,
    const char * ,
    unsigned short);

but the code you show calls it as if it were:

  NetShareAdd (
    wchar_t,
    short,
    const unsigned char *,
    unsigned long);

.  Ed

> nivekski wrote in message
> news:449bf567@newsgroups.borland.com...
>
> The code below returns the following errors
> [C++ Error] mtt.cpp(44): E2034 Cannot convert 'char *' to 'wchar_t'
> [C++ Error] mtt.cpp(44): E2141 Declaration syntax error
> [C++ Error] mtt.cpp(46): E2034 Cannot convert 'wchar_t' to 'wchar_t *'
> [C++ Error] mtt.cpp(50): E2034 Cannot convert 'char *' to 'wchar_t *'
> [C++ Error] mtt.cpp(51): E2034 Cannot convert 'char *' to 'wchar_t *'
> [C++ Error] mtt.cpp(63): E2034 Cannot convert 'int' to 'wchar_t *'
> [C++ Error] mtt.cpp(63): E2342 Type mismatch in parameter 'servername' 
> (wanted 'wchar_t *', got 'wchar_t')
>
> Any thoughts please folks?
>
> void __fastcall TmainForm::create_share(void)
> {
>
>  NET_API_STATUS res;
>  SHARE_INFO_2 p;
>  DWORD parm_err = 0;
>  wchar_t shareName = "DTTServer"
>
>  p.shi2_netname = TEXT(shareName);
>  p.shi2_type = STYPE_DISKTREE; // disk drive
>  p.shi2_remark = TEXT(shareName);
>  p.shi2_permissions = ACCESS_ALL;
>  p.shi2_max_uses = -1;
>  p.shi2_current_uses = 0;
>  p.shi2_path = TEXT("C:\\DTTServer\\");
>  p.shi2_passwd = NULL; // no password
>
>  res=NetShareAdd(shareName, 2, (LPBYTE) &p, &parm_err);
>  if(res==0) re1->Text = "Share created.\n";
>  else re1->Text = "Error: %u\tparmerr=%u\n", res, parm_err;
Technical Details
Message-ID: <449bfe7f@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <449b2212$1@newsgroups.borland.com> <449bc1af$5@newsgroups.borland.com> <449bcb65$1@newsgroups.borland.com> <449bf567@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,64233069cb76a215
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <449b2212$1@newsgroups.borland.com> <449bc1af$5@newsgroups.borland.com> <449bcb65$1@newsgroups.borland.com> <449bf567@newsgroups.borland.com>
Subject: Re: Create a shared network folder?
Date: Fri, 23 Jun 2006 10:45:11 -0400
Lines: 55
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 69.242.35.97
Message-ID: <449bfe7f@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1151073919 69.242.35.97 (23 Jun 2006 07:45:19 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail