Solved

Function "RasGetEntryDialParams" can't retrieve phone number?

Posted on 2001-06-20
8
296 Views
Last Modified: 2010-04-06
Hello, I want to get the phone number by phonebook entry name. The function "RasGetEntryDialParams" can retrieve "szDomain" or "szUserName",but only can't retrieve "szPhoneNumber"(it always is blank), can you tall me what's the problem, Thanks

Function GetRasPhoneNumber(Entryname:string):String;
var DialParams : TRasDialParams;
    Fp         : LongBool;
    I          : Integer;
begin
  FillChar(DialParams, SizeOf(TRasDialParams), 0);
  with DialParams do
  begin
    dwSize:=Sizeof(TRasDialParams);
    StrPCopy(szEntryName, edUserName.text);
  end;

  I := RasGetEntryDialParams(nil, DialParams, Fp);

  if I <> 0 then
    Result := dialparams.szPhoneNumber
  else
    Result := '';
end;

0
Comment
Question by:yakelvin
8 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6209696
What is the return value of the call to RasGetEntryDialParams?
Maybe it just doesn't work...
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6209701
Hello

  May this article will help you

Creating your own dial-up application with RAS
http://www.kyler.com/pubs/ddj9855.html

Mohammed
0
 
LVL 17

Accepted Solution

by:
inthe earned 300 total points
ID: 6212696
Hi,
ive done some reading and alot of people have problems with this getting the phone number (i suspect epsylon is right and your geting 632[incorrect size] as return code from RasGetEntryDialParams ,i tried messing with RasGetEntryProperties  to read szLocalPhoneNumber as thats supposed to work but for me also returned blank.

something i found that does work if you are not using them  already i would get the latest ras headers from :
ftp://delphi-jedi.org/api/RAS.zip

then can do:

uses RasHelperClasses;

procedure TForm1.Button1Click(Sender: TObject);
var
RasPhonebook: TRasPhonebook;
i : integer;
begin
 RasPhonebook := TRasPhonebook.Create;
 for i := 0 to RasPhonebook.Count -1 do begin
 if RasPhoneBook.Items[i].Name = 'My Entry Name' then
 ShowMessage(RasPhoneBook.Items[i].PhoneNumber);
 end;
end;

Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 6212698
note
call RasPhonebook.Free afterwards.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:yakelvin
ID: 6213583
hello, inthe
function "RasGetEntryProperties" can return phone number(szLocalPhoneNumber). But at Win NT or Win 2000,if Ras dial has setup alternate phone number. szLocalPhoneNumber will return blank and dsAlternateOffset always is '0'.
do you know what's problem about this?
0
 
LVL 17

Expert Comment

by:inthe
ID: 6214026
Hi,
yes but unfortunatly well not enough to fix it ..

i know if your just trying to use the api its a problem as there are various issues etc between the os's like size of buffer can be one (if you have a size problem you will get back 603),and the deviceinfo etc must be nil or 0 on win2k ,its all i kept reading about yesterday when looking for original answer.

you shold try the code i posted above works ok with alternative numbers i just tested by adding 3 more numbers to my dialup params ,so the author of that succedded ,but he is a ras specialist ;-)

Regards Barry
0
 

Author Comment

by:yakelvin
ID: 6216903
Hi,
yes, I have try the code, it can get the szLocalPhoneNumber from phonebook, which has assigned alternative numbers.  

but another question, How can I get the alternative numbers? I can't find a function to do that. To be honest, get the alternative number is my main purpose.

thank you,
0
 

Author Comment

by:yakelvin
ID: 6247019
Thank you for your help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now