Seite 1 von 1

Beim PC start das programm starten

Verfasst: 11.04.2010 20:50
von parzival
hi leute,
ich würde gerne ein programm schreiben, dass wenn ich meinen pc starte, gleich automatisch angeht, und auch unten in der taskleiste bleibt.
wenn man irgentein programm startet oder es läuft, ist ja unten in der leiste ein icon davon , dort soll mein programm NICHT angezeigt werden, sondern nur ganz rechts wo auch die uhrzeit,datum, antivir, lautstärke usw. soll es angezeigt werden, versteht ihr??
gibts für meine 2 probleme einen befehl, muss ich ne dll einbinden oder brauch ich die winapi??
mfg
parzival
p.s.: das programm wofür ich das brauch soll ein programm werden, welches mir anzeigt welche hausaufgaben ich noch machen muss :D

Re: Beim PC start das programm starten

Verfasst: 11.04.2010 20:57
von man-in-black
1) für den autostart, kannst du das Programm oder eine Verknüpfung in den Windows Autostart Ordner packen (sofern du Windows hast)
2) das rechts unten heißt systray und sollte unter dem namen in der hilfe zu finden sein
3) nein, du brauchst keine weiteren dlls :allright:

Re: Beim PC start das programm starten

Verfasst: 11.04.2010 21:05
von al90
Für den fall das du es nicht Händig kopieren möchtest.
Zum ermitteln des AutostartFolders kannst du das hier benutzen:

Code: Alles auswählen

Procedure.s Spec_Folder(clsi_const.l)
   Path.s = Space(2048)
   SHGetSpecialFolderLocation_(0,clsi_const,@pidl.l)
   SHGetPathFromIDList_(pidl,@Path)
   CoTaskMemFree_(pidl)
   ProcedureReturn Path+"\"
EndProcedure

Debug Spec_Folder(7)
Und um eine Verknüpfung zu erstellen das hier:

Code: Alles auswählen

