Testing code on XP

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

Can someone test this code on XP.

It's a helpdesk taskbar program, it's working on win95-98

For the icon, just use any icon.

Code: Select all


;
; ------------------------------------------------------------
;
;   SysTray Centraal Meldpunt
;
;    (c) 2001 - C. de Visser
;
; ------------------------------------------------------------
;
login_name.s=Space(255)
wsname.s=Space(255)
defserver.s=Space(255)
p_station.s=Space(255)
llogin.l=255
lwsname.l=255
ldefserver.l=255
lpstation.l=255

; Read registry values

;OpenRegKey(#HKEY_LOCAL_MACHINE,"Network\Logon") 
;Username$ = ReadRegString("Username", "Error reading") 
;CloseRegKey()

;OpenRegKey(#HKEY_LOCAL_MACHINE,"System\CurrentControlSet\control\ComputerName\ComputerName")
;Computername$=ReadRegString("ComputerName", "Error reading") 
;CloseRegKey()

GetEnvironmentVariable_("LOGIN_NAME",login_name,llogin)
GetEnvironmentVariable_("WSNAME",wsname,lwsname)
GetEnvironmentVariable_("DEFSERVER",defserver,ldefserver)
GetEnvironmentVariable_("P_STATION", p_station,lpstation)


; Write To File
Result = CreateFile(0, "c:\tmp\ondersteuning.js") 

WriteStringN("var loginname="+ "'"+StripTrail(login_name)+"'" + ";") 
WriteStringN("var wsname=" + "'"+ StripTrail(wsname) + "'" + ";")
WriteStringN("var defserver=" + "'" + StripTrail(defserver) + "'" + ";")
WriteStringN("var wsname=" + "'" +StripTrail(wsname)+ "'" + ";")

     
CloseFile (0)


; create popupmenu
If CreatePopupMenu(0)
  MenuItem(1, "Werkstation:  "  + StripTrail(wsname))
  MenuItem(2, "Mac adres:    "  + StripTrail(p_station))
  MenuItem(3, "Server naam: "  + StripTrail(defserver))
  MenuItem(4, "Login naam:   " + StripTrail(login_name))

  MenuBar()
  MenuItem( 5, "Programma Sluiten")
EndIf

IconID.l=LoadImage (0,"helpdesk.ico")

If OpenWindow(0,0,0,0,0,#WS_VISIBLE,"Centraal Meldpunt"); don't show this opening window
  ShowWindow_(WindowID(),#SW_HIDE)


  AddSysTrayIcon(0, WindowID(), IconID)
  SysTrayIconToolTip(0, "Centraal Meldpunt")

   
  Repeat
    Event = WaitWindowEvent()
    
    If Event = #PB_EventSysTray
      If EventMouseButton() = 1 ; Left-Button
         RunProgram("c:\Program files\Internet Explorer\iexplore.exe","[url]http://lws.a1219.rabobank.nl/facilitair/fac-new/default.asp[/url]",0)
      EndIf
    EndIf
    
    If EventMouseButton() = 2      ; Right Button
     DisplayPopupMenu(0, WindowID(), WindowMouseX(),WindowMouseY())
   EndIf
   
  Select EventMenuID()  ; To see which popupmenu has been selected
          Case 5 ; Programma Afsluiten
            MessageID = MessageRequester("Centraal Meldpunt", "Wilt u het programma afsluiten?", 4)  
             Select MessageID 
              Case 6 ; Yes Button 
                End
             EndSelect
            
    EndSelect

  Until Event = #PB_EventCloseWindow
  
EndIf 

End    ; program end 
; ExecutableFormat=Windows
; UseIcon=K:\ABTOEP\purebasic\ontwikkel\helpdesk-ext\helpdesk.ico
; Executable=K:\ABTOEP\purebasic\ontwikkel\helpdesk-ext\Helpdesk4.exe
; DisableDebugger

 
Using Windows 98 SE
Registered PB version : 3.1 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fake.

Please post the code again and use 'Insert Code'.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

eventmousebutton() is not a function.

cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

He , thats strange.

It was working with previous versions.

Just reinstalled version 3.0 and sure it's working

Now I tested with version 3.1, and now it's not working.

Fred, Please can you check this, because I use this a lot in my programs.
eventmousebutton() is not a function.

cya,
...Danilo

(registered PureBasic user)
Using Windows 98 SE
Registered PB version : 3.1 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

cor, thats not a bug.

The whole Windows-Event-Stuff gets changed atm,
so you have to rewrite parts of your application
with every new Version of PureBasic.

You could also stay with v3.0 until
the whole app is done. Thats another "solution".

For now you can change this line:

Code: Select all

; CHANGED 
      ;If EventMouseButton() = 2 
      If EventType() = #PB_EventType_.....
           #PB_EventType_LeftClick:        Left  mouse button click 
           #PB_EventType_RightClick:       right mouse button click 
           #PB_EventType_LeftDoubleClick:  Left  mouse button double click 
           #PB_EventType_RightDoubleClick: Right mouse button double click
Good luck !!

cya,
...Danilo
(registered PureBasic user)

Edited by - Danilo on 23 May 2002 08:24:25
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

Thanks Danilo,

This will sure help, I just must take time to read carefully the docs after every new release.
cor, thats not a bug.

The whole Windows-Event-Stuff gets changed atm,
so you have to rewrite parts of your application
with every new Version of PureBasic.

You could also stay with v3.0 until
the whole app is done. Thats another "solution".

For now you can change this line:

Code: Select all

; CHANGED 
      ;If EventMouseButton() = 2 
      If EventType() = #PB_EventType_.....
           #PB_EventType_LeftClick:        Left  mouse button click 
           #PB_EventType_RightClick:       right mouse button click 
           #PB_EventType_LeftDoubleClick:  Left  mouse button double click 
           #PB_EventType_RightDoubleClick: Right mouse button double click
Good luck !!

cya,
...Danilo
(registered PureBasic user)

Edited by - Danilo on 23 May 2002 08:24:25
Using Windows 98 SE
Registered PB version : 3.1 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
Post Reply