Hello Guest it is April 18, 2024, 08:39:10 PM

Author Topic: Mach3 Plugin Tutorial Document and Prototype File Set  (Read 140033 times)

0 Members and 1 Guest are viewing this topic.

Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #70 on: February 10, 2009, 11:25:29 AM »
Hi Tom,

Are you using DbgMsg from my tutorial?  If you enable that in the 10 HZ loop you will get flodded with output but you can see if mYupdate is being called.  myHighSpeedUpdate is NEVER called by Mach3 it is a timer, but if you are using it there is a watchdog in the code that will disable it if myUpdate stops (meaning your plugin thread has crashed).

ANYTHING you do in myUpdate needs to be VERY fast and you must return control to Mach3 ASAP or you will crash.

Here is a good article on time and timers and why they will never be very precise.

http://www.codeproject.com/KB/system/simpletime.aspx

What you should do is run a scheduling thread and have it PostMessage a notification to the dialog window at 100MS intervals.  This will be much closer.

Here is an article on multithreading.

http://www.codeproject.com/KB/threads/MultithreadingTutorial.aspx

-James





Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #71 on: February 10, 2009, 04:16:39 PM »
Hello James,

Art pointed me in the right direction.

I am using your tutorial and modifying it to experiment. I was using myUpdate() to refresh the video display. That was perfect until it stopped working a couple of days ago. As it turns out, I accidentally turned off the plugin on the config menu. I never suspected that since I use config to start the dialog box.

> Are you using DbgMsg from my tutorial? 

Yes. I am using most of your tutorial as a starting point.

> myHighSpeedUpdate is NEVER called by Mach3 it is a timer, but if you are using it there is a
> watchdog in the code that will disable it if myUpdate stops (meaning your plugin thread has crashed).

Thanx, good to know.

> ANYTHING you do in myUpdate needs to be VERY fast and you must return control to Mach3
> ASAP or you will crash.

Good point. Now that I have it working again I will change to a SetTimer() to avoid trouble.

> Here is a good article on time and timers and why they will never be very precise.

Thanx. Good reading.

This is not for precision. I just need to refresh the video display several times a second. 10Hz worked well enough that I will start with a 100ms timer. No big deal if the timer callback is late.

However, I would still like to know how to include a timer in a modeless dialog box. I see how others have done it but when I try to edit my source code the compiler complains. So I expect there is a resource editor protocol for doing this. Searching codeproject and google and the compiler's help have not shown me the way.

Is there a standard way to do this or should I just edit the source code?

Tom Hubin
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #72 on: February 10, 2009, 05:19:18 PM »
Tom,

I don't know of a way to do this visually.  Just use the SDK calls and provide the window handle of the dialog.  It should work for what you need to do.  Consider learning multithreading.  Timers get to be a reall mess very quickly, and they always use resources even if then is nothing to do when the WM_TIMER message is received.  For one or two, no problem though.

-James
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #73 on: February 10, 2009, 05:28:04 PM »
Hello,

I have SetTimer() working ok for 100ms webcam display refresh. Works just fine. Not using myUpdate() for anything now.

So, on to the next hitch.

I would like to save the data that the user has entered in the various places on the dialog box. I used UpdateData() to get it all into double and integer variables.

I see that others have used some Read and WriteProfileString and WriteProfileInt functions. These seem to be defined in XMLProfile.cpp. Is this the recommended way to save and retrieve data?

I do not see a function for saving floating point numbers. Is it necessary to convert to a string then save the string?

Tom Hubin
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #74 on: February 10, 2009, 07:20:08 PM »
Hi Tom,

Yes convert numbers to strings then store them in a .INI file,  use GetPrivateProfileString to read the data:

http://msdn.microsoft.com/en-us/library/ms724353(VS.85).aspx

and WritePrivateProfileString to write to the .INI file

http://msdn.microsoft.com/en-us/library/ms725501(VS.85).aspx

example: A file that contain options settings would contain

[options]
option1=string1
option2=string2

You CAN put INTs into a profile file (.INI file) but I don't do that since strings are more versatile.

-James
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #75 on: February 24, 2009, 04:39:13 PM »
Hello James,

I have made a lot of progress on my 3d video plugin.

In your tutorial you use myConfig() to start the plugin. However, the two video plugins from Mach3 downloads add menu items under the plugins menu. Will you be adding details to your tutorial on how that is done?

Tom Hubin
thubin@earthlink.net
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #76 on: February 24, 2009, 04:51:13 PM »
Hi Tom,

Let me see what I can do.  If I can find the time I will add a menu to CustomPlugin then you can just ask questions.  I don't think I have time to work on the docs now.

I look forward to seeing your creation!

-James
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #77 on: March 20, 2009, 02:01:19 AM »
Hello,

I am pretty much done with the 3d video probe plugin. Doing some testing before I post it.

I also need to do some documentation. At the very least I would like to have each edit and button control give the user a clue as to the control's purpose. I don't see anything in the resource editor that does this. How can I add a popup comment to each control?

I would also like to do a Help file. Please point me to info on how that is done?

Tom Hubin
thubin@earthlink.net
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #78 on: March 20, 2009, 10:57:19 AM »
Hi Tom,

If you used MFC dialogs then tooltips are pretty easy, let me know and I will look up the correct references.  I am using HTML help from Microsoft for my online help files.  It is a free download.

-James
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #79 on: March 21, 2009, 03:00:50 AM »

If you used MFC dialogs then tooltips are pretty easy, let me know and I will look up the correct references.  I am using HTML help from Microsoft for my online help files.  It is a free download.

-James


Hello James,

Now that I know what they are called, I poked around the web, looking for guidance on making tooltips. What I found looked kind of cryptic to me. Please point me to a method for making tooltips.

Also, please point me to the free Microsoft download for making help files.

Tom Hubin
thubin@earthlink.net