FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour nserialhd question
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
nserialhd question
Posted: Fri Apr 26, 2013 08:05 AM
Good morning ANtonio

I am testing nserialhd function and i have some questions

1. nserialhd("C:") does not return the same value everytime
2. nserialhd("D:") returns always a value (same value) even if there is no "D"
3. nserialhd() returns always a value (same value)

tested on windows 8 pro, windows seven home and xp

thanks for clarification

Richard

this is the code i used

Code (fw): Select all Collapse
#INCLUDE "FIVEWIN.CH"

function Main()
LOCAL NC := 0, ;
      ND := 0, ;
      NX := 0

NC := nserialhd("C:")
SYSREFRESH()
ND := nserialhd("D:")
SYSREFRESH()
NX := nserialhd()
SYSREFRESH()
msginfo("NC " + CVALTOCHAR(NC) + CRLF +  "ND " + cvaltochar(nD) + CRLF +  "NX " + cvaltochar(nX))

RETURN NI
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: nserialhd question
Posted: Fri Apr 26, 2013 08:43 AM

Richard,

Please add a "\" at the end of the drives, i.e.:

nserialhd("C:\")

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: nserialhd question
Posted: Fri Apr 26, 2013 08:47 AM
FWH uses Windows API function GetVolumeInformation() for nSerialHD():

http://msdn.microsoft.com/en-us/library/windows/desktop/aa364993(v=vs.85).aspx

Parameters
lpRootPathName [in, optional]
A pointer to a string that contains the root directory of the volume to be described.
If this parameter is NULL, the root of the current directory is used. A trailing backslash is required. For example, you specify \\MyServer\MyShare as "\\MyServer\MyShare\", or the C drive as "C:\".
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: nserialhd question
Posted: Fri Apr 26, 2013 09:00 AM

thanks Antonio

I understand now

just one thing to mention

nserialhd() = nserialhd("c:\")

regards

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: nserialhd question
Posted: Fri Apr 26, 2013 09:17 AM
Richard,

Yes, it is explained in the above docs:

If this parameter is NULL, the root of the current directory is used
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: nserialhd question
Posted: Fri Apr 26, 2013 09:18 AM

In fact, we should implement a little change, as FWH supplies C:\ by default, and we should change it to NULL.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion