PureDispHelper UserLib - Update with Includefile for Unicode
Thanks very much for this, ts-soft. I was wondering whether someone had done anything with this lib (I looked at it for FreeBasic, but never got into it fully). This will help for my WMI project.
Thanks again!
Thanks again!
Win10, PB6.x, okayish CPU, onboard video card, fuzzy monitor (or is that my eyesight?)
"When the facts change, I change my mind" - John Maynard Keynes
"When the facts change, I change my mind" - John Maynard Keynes
Update Version 1.1
Added an extra lib to support ocx-gadgets
Syntax:
This function isn't in the helpfile, but there 2 examples added, using is easy!
I hope it works with all OCX
STrainbowBar.ocx in action:

Added an extra lib to support ocx-gadgets
Syntax:
Code: Select all
object = OCX_CreateGadget(Gadget.l, x.l, y.l, widht, height.l, ProgID.s)
I hope it works with all OCX
STrainbowBar.ocx in action:

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.

The using an PB_Container, but a call of AtlAxCreateControl is required.srod wrote: Are they using a browser control as a container?
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.

Is it possible to catch the events of an ActiveX ?
I'm trying to use the ActiveX of CodeJock (www.codejock.com)
Thanks.
I'm trying to use the ActiveX of CodeJock (www.codejock.com)
Thanks.
Code: Select all
XIncludeFile "..\Register_Unregister_ActiveX.pb"
EnableExplicit
dhToggleExceptions(#True)
Define.l oRainbow1, i
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 400, 375, "Calendar") And CreateGadgetList(WindowID(0))
oRainbow1 = OCX_CreateGadget(1, 5, 5, 390, 370, "Codejock.CalendarControl.11.1.0")
dhPutValue(oRainbow1, "ViewType = %d", 2)
While WaitWindowEvent() ! 16 : Wend
CloseWindow(0)
If oRainbow1 : dhReleaseObject(oRainbow1) : EndIf
EndIf
LuckyLuke
@Thomas: 
@all:
here is a quick conversion of a vb-sourcecode to display the fabulous
RMChart-Control.

The Chart (including an Help file which contains also all necessary
constants) can be downloaded here: http://www.rmchart.com/
Have fun!
Greetings ... Kiffi

