PureDispHelper UserLib - Update with Includefile for Unicode
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Most excellent contribution, should be taken native! Thanks so much for this.
Last edited by netmaestro on Fri Apr 20, 2007 3:53 pm, edited 1 time in total.
BERESHEIT
Good news: a unicode Version is in progress
,
but i think not 100% Syntaxcompatible.
The PB-TEAM has in the moment, no time for this, but we can hope a bit.

but i think not 100% Syntaxcompatible.
The PB-TEAM has in the moment, no time for this, but we can hope a bit.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

New example by Kiffi
Code: Select all
; example by Kiffi
EnableExplicit
Define.l ExcelApp, Workbook
dhToggleExceptions(#True)
ExcelApp = dhCreateObject("Excel.Application")
If ExcelApp
dhPutValue(ExcelApp, ".Visible = %b", #True)
dhGetValue("%o", @Workbook, ExcelApp, ".Workbooks.Add")
dhPutValue(ExcelApp, "Cells(%d, %d).Value = %s", 1, 1, @"Feel")
dhPutValue(ExcelApp, "Cells(%d, %d).Value = %s", 2, 1, @"the")
dhPutValue(ExcelApp, "Cells(%d, %d).Value = %s", 3, 1, @"pure")
dhPutValue(ExcelApp, "Cells(%d, %d).Value = %s", 4, 1, @"Power")
dhPutValue(ExcelApp, "Cells(%d, %d).Value = %s", 1, 2, @"the")
dhPutValue(ExcelApp, "Cells(%d, %d).Value = %s", 1, 3, @"pure")
dhPutValue(ExcelApp, "Cells(%d, %d).Value = %s", 1, 4, @"Power")
MessageRequester("PureDispHelper-ExcelDemo", "Click OK to close Excel")
dhCallMethod(ExcelApp, ".Quit")
dhReleaseObject(Workbook) : Workbook = 0
dhReleaseObject(ExcelApp) : ExcelApp = 0
Else
MessageRequester("PureDispHelper-ExcelDemo", "Couldn't create Excel-Object")
EndIf
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Okay, for srod another agent example with Merlinsrod wrote:This is great, please keep those examples coming!![]()

Code: Select all
; example by ts-soft
EnableExplicit
dhToggleExceptions(#True)
Define.l oAgent, oMerlin
Define.s item
oAgent = dhCreateObject("Agent.Control.2")
If oAgent = 0
[img]http://ts-soft.eu/dl/puredisphelper.png[/img] Debug "error: can't create object"
End
EndIf
dhPutValue(oAgent, "Connected = %b", #True)
dhCallMethod(oAgent, "Characters.Load(%s,%s)", @"Merlin", @"Merlin.acs")
dhGetValue("%o", @oMerlin, oAgent, "Characters(%s)", @"Merlin")
If oMerlin = 0
Debug "error: can't create object"
End
EndIf
dhCallMethod(oMerlin, "Show")
If OpenWindow(0, 0, 0, 200, 200, "Merlin - Demo", #PB_Window_ScreenCentered|#PB_Window_SystemMenu) And CreateGadgetList(WindowID(0))
ListViewGadget(0, 5, 5, 190, 165)
ButtonGadget(1, 70, 177, 60, 20, "Play")
Restore Merlin
Repeat
Read item
If item <> ""
AddGadgetItem(0, #PB_Any, item)
EndIf
Until item = ""
dhCallMethod(oMerlin, "MoveTo(%d,%d)", WindowX(0) + 40, WindowY(0) - 120)
dhCallMethod(oMerlin, "Play(%s)", @"GetAttention")
dhCallMethod(oMerlin, "Play(%s)", @"GetAttentionContinued")
dhCallMethod(oMerlin, "Speak(%s)", @"Can I do something for you?")
dhCallMethod(oMerlin, "Play(%s)", @"GetAttentionReturn")
SetGadgetState(0, 0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
CloseWindow(0)
dhCallMethod(oMerlin, "Stop")
dhCallMethod(oMerlin, "Play(%s)", @"Hide")
Delay(3000)
Break
Case #PB_Event_MoveWindow
dhCallMethod(oMerlin, "MoveTo(%d,%d)", WindowX(0) + 40, WindowY(0) - 120)
Case #PB_Event_Gadget
Select EventGadget()
Case 1
item = GetGadgetText(0)
If Item = "Speak"
Item = InputRequester("Merlin", "What should i say?", "")
If Item <> ""
dhCallMethod(oMerlin, "Speak(%s)", @Item)
EndIf
Else
dhCallMethod(oMerlin, "Stop")
dhCallMethod(oMerlin, "Play(%s)", @item)
EndIf
EndSelect
EndSelect
ForEver
EndIf
dhReleaseObject(oMerlin)
dhReleaseObject(oAgent)
DataSection
Merlin:
Data.s "Acknowledge", "Alert", "Announce", "Blink", "Confused", "Congratulate"
Data.s "Congratulate_2", "Decline", "DoMagic1", "DoMagic2", "DontRecognize"
Data.s "Explain", "GestureDown", "GestureLeft", "GestureRight", "GestureUp"
Data.s "GetAttention", "GetAttentionContinued", "GetAttentionReturn", "Greet"
Data.s "Hearing_1", "Hearing_2", "Hearing_3", "Hearing_4", "Hide", "Idle1_1"
Data.s "Idle1_2", "Idle1_3", "Idle1_4", "Idle2_1", "Idle2_2", "Idle3_1", "Idle3_2"
Data.s "LookDown", "LookDownBlink", "LookDownReturn", "LookLeft", "LookLeftBlink"
Data.s "LookLeftReturn", "LookRight", "LookRightBlink", "LookRightReturn"
Data.s "LookUp", "LookUpBlink", "LookUpReturn", "MoveDown", "MoveLeft", "MoveRight"
Data.s "MoveUp", "Pleased", "Process", "Processing", "Read", "ReadContinued"
Data.s "Reading", "ReadReturn", "Sad", "Search", "Searching", "Show", "Speak"
Data.s "StartListening", "StopListening", "Suggest", "Surprised", "Think", "Thinking"
Data.s "Uncertain", "Wave", "Write", "WriteContinued", "WriteReturn", "Writing"
Data.s ""
EndDataSection

Have fun
Last edited by ts-soft on Sat Apr 21, 2007 11:42 am, edited 1 time in total.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

* Takes a seat in the duffers section *srod wrote:This is great, please keep those examples coming!![]()
For COM duffers like myself, I need all the examples I can get hold of!
Thanks.
Hear Hear!
This is really good. The problem now is the candy (flash, movies, etc) are distracting me from the meat (ADO, etc).
Dare2 cut down to size

(Pokes head out from around duffers corner to ask ts-soft a ridiculously dumb question!)
ts-soft: when creating an object; e.g. in your example above, how do know the name of the object? E.g. you used 'Agent.Control.2' in the above example. Where do you find details on these names?
Thanks.
I may look like a mule, but I'm not a complete ass.
>> Where do you find details on these names?
PSDK, Ole-COM ObjectViewer, Help for VBScript/VB, Google, VB-Foren and Biily
Many c-examples in the source-package of disphelper!
PSDK, Ole-COM ObjectViewer, Help for VBScript/VB, Google, VB-Foren and Biily

Many c-examples in the source-package of disphelper!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Right, I think a crash course in VBScript is called for.
Thanks.
Reiterating someone else's suggestion; a COM section to these forums would be great, especially now that you've opened up the world of COM to duffers like myself and dare with this brilliant piece of work.
Right, who runs these forums? Fred lad where are you?

Thanks.
Reiterating someone else's suggestion; a COM section to these forums would be great, especially now that you've opened up the world of COM to duffers like myself and dare with this brilliant piece of work.
Right, who runs these forums? Fred lad where are you?

I may look like a mule, but I'm not a complete ass.