topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 1:54 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: IDEA: Wireless sensor  (Read 26243 times)

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: IDEA: Wireless sensor
« Reply #50 on: January 17, 2011, 03:44 AM »
OK, I'm going to have to call 'uncle' on this.

I still cannot get the damn tooltip to reappear on the Windows logon screen after someone has logged off without the computer having to be restarted.

So despite all the help from SJ, (thanks again), the best I can still come up with is a tooltip on the initial Windows logon screen and a SysTray icon that'll appear whenever anyone logs in, (at least that part worked).

Here's my code so far, there's no need for a service since I can't get anything to work after a log off anyway.

Code: AutoIt [Select]
  1. #NoTrayIcon
  2. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  3. #AutoIt3Wrapper_UseUpx=n
  4. #AutoIt3Wrapper_UseX64=n
  5. #AutoIt3Wrapper_Res_Icon_Add=On.ico
  6. #AutoIt3Wrapper_Res_Icon_Add=Off.ico
  7. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  8.  
  9. Opt("TrayMenuMode", 1)
  10.  
  11. $loggedon = (ProcessExists("explorer.exe") > 0)
  12.  
  13. HotKeySet("^+!\", "_Exit")
  14.  
  15. If $loggedon Then TraySetState()
  16.  
  17.         If (ProcessExists("explorer.exe") > 0 And Not $loggedon) Then ExitLoop
  18.         $ret = DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0)
  19.         If $ret[0] then ; Connected
  20.                 If $loggedon Then
  21.                         TraySetIcon(@ScriptName, -5)
  22.                         TraySetToolTip("Network connected")
  23.                 Else
  24.                         ToolTip("Connected", 0, 0,"Network Status", 1, 5)
  25.                 EndIf
  26.         Else            ; Not connected
  27.                 If $loggedon Then
  28.                         TraySetIcon(@ScriptName, -6)
  29.                         TraySetToolTip("Network disconnected!")
  30.                 Else
  31.                         ToolTip("Not Connected", 0, 0,"Network Status", 3, 5)
  32.                 EndIf
  33.         Endif
  34.         Sleep(1000)
  35.  
  36. Func _Exit()
  37.         Exit

Attached is an archive containing the AutoIt3 code, executable and icons (used in the SysTray).

To work out whether there's a network connection all it does is ask Windows every second - this seems to work fine here whether it's wireless or wired.  So it'll know whether it's connected or not as soon as Windows knows (in theory).  It also means it doesn't need to call third party programs or need network access through a firewall.

You can exit the program by the hotkey combo: Control+Shift+Alt+\   (That should avoid any clashes :) )
Or just kill it in Task Manager.

Set it up in the Group Policy editor as in this post EXCEPT when it comes to the User Logon script entry, it needs no parameters.

It needs no config file since the only thing configurable would be the hotkey, the executable is the only file required and can be copied to the same places as mentioned in the post.

Sorry I couldn't give you exactly what you wanted techidave, I'm actually still surprised that Windows allowed me to put anything on the initial logon screen.

It's going to take the likes of mouser or f0dder to solve this problem :P
« Last Edit: March 09, 2011, 05:46 AM by 4wd »

techidave

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,044
    • View Profile
    • Donate to Member
Re: IDEA: Wireless sensor
« Reply #51 on: January 17, 2011, 07:06 AM »
Thanks for trying 4wd.  I know you gave it your all!  Thanks to Stoic Joker for all his input too!  Perhaps in the future it will be possible.  :)

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: IDEA: Wireless sensor
« Reply #52 on: January 31, 2011, 07:13 PM »
While not entirely the answer, I just ran across a very interesting structure (while researching something else (semi related)) in the VS2k5 Platform SDK:

Code: C++ [Select]
  1. DWORD GetIfEntry(
  2.   PMIB_IFROW pIfRow
  3. );

One of the members of the MIB_IFROW structure is dwOperStatus, which has these possible values:
ValueMeaning
MIB_IF_OPER_STATUS_NON_OPERATIONAL LAN adapter has been disabled, for example because of an address conflict.
MIB_IF_OPER_STATUS_UNREACHABLE WAN adapter that is not connected.
MIB_IF_OPER_STATUS_DISCONNECTED For LAN adapters: network cable disconnected. For WAN adapters: no carrier.
MIB_IF_OPER_STATUS_CONNECTING WAN adapter that is in the process of connecting.
MIB_IF_OPER_STATUS_CONNECTED WAN adapter that is connected to a remote peer.
MIB_IF_OPER_STATUS_OPERATIONAL Default status for LAN adapters
 
 
I know there were other issues, but this looked handy enough to make a note of for future reference.