Solved

Function "RasGetEntryDialParams" can't retrieve phone number?

Posted on 2001-06-20
8
299 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Communication Between RC4 Delphi <-> PHP 3 123
URL for downloading Google Chrome for Win XP 2 185
Working with hours 3 65
How to load 2 images in same column in Delphi 2 57
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

861 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