Procedure.l CreateShellLink(Path$, Link$, Argument$, DESCRIPTION$, WorkingDirectory$, ShowCommand.l, HotKey.l, IconFile$, IconIndexInFile.l)
   CoInitialize_(0) 
   If CoCreateInstance_(?CLSID_ShellLink,0,1,?IID_IShellLink,@psl.IShellLinkA) = 0 
      
   Set_ShellLink_preferences: 
      
      ; The file TO which is linked ( = target for the Link ) 
      ; 
      psl\SetPath(@Path$) 
      
      ; Arguments for the Target 
      ; 
      psl\SetArguments(@Argument$) 
      
      ; Working Directory 
      ; 
      psl\SetWorkingDirectory(@WorkingDirectory$) 
      
      ; Description ( also used as Tooltip for the Link ) 
      ; 
      psl\SetDescription(@DESCRIPTION$) 
      
      ; Show command: 
      ;               SW_SHOWNORMAL    = Default 
      ;               SW_SHOWMAXIMIZED = aehmm... Maximized 
      ;               SW_SHOWMINIMIZED = play Unreal Tournament 
      psl\SetShowCmd(ShowCommand) 
      
      ; Hotkey: 
      ; The virtual key code is in the low-order byte, 
      ; and the modifier flags are in the high-order byte. 
      ; The modifier flags can be a combination of the following values: 
      ; 
      ;         HOTKEYF_ALT     = ALT key 
      ;         HOTKEYF_CONTROL = CTRL key 
      ;         HOTKEYF_EXT     = Extended key 
      ;         HOTKEYF_SHIFT   = SHIFT key 
      ; 
      psl\SetHotkey(HotKey) 
      
      ; Set Icon for the Link: 
      ; There can be more than 1 icons in an icon resource file, 
      ; so you have to specify the index. 
      ; 
      psl\SetIconLocation(@IconFile$, IconIndexInFile) 
      
      
   ShellLink_SAVE: 
      ; Query IShellLink For the IPersistFile interface For saving the 
      ; shortcut in persistent storage. 
      If psl\QueryInterface(?IID_IPersistFile,@ppf.IPersistFile) = 0 
        ; Ensure that the string is Unicode. 
        mem.s = Space(1000) ;AllocateMemory(1,1000) 
        MultiByteToWideChar_(#CP_ACP, 0, Link$, -1, mem, 1000) 
        ;Save the link by calling IPersistFile::Save. 
        hres = ppf\Save(@mem,#True) 
        result = 1 
        ppf\Release() 
      EndIf 
      psl\Release() 
   EndIf 
   CoUninitialize_() 
   ProcedureReturn result 
    
   DataSection 
     CLSID_ShellLink: 
       ; 00021401-0000-0000-C000-000000000046 
       Data.l $00021401 
       Data.w $0000,$0000 
       Data.b $C0,$00,$00,$00,$00,$00,$00,$46 
     IID_IShellLink: 
       ; DEFINE_SHLGUID(IID_IShellLinkA,         0x000214EEL, 0, 0); 
       ; C000-000000000046 
       Data.l $000214EE 
       Data.w $0000,$0000 
       Data.b $C0,$00,$00,$00,$00,$00,$00,$46 
     IID_IPersistFile: 
       ; 0000010b-0000-0000-C000-000000000046 
       Data.l $0000010B 
       Data.w $0000,$0000 
       Data.b $C0,$00,$00,$00,$00,$00,$00,$46 
   EndDataSection 

EndProcedure 
Systray-Beispiele müsste es auch auf PureArea.net geben soviel ich weis.

Re: Beim PC start das programm starten

Verfasst: 11.04.2010 21:08
von CSHW89
Hab grad auch noch ein Beispiel zusammen geschustert. Hab nämlich ein Systray-Beispiel auf die schnelle nicht gefunden:

Code: Alles auswählen

#WindowId = 0
#SystrayId = 0

If OpenWindow(#WindowId, 0, 0, 200, 100, "Test", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
  ; Hier musst du dein Icon laden
  image = ;LoadImage(0, "")
  
  ; Versteckt das Fenster
  HideWindow(#WindowId, 1)
  AddSysTrayIcon(#SystrayId, WindowID(#WindowId), image)
  
  Repeat
    event = WaitWindowEvent()
    
    If (event = #PB_Event_MinimizeWindow)
      If (EventWindow() = #WindowId)
        ; Versteckt das Fenster wieder
        HideWindow(#WindowId, 1)
        AddSysTrayIcon(#SystrayId, WindowID(#WindowId), image)
      EndIf
    EndIf
    
    If (event = #PB_Event_SysTray)
      If (EventGadget() = #SystrayId)
        ; Zeigt das Fenster an
        RemoveSysTrayIcon(#SystrayId)
        HideWindow(#WindowId, 0)
        SetWindowState(#WindowId, #PB_Window_Normal)
        SetActiveWindow(#WindowId)
      EndIf
    EndIf
    
  Until (event = #PB_Event_CloseWindow)
EndIf
ein icon musst du noch laden.

lg kevin

Re: Beim PC start das programm starten

Verfasst: 12.04.2010 12:56
von teejex
oder du machst es über einen registry-eintrag.

http://purearea.net/pb/CodeArchiv/Inclu ... nclude.pbi
Mit dem Script ist es nicht sonderlich schwierig einen zu erstellen.

CurrentMachine/User - Software - Microsoft - Windows - Current Version - Run
Tut mir leid, ich glaube ganz richtig ist der Schlüssel nicht :D

Grüße
Teejex

Edit: mit Ausführen->"regedit" kannst du nachschauen obs geklappt hat

Re: Beim PC start das programm starten

Verfasst: 27.04.2010 14:37
von parzival
hi,
sorry das ich so lange nicht geantwortet hab, hab einfach keine zeit gefunden mir die beispiele anzukucken, jetzt aber schon!
danke erstmal für die beispiele.
CSHW89´s hat mir sehr viel weiter geholfen aber die codes von al90 funktionieren leider nicht :(
liegts daran, dass ich die winapi nicht hab und wo ist eig. der autostart ordner? bei Windows xp fand ich ihn noch aber bei W7 hab ihc ihn nciht gefunden,
mfg
parzival

Re: Beim PC start das programm starten

Verfasst: 27.04.2010 15:43
von man-in-black
musst mal das startmenu bei win7 öffnen und dann auf "Alle Programme" gehn. irgendwo da is der autostartordner...

pfad (findest du bei den eigenschaften des ordners "Autostart" im startmenu):

C:\Users\-----DEIN------NAME-------\AppData\Roaming\Microsoft\Windows\Start Menu\Programs

Re: Beim PC start das programm starten

Verfasst: 27.04.2010 16:36
von davidpsd
Hallo!
parzival hat geschrieben:[...] die codes von al90 funktionieren leider nicht :(
liegts daran, dass ich die winapi nicht hab?
Die WinApi hat jeder der Windows benutzt, nur sind Zugriffe auf die WinApi nicht möglich, wenn du die Demo-Version von PB hast. Außerdem brauchst du den Code von al90 gar nicht, du musst dein Programm nur in den Autostart-Ordner reinschieben.

lG davidpsd