Solved

DUN entry icon in taskbar when connection has been stablished in WinXP and 2000

Posted on 2004-03-26
9
363 Views
Last Modified: 2011-10-03
I have a dun entry I dial with a software I developed.

In WInXP and 2000 I need to tell that DUN entry to check the "Show icon in taskbar" in the properties page, so it will show the connection once stablished in the taskbar.

Very simple yet I know no reasonable method to do it.

Please help!

Esopo.
0
Comment
Question by:Esopo
  • 5
  • 4
9 Comments
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 10693670
Create a RasDialFunc for Handling All ras Connection status messages
  and then if its Connected
  then Put ur icon onthe task bar

Ur RasDialFunction can be like this
In Delphi Code
 
Function RasDialFunc(  unMsg : Cardinal;  rasconnstate : _RASCONNSTATE ; dwError :DWORD ) Hresult;
  begin
      if rasconnstate = $00000001 then
            ShowTaskbarIcon;
      if rasconnstate = $00000002 then
            DeleteTaskbarIcon;
   end;
0
 
LVL 14

Author Comment

by:Esopo
ID: 10697136
Thanks for your post.

Do I have to do this everytime I successfully stablish the connection?
This  ShowTaskbarIcon method will make the icon appear on the taskbar? how do I declare it?

Do you know of a way to make the change directly in the RAS entry so the next time the system shows the Taskbar icon on it's own?

Thanks again.


0
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 10698928
Yeah u ave to.

U make ur own dialer. U ave to tell system wot to do.. thats it..

Windows standart dialer checks the connection  and then put its own icon on the task bar. U ave to check and put ur icon too..

And u ave to use a dial function as i ve told above to handle dialing status..

here is the SDK link for ras dial Connection State enumeration. U can get all the status information . like Connecting, Authoriaztion,Connected .. etc ..

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rras/rasconnstate.asp

0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 14

Author Comment

by:Esopo
ID: 10700458
>U make ur own dialer. U ave to tell system wot to do.. thats it..
I totally agree. I just noticed that if I manually checked the "Show in taskbar" option in the RAS entry properties, then when the conection was established (and my application closes) the icon would appear directly handled by the OS. I was thinking there might be a way to check that option box using code.

Is  ShowTaskbarIcon declared in the RasApi? How does it know wich connection to show? or is this a name for a function I should make, in which case, how would that work?

0
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 10701534
ShowTaskBarIcon is a Function that u ll code.. U can use some components or Prepare it With ShellApi Functions..

Const
   wm_showmen = Wm_User + 666;
var
   mnoticon : _NOTIFyicondataA

Procedure ShowTaskBarIcon;
  with mnoticon do
    begin
       cbSize:=sizeof(_NOTIFyicondataA);
       Wnd:=mainform; // Form which ll Handle the Callback Message
       uID:=999;
       uFlags:=NIF_ICON+NIF_MESSAGE+NIF_TIP;
       uCallbackMessage:=wm_showmen;    // message when an system event or command triggered
       hIcon:=LoadIcon(happins,'mainicon');
       szTip:='Esopos Amazing Dialer.....';
    end;
   mShell_NotifyIcon(NIM_ADD,@mnoticon); //( NIM_delete is the deletetin Parameter) and ll be used in DeleteTaskBarIcon proc
end;
0
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 10701539
And btw..

Do not forget to add  ShellApi.dcu..  

And my points :p


hope it helps .

0
 
LVL 14

Author Comment

by:Esopo
ID: 10701805
non_zero:

If I'm getting you comments right, you are providing me a method to put an icon (my own icon) on the taskbar and from there interact with the user. I guess whenever the user wants to disconnect the dial up connection he'll click on my taskbar icon and 'll have to do receive the message and do the closing with my own code, right?

Dear friend, your idea is excellent and you've provided some great code, but this in no way answers my question. It's not about the points, you can have them with an A grade and all, but I want an answer for my question.

I think we have a missunderstanding about how my application works and what my question was so I'm explaining:

>I have a dun entry I dial with a software I developed.

what I meant with this is that my application created a RAS entry, a normal RAS entry. When the user asks for a connection I ask the OS (through RAS API) to stablish such connection. I chech the messages the OS is returning and when finally connected my application closes (terminates).

The whole connection is managed by Windows and the dialing is made using a RAS entry that anybody can see in the network connections panel.


>In WInXP and 2000 I need to tell that DUN entry to check the "Show icon in taskbar" in the properties page, so it will show the connection once stablished in the taskbar.

Under Windows 98, once the connection is stablished and my application terminated (leaving the connection running) Windows itself shows a taskbar icon for the connection (since it was dialed using a standard RAS entry). So whenever the user wants to disconnect he click the icon and gets the normal/standard Windows dialog for the running connection that has a "disconnect" button.
All of this is handled directly by the OS, my application was long gone by now.

My only problem with all of this, is that under Win2000 and XP the properties for RAS entries have changed and now for the Icon in the taskbar to appear, I must manually check the "Show Icon in Taskbar" in the RAS entry properties, bacause I don't know how to access the RAS entry's properties using code.

In short words: What I want is a way to change the "Show Icon in Taskbar" propery for a RAS entry using code.

I'm increasing points for this qestion to 400 so you don't feel like you've waisted your time. I hope it's clear now. I can't use your method cause my intention from the start is to let the OS control as much as possible, besides what I'm looking for should be something like 5 lines of code, it would be unreasonable to do all the coding and checking in every OS that your idea requires when the answer I want is so simple.
0
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 400 total points
ID: 10701844
Ok ..

When U create Ur Ras Entry, in rasEntry Paramater structure
 
   if   RASEO_ModemLights is set , connection icon ll be displayed in the task bar by Os...

0
 
LVL 14

Author Comment

by:Esopo
ID: 10701863
Thank you. I'll check this up and let you know how it went tomorrow.
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
split53 challenge 7 96
This code tracks birthdays 3 73
Plain Text Editor for iPad 6 75
Is there any way to copy all SSRS reports/datasets/data sources  to new server? 3 61
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

776 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