Solved

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

Posted on 2004-03-26
9
364 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
topping1 challenge 7 109
Path to Python 9 128
Advice in Xamarin 21 96
Using VBscript & RegEx, how can I match lines starting with Oracle word 17 74
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.

792 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