@all:
here is a quick conversion of a vb-sourcecode to display the fabulous
RMChart-Control.
Code: Select all
EnableExplicit
#RMC_DATAAXISLEFT=1
#RMC_LINESTYLEDOT=2
#RMC_LABELAXISBOTTOM=8
#RMC_TEXTCENTER=0
#RMC_LINESTYLENONE=6
#RMC_BARSINGLE=1
#RMC_BAR_FLAT_GRADIENT2=3
#RMC_HATCHBRUSH_OFF=0
#RMC_BICOLOR_LABELAXIS=2
#RMC_CTRLSTYLEFLAT=0
Define.l oRMChart
dhToggleExceptions(#True)
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 640, 450, "RMChart") And CreateGadgetList(WindowID(0))
oRMChart = OCX_CreateGadget(1, 0, 0, 640, 450, "RMChart.RMChartX")
Debug oRMChart
If oRMChart
; '************** Design the chart **********************
dhCallMethod(oRMChart, ".Reset")
dhPutValue(oRMChart, ".Font = %s", @"Comic Sans MS")
dhPutValue(oRMChart, ".RMCBackColor = %u", -984833) ; 'AliceBlue'
dhPutValue(oRMChart, ".RMCStyle = %d", #RMC_CTRLSTYLEFLAT)
dhPutValue(oRMChart, ".RMCWidth = %d", 640)
dhPutValue(oRMChart, ".RMCHeight = %d", 450)
; ************** Add Region 1 *****************************
dhCallMethod(oRMChart, ".AddRegion")
dhPutValue(oRMChart, ".Region(%d).Left = %u", 1, 5)
dhPutValue(oRMChart, ".Region(%d).Top = %u", 1, 5)
dhPutValue(oRMChart, ".Region(%d).Width = %u", 1, -5)
dhPutValue(oRMChart, ".Region(%d).Height = %u", 1, -5)
dhPutValue(oRMChart, ".Region(%d).Footer = %s", 1, @"")
; ************** Add caption to region 1 *******************
dhCallMethod(oRMChart, ".Region(%d).AddCaption", 1)
dhPutValue(oRMChart, ".Region(%d).Caption.Titel = %s", 1, @"This is the chart's caption")
dhPutValue(oRMChart, ".Region(%d).Caption.BackColor = %u", 1, -16776961) ; 'Blue'
dhPutValue(oRMChart, ".Region(%d).Caption.TextColor = %u", 1, -256) ; 'Yellow'
dhPutValue(oRMChart, ".Region(%d).Caption.FontSize = %d", 1, 11)
dhPutValue(oRMChart, ".Region(%d).Caption.Bold = %b", 1, #True)
; ************** Add grid to region 1 *****************************
dhCallMethod(oRMChart, ".Region(%d).AddGrid", 1)
dhPutValue(oRMChart, ".Region(%d).Grid.BackColor = %u", 1, -657956) ; 'Beige'
dhPutValue(oRMChart, ".Region(%d).Grid.AsGradient = %b", 1, #False)
dhPutValue(oRMChart, ".Region(%d).Grid.BicolorMode = %d", 1, #RMC_BICOLOR_LABELAXIS)
dhPutValue(oRMChart, ".Region(%d).Grid.Left = %d", 1, 0)
dhPutValue(oRMChart, ".Region(%d).Grid.Top = %d", 1, 0)
dhPutValue(oRMChart, ".Region(%d).Grid.Width = %d", 1, 0)
dhPutValue(oRMChart, ".Region(%d).Grid.Height = %d", 1, 0)
; ************** Add data axis to region 1 *****************************
dhCallMethod(oRMChart, ".Region(%d).AddDataAxis", 1)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).Alignment = %d", 1, 1, #RMC_DATAAXISLEFT)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).MinValue = %d", 1, 1, 0)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).MaxValue = %d", 1, 1, 100)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).TickCount = %d", 1, 1, 11)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).FontSize = %d", 1, 1, 8)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).TextColor = %u", 1, 1, -16777216) ; 'Black'
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).LineColor = %u", 1, 1, -16777216) ; 'Black'
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).LineStyle = %d", 1, 1, #RMC_LINESTYLEDOT)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).DecimalDigits = %d", 1, 1, 0)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).AxisUnit = %s", 1, 1, @"")
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).AxisText = %s", 1, 1, @"")
; ************** Add label axis to region 1 *****************************
dhCallMethod(oRMChart, ".Region(%d).AddLabelAxis", 1)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.AxisCount = %d", 1, 1)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.TickCount = %d", 1, 5)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.Alignment = %d", 1, #RMC_LABELAXISBOTTOM)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.FontSize = %d", 1, 8)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.TextColor = %u", 1, -16777216) ; 'Black'
dhPutValue(oRMChart, ".Region(%d).LabelAxis.TextAlignment = %d", 1, #RMC_TEXTCENTER)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.LineColor = %u", 1, -16777216) ; 'Black'
dhPutValue(oRMChart, ".Region(%d).LabelAxis.LineStyle = %d", 1, #RMC_LINESTYLENONE)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.LabelString = %s", 1, @"Label 1*Label 2*Label 3*Label 4*Label 5")
; ;************** Add Series 1 to region 1 *******************************
;
dhCallMethod(oRMChart, ".Region(%d).AddBarSeries", 1)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).SeriesType = %d", 1, 1, #RMC_BARSINGLE)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).SeriesStyle = %d", 1, 1, #RMC_BAR_FLAT_GRADIENT2)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).Lucent = %b", 1, 1, #False)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).Color = %u", 1, 1, -10185235) ; 'CornflowerBlue'
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).Horizontal = %b", 1, 1, #False)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).WhichDataAxis = %d", 1, 1, 1)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).ValueLabelOn = %b", 1, 1, #False)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).PointsPerColumn = %d", 1, 1, 1)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).HatchMode = %d", 1, 1, #RMC_HATCHBRUSH_OFF)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).DataString = %s", 1, 1, @"50*70*40*60*30")
dhCallMethod(oRMChart, ".Draw")
EndIf
While WaitWindowEvent() ! 16 : Wend
CloseWindow(0)
If oRMChart : dhReleaseObject(oRMChart) : EndIf
EndIf

The Chart (including an Help file which contains also all necessary
constants) can be downloaded here: http://www.rmchart.com/
Have fun!
Greetings ... Kiffi
Last edited by Kiffi on Tue Apr 24, 2007 11:05 pm, edited 1 time in total.
I think, you can't use events, only you can get the values with a timer.LuckyLuke wrote:Is it possible to catch the events of an ActiveX ?
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.

