Simples Beispiel per COM Windows-Dialoge anzuzeigen

Hier könnt Ihr gute, von Euch geschriebene Codes posten. Sie müssen auf jeden Fall funktionieren und sollten möglichst effizient, elegant und beispielhaft oder einfach nur cool sein.
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Simples Beispiel per COM Windows-Dialoge anzuzeigen

Beitrag von ts-soft »

Code: Alles auswählen

; Simple Example for use shell.application object
; Autor: ts-soft
; Requires PB4.xx
; 25.03.2007

Procedure CreateShellObject()
  Protected obj.l, hResult.l

  CoInitialize_(#Null)
  hResult = CoCreateInstance_(?CLSID_Shell_Application, 0, 1, ?IID_IShellDispatch, @obj)

  If Not hResult
    ProcedureReturn obj
  Else
    ProcedureReturn #False
  EndIf

  DataSection
    CLSID_Shell_Application:  ; {13709620-C279-11CE-A49E-444553540000}
    Data.l $13709620
    Data.w $C279,$11CE
    Data.b $A4,$9E,$44,$45,$53,$54,$0,$0
    IID_IShellDispatch:  ; {D8F015C0-C278-11CE-A49E-444553540000}
    Data.l $D8F015C0
    Data.w $C278,$11CE
    Data.b $A4,$9E,$44,$45,$53,$54,$0,$0
  EndDataSection
EndProcedure

Procedure ReleaseShellObject(obj.l)
  Protected object.IUnknown = obj
  object\Release()
EndProcedure

Define.IShellDispatch shell

shell = CreateShellObject()
If shell
  shell\MinimizeAll()       ; alle Fenster minimieren
  shell\Help()              ; Windows Hilfe aufrufen
  shell\UndoMinimizeALL()   ; minimieren rückgängig machen
  shell\ShutdownWindows()   ; Computer ausschalten Dialog
  shell\SetTime()           ; Uhrzeit setzen
  shell\FileRun()           ; Ausführen Dialog

  ReleaseShellObject(shell)
EndIf
Weitere Methoden finder Ihr im Interface (Werkzeug: Structureanzeiger)
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
flype
Beiträge: 15
Registriert: 28.02.2006 23:03
Wohnort: France, Nantes

Beitrag von flype »

danke tssoft :allright:
Bild Bild
flype
Beiträge: 15
Registriert: 28.02.2006 23:03
Wohnort: France, Nantes

Beitrag von flype »

(very sorry in english)

i think there's should be much more includes in this pack.
if you are agree, i will send you some includes i would like to see your in includepack.

i understood that the includes must respect a standard (EnableExplicit and so...) which is perfect as it is also the way i work.
Bild Bild
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

flype hat geschrieben: i think there's should be much more includes in this pack.
if you are agree, i will send you some includes i would like to see your in includepack.
Ok, thanks
You can send me the links as PM or in this thread:
http://www.purebasic.fr/german/viewtopi ... ncludepack
or in the thread in english-forum
http://www.purebasic.fr/english/viewtop ... ncludepack

Greetings .. Thomas
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Antworten