Click here to Skip to main content
15,881,248 members

Comments by Jaroslav Mitrovic (Top 6 by date)

Jaroslav Mitrovic 11-Oct-18 3:28am View    
Hi,

maybe then there is a reason for the Supplier to place it in his Demo...
It is possible that the Value inside the Variable (I assume "msg") can be changed meanwhile.
But anyway the Messages of type "OK" are the only ones that are Processed, so why then Read it in again? If You get wrong Results, or out of order maybe You are forced to read the Value inside the Loop also.
If that is the Case You need a Caching strategy for the Values (?) if this is a necassity Try a FiFo LiFo or some of these Fancy Named Stack´s or Queue´s ;) .
But be aware FiFi sound cute but she is really Big (doberman´s usally are...).

O.K. Funny Bone asside...

I would Use a Select-Case for the If-Statements.

And also Refactor it inside a "outsourced" Function.

Maybe You can "Group" the Outputs with something like
Case msg.id >= 420 AndAlso msg.id <= 463
'Do something about the ByteValues

etc.

Good Luck and Happy Coding
Jaroslav Mitrovic 28-Sep-18 20:45pm View    
Hi.

I could not see any harmfull Stuff...

But maybe The two calls of "retval = Lawicel.CANUSB.canusb_Read(h, msg)" inside the loop are too much. I would try to get rid of the first Call (if Time critical then the last Call). Ahh I missed it... got it now. You are using the First Call to store the "retval" for the While condition, but you later on recall it inside the WhileLoop (at the End), try to get rid of the Last Call of "retval = Lawicel.CANUSB.canusb_Read(h, msg)".

c.u. Zui from Hamburg
Jaroslav Mitrovic 5-Jun-18 5:09am View    
Hi.
As I know, there is not such Funcionality built into the VideoPlayerControl.
You need to Create an "derived" Control of it and build in the "PART_" for the UI to have Marker´s and to handle the Events for it also.
Please get familiar with the Word "CustomControl" or at least "UserControl".
A strategy could be to try a Test Draft as a UserControl and then if needed to create a CustomControl, by Derive the VideoplayerControl and add the desired functionality.

I wanted to answer, but can´t find my old Videoplayer in "Star Trek LCARS" Style.
I needed the "Elbows" to be calculated into the Control on Creation, so i was forced to create a CustomControl (Derived from somethin I forgot...)

Also please consider how to use the "Markers". I used the "ProgressBar"-Approach for the Playtime and I had to put over that a Canvas-Control to place the Markers according to the Timespan from the Begin of the Video to the Marker.

Also be Precize with the TimeCalculation, please stay at the Marker Generation/Placement in the VideoPlayer Scale/Measure like "Frames per Second". In The UI you should only use a "Stringformat" to cut the String into Somthing like "1h:10Min:10Sec.100frames" -> "1:10:10.100".
These Markers can then be reused as Bookmarks, where te User should add Informations/Annotations to the Bookmark.

Basicaly I set TimeSpans, that are displayed as Markers, and a Bookmark-Marker is with additional Infos about the Marker. I wanted a Function to skip the Intro in Star Trek Voyager Episodes, like "Netflix" Nowadays has the "Skip Intro" button. For that You need to handle the Player "Momentum", to skip a Timespan (defined by two Markers, set by the User).

A little bit off the Topic, but to get a gripping Buzzwording about it... That´s so 90´ies

c.u. and greetings from sunny Hamburg
Jaroslav Mitrovic 18-Jan-18 3:24am View    
Hi, InfinityJoe.

I have some ideas about it, but I am quiet not sure, never written C++ (admitted only twice).

I found this about the #pragma comment:
"https://books.google.de/books?id=CbwYAAAAQBAJ&pg=PA295&lpg=PA295&dq=pragma+comment+to+vb&source=bl&ots=k3QIlHouHv&sig=USsi9pSYiW_-Ml4piYemv9ETbnQ&hl=de&sa=X&ved=0ahUKEwjVzp_xgOHYAhWKYlAKHfmyCd4Q6AEIMjAB#v=onepage&q=pragma%20comment%20to%20vb&f=false"

So I think you want to use a DLL in your .NET right? In codeproject there are alot of DLL Import Examples.
Not really hard to get it done.
The Problem is the managed vs. unmanaged Dll Imports in VB.NET. There are also Workarounds, but it seems it is not the issue here.

So "#pragma" means shared memory usage is intended...
The "comment" is pointing to the "Sectione/Part" of the DLL which will be used in the Shared memory...

"#pragma" do "THIS" in the Compiler with "comment(lib,"pdh.lib")" so with "THAT PART" 'lib' from 'pdh.lib'

hmmmm... dunno just making a gues.

So I wouldnt think about it because you will use the DLL by setting in the Project in the IDE anyway the Reference? I think that ist only the C++ way to do it.

If you can access the DLL and instatiate something in it or use a Function aof the DLL, you shuld be good to go.

Also these Wprint thingies.

You are right just by examining the code it must be some kind of ".writeline"

wprintf(LvbLf & """%2.2d/%2.2d/%4.4d %2.2d:%2.2d:%2.2d.%3.3d""", SampleTime.wMonth, SampleTime.wDay, SampleTime.wYear, SampleTime.wHour, SampleTime.wMinute, SampleTime.wSecond, SampleTime.wMilliseconds)


Console.Write(",""{0:g20}""", DisplayValue.doubleValue)

You know this right?
Debug.WriteLine("The begin of my line: {0} {1} some filling Text between the Second Value and the Last Value {2}""", WhateverValue0, WhateverValue1, WhateverValue2)

Debug.Write("My Cpu Result: {0:g20}" , MyCpuResult.Value}
Is just the Value in special Formatting, and it seems C++ is doing it in a "I am very special and Unreadable" way. lol

For that it would be the best to use a DateTime.
Use the "SampleTime" and somehow convert it.
If needed make a Converting-Function from "SampleTime" To Sample-DateTime.

From Microsoft:


Dim dateString, format As String
Dim result As Date
Dim provider As CultureInfo = CultureInfo.InvariantCulture

' Parse date-only value with invariant culture.
dateString = "06/15/2008"
format = "d"
Try
result = Date.ParseExact(dateString, format, provider)
Console.WriteLine("{0} converts to {1}.", dateString, result.ToString())
Catch e As FormatException
Console.WriteLine("{0} is not in the correct format.", dateString)
End Try


So just use all the "SampleTime.WhateverValues" and use them to instantiate a DateTime Object.
And if the "SampleTime.wMonth" is of a numeric value you are go to go also. You can pass in Values as Parameters to Instantiate a DateTime.
If the "SampleTime.wMonth" is a String (and the others too) use the ".Parse()" Function of the DateTime Object.

Also consider to use TimeSpans, in the .NET they are really Performate and Optimized to handle TimeRelated Datastructures and do als fast Computation on them.
And the best of it it has the ".ToString()" Method where you can Pass the Output Format in a Short Syntax .("I am very special and less Unreadable then the C++ Stuff over there..."

no real Solution but maybe a hint...

c.u. Zui from Hamburg
Jaroslav Mitrovic 17-Jan-18 6:52am View    
thx. savior of the Universe lol