-
- PureBasic Expert
- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
Find & Replace a text in word...
Code: Select all
dhToggleExceptions(#True)
Define.l oWord = dhCreateObject("Word.Application")
text.s="PureDispHelper Sample"+Chr(13)+Chr(10)
wdReplaceAll.l = 2
If oWord
dhPutValue (oWord, "Visible = %b", #True)
dhCallMethod (oWord, "Documents.Add")
dhCallMethod (oWord, "Selection.TypeText(%s)", @text)
dhCallMethod (oWord, "Selection.TypeText(%s)", @text)
dhCallMethod (oWord, "Selection.TypeText(%s)", @text)
dhCallMethod (oWord, "Selection.TypeText(%s)", @text)
;Find & Replace in Word
dhCallMethod (oWord,"Selection.Goto = %u",0,0,0)
dhPutValue (oWord,"Selection.Find.Forward = %b",#True)
dhPutValue (oWord,"Selection.Find.MatchWholeWord = %b",#True)
dhPutValue (oWord,"Selection.Find.Text = %s",@"Sample")
dhPutValue (oWord,"Selection.Find.Replacement.Text = %s",@"DONE")
dhCallMethod (oWord, "Selection.Find.Execute(%m,%m,%m,%m,%m,%m,%m,%m,%m,%m,%u)",wdReplaceAll)
dhReleaseObject (oWord) : oWord = 0
EndIf
Nice one. I'd managed to get the first instance of 'Sample' highlighted, but couldn't complete it.
Where did you get the information on the missing parameters?
**EDIT: found the info.
http://www.romanpress.com/cbooks/Word2_ ... eplace.htm
Where did you get the information on the missing parameters?
**EDIT: found the info.
http://www.romanpress.com/cbooks/Word2_ ... eplace.htm
I may look like a mule, but I'm not a complete ass.
Small Update:
Some OCX haven't a ProgID.s, so i have added an optional parameter for
CLISD.s
Syntax:
Some OCX haven't a ProgID.s, so i have added an optional parameter for
CLISD.s
Syntax:
Code: Select all
Object = OCX_CreateGadget(Gadget, x, y, width, height, ProgID.s[, CLSID.s])
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.

Ts-Soft and Kiffi : Thanks!!! Very good work.
Here is Kiffi's RMChart-Control example, with a new main loop to change bar sizes on real time.
Here is Kiffi's RMChart-Control example, with a new main loop to change bar sizes on real time.
Code: Select all
#RMC_DATAAXISLEFT=1
#RMC_LINESTYLEDOT=2
#RMC_LABELAXISBOTTOM=8
#RMC_TEXTCENTER=0
#RMC_LINESTYLENONE=6
#RMC_BARSINGLE=1
#RMC_BAR_FLAT_GRADIENT2=3
#RMC_HATCHBRUSH_OFF=0
#RMC_BICOLOR_LABELAXIS=2
#RMC_CTRLSTYLEFLAT=0
Define.l oRMChart
dhToggleExceptions(#True)
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
hwnd= OpenWindow(0, #PB_Ignore, #PB_Ignore, 640, 450, "RMChart")
StickyWindow(0,1)
CreateGadgetList(hwnd)
oRMChart = OCX_CreateGadget(1, 0, 0, 640, 450, "RMChart.RMChartX")
Debug oRMChart
If oRMChart
; '************** Design the chart **********************
dhCallMethod(oRMChart, ".Reset")
dhPutValue(oRMChart, ".Font = %s", @"Comic Sans MS")
dhPutValue(oRMChart, ".RMCBackColor = %u", -984833) ; 'AliceBlue'
dhPutValue(oRMChart, ".RMCStyle = %d", #RMC_CTRLSTYLEFLAT)
dhPutValue(oRMChart, ".RMCWidth = %d", 640)
dhPutValue(oRMChart, ".RMCHeight = %d", 450)
; ************** Add Region 1 *****************************
dhCallMethod(oRMChart, ".AddRegion")
dhPutValue(oRMChart, ".Region(%d).Left = %u", 1, 5)
dhPutValue(oRMChart, ".Region(%d).Top = %u", 1, 5)
dhPutValue(oRMChart, ".Region(%d).Width = %u", 1, -5)
dhPutValue(oRMChart, ".Region(%d).Height = %u", 1, -5)
dhPutValue(oRMChart, ".Region(%d).Footer = %s", 1, @"")
; ************** Add caption to region 1 *******************
dhCallMethod(oRMChart, ".Region(%d).AddCaption", 1)
dhPutValue(oRMChart, ".Region(%d).Caption.Titel = %s", 1, @"Press right button and move mouse")
dhPutValue(oRMChart, ".Region(%d).Caption.BackColor = %u", 1, -16776961) ; 'Blue'
dhPutValue(oRMChart, ".Region(%d).Caption.TextColor = %u", 1, -256) ; 'Yellow'
dhPutValue(oRMChart, ".Region(%d).Caption.FontSize = %d", 1, 11)
dhPutValue(oRMChart, ".Region(%d).Caption.Bold = %b", 1, #True)
; ************** Add grid to region 1 *****************************
dhCallMethod(oRMChart, ".Region(%d).AddGrid", 1)
dhPutValue(oRMChart, ".Region(%d).Grid.BackColor = %u", 1, -657956) ; 'Beige'
dhPutValue(oRMChart, ".Region(%d).Grid.AsGradient = %b", 1, #False)
dhPutValue(oRMChart, ".Region(%d).Grid.BicolorMode = %d", 1, #RMC_BICOLOR_LABELAXIS)
dhPutValue(oRMChart, ".Region(%d).Grid.Left = %d", 1, 0)
dhPutValue(oRMChart, ".Region(%d).Grid.Top = %d", 1, 0)
dhPutValue(oRMChart, ".Region(%d).Grid.Width = %d", 1, 0)
dhPutValue(oRMChart, ".Region(%d).Grid.Height = %d", 1, 0)
; ************** Add data axis to region 1 *****************************
dhCallMethod(oRMChart, ".Region(%d).AddDataAxis", 1)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).Alignment = %d", 1, 1, #RMC_DATAAXISLEFT)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).MinValue = %d", 1, 1, 0)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).MaxValue = %d", 1, 1, 100)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).TickCount = %d", 1, 1, 11)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).FontSize = %d", 1, 1, 8)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).TextColor = %u", 1, 1, -16777216) ; 'Black'
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).LineColor = %u", 1, 1, -16777216) ; 'Black'
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).LineStyle = %d", 1, 1, #RMC_LINESTYLEDOT)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).DecimalDigits = %d", 1, 1, 0)
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).AxisUnit = %s", 1, 1, @"")
dhPutValue(oRMChart, ".Region(%d).DataAxis(%d).AxisText = %s", 1, 1, @"")
; ************** Add label axis to region 1 *****************************
dhCallMethod(oRMChart, ".Region(%d).AddLabelAxis", 1)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.AxisCount = %d", 1, 1)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.TickCount = %d", 1, 5)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.Alignment = %d", 1, #RMC_LABELAXISBOTTOM)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.FontSize = %d", 1, 8)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.TextColor = %u", 1, -16777216) ; 'Black'
dhPutValue(oRMChart, ".Region(%d).LabelAxis.TextAlignment = %d", 1, #RMC_TEXTCENTER)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.LineColor = %u", 1, -16777216) ; 'Black'
dhPutValue(oRMChart, ".Region(%d).LabelAxis.LineStyle = %d", 1, #RMC_LINESTYLENONE)
dhPutValue(oRMChart, ".Region(%d).LabelAxis.LabelString = %s", 1, @"Label 1*Label 2*Label 3*Label 4*Label 5")
; ;************** Add Series 1 to region 1 *******************************
;
dhCallMethod(oRMChart, ".Region(%d).AddBarSeries", 1)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).SeriesType = %d", 1, 1, #RMC_BARSINGLE)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).SeriesStyle = %d", 1, 1, #RMC_BAR_FLAT_GRADIENT2)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).Lucent = %b", 1, 1, #False)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).Color = %u", 1, 1, -10185235) ; 'CornflowerBlue'
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).Horizontal = %b", 1, 1, #False)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).WhichDataAxis = %d", 1, 1, 1)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).ValueLabelOn = %b", 1, 1, #False)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).PointsPerColumn = %d", 1, 1, 1)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).HatchMode = %d", 1, 1, #RMC_HATCHBRUSH_OFF)
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).DataString = %s", 1, 1, @"50*70*40*60*30")
dhCallMethod(oRMChart, ".Draw")
EndIf
#SEP="*"
Repeat
EV=WaitWindowEvent()
_DX=DesktopMouseX()
_DY=DesktopMouseY()
_MK=Abs(GetAsyncKeyState_(#VK_LBUTTON) +GetAsyncKeyState_(#VK_RBUTTON)*2+GetAsyncKeyState_(#VK_MBUTTON)*3)/$8000
If _MK=2
A$=Str(_DX / 10)
B$=Str(_DY / 10)
c$=Str((_DX+_DY)/10)
d$=Str((_DX+_DY)/7)
e$=Str((_DX+_DY)/20)
Value$=A$+#SEP+B$+#SEP+c$+#SEP+d$+#SEP+e$+#SEP
dhPutValue(oRMChart, ".Region(%d).BarSeries(%d).DataString = %s", 1, 1, @Value$)
dhCallMethod(oRMChart, ".Draw")
EndIf
Until EV=#WM_CLOSE
If oRMChart : dhReleaseObject(oRMChart) : EndIf
CloseWindow(0)
End