Solved

Function "RasGetEntryDialParams" can't retrieve phone number?

Posted on 2001-06-20
8
298 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 17

Expert Comment

by:inthe
ID: 6212698
note
call RasPhonebook.Free afterwards.
0
 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Syntax Check Delphi Seattle IOS app without MAC ? 1 96
Magic Software info 18 130
SUM 2 INTEGER ARRAYS INTO 1 10 100
Twebbrowser in Fire monkey android scrolling to bottom 1 27
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

11 Experts available now in Live!

Get 1:1 Help Now