?
Solved

Function "RasGetEntryDialParams" can't retrieve phone number?

Posted on 2001-06-20
8
Medium Priority
?
305 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 900 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

770 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