Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Support for a device (with DLL's) which is controlled by winforms(c++)

29 views
Skip to first unread message

Keith Thompson

unread,
Apr 28, 2021, 1:28:35 PM4/28/21
to
You posted in comp.lang.c. You want comp.lang c++ -- probably.

Google Groups has a rather horrid bug that quietly drops the "++" from
the newsgroup name.

I've cross-posted this to comp.lang.c++ and redirected follows there.
If you reply to this message (and not to any others in this thread), you
should be able to continue the discussion in the correct newsgroup.

(I see you're using a lot of C library functions, which is valid, but
perhaps not a good idea if you want to program in C++.)

This syntax:
MyForm^ NewUI = gcnew MyForm();
suggests that you're using some non-standard dialect. Someone in
comp.lang.c++ who recognizes it might suggest a better place to post.

Previous message follows (I normally wouldn't top-post, but I made an
exception in this case):

Cetin Aslantepe <cetin.asl...@gmail.com> writes:
> Dear Mr. Damon,
>
> Thank you for your message,
>
> I am not a C ++ expert. Would you please tell me the procedure very shortly.
> Do I need classes for threads?
> What should be considered?
> Which project should I best create?
> How should I link the two main programs with a Direction or represent in threads?
> Many Thanks!
> --------------------------------------------------------------------------------------------------------------------------------------
> #include "MyForm.h"
> using namespace Project2;
>
> int UIMain()
> {
> Application::EnableVisualStyles();
> Application::SetCompatibleTextRenderingDefault;
>
> MyForm^ NewUI = gcnew MyForm();
> Application::Run(NewUI);
>
> return 1;
> }
> ----------------------------------------------------------------------------------------------------------------------------------
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
>
> #if defined(__APPLE__) && !defined(NOFRAMEWORK)
> #include <libximc/ximc.h>
> #else
> #include <ximc.h>
> #endif
>
> // This line includes a c-profile for the "8MT173-25" stage
> #include "8MT173-25.h"
>
> int main (int argc, char* argv[])
> {
> /*
> Variables declaration.
> device_t, status_t, engine_settings_t, status_calb and calibration_t are types provided by the libximc library.
> */
> device_t device;
> result_t result;
> int names_count;
> char device_name[256];
> const int probe_flags = ENUMERATE_PROBE;
> const char* enumerate_hints = "";
> char ximc_version_str[32];
> device_enumeration_t devenum;
>
> // unused variables
> (void)argc;
> (void)argv;
>
> printf( "This is a ximc test program.\n" );
> // ximc_version returns library version string.
> ximc_version( ximc_version_str );
> printf( "libximc version %s\n", ximc_version_str );
>
> // Device enumeration function. Returns an opaque pointer to device enumeration data.
> devenum = enumerate_devices( probe_flags, enumerate_hints );
>
> // Gets device count from device enumeration data
> names_count = get_device_count( devenum );
>
> // Terminate if there are no connected devices
> if (names_count <= 0)
> {
> printf( "No devices found\n" );
> // Free memory used by device enumeration data
> free_enumerate_devices( devenum );
> return 1;
> }
>
> // Copy first found device name into a string
> strcpy( device_name, get_device_name( devenum, 0 ) );
> // Free memory used by device enumeration data
> free_enumerate_devices( devenum );
>
> printf( "Opening device...");
> // Open device by device name
> device = open_device( device_name );
> printf( "done.\n" );
>
> // Load c-profile
> printf( "Setting profile for 8MT173-25... ");
> result = set_profile_8MT173_25(device);
> printf( "done. Result = %d\n", result );
>
> //user_value = A * (step + mstep / pow(2, MicrostepMode - 1))-- the conversion to user units
> //step = (int)(user_value / A) -- conversion from custom units
> //mstep = (user_value / A - step) * pow(2, MicrostepMode - 1)
> //Range: 1..65535.
> //Position bzw. get_position
> //speed -> z.b. SlowHome speed used for second motion (full steps) Range 0-100000
> // if else-Schleife
> //while schleife-- dow while schleife
>
>
>
> printf( "Closing device..." );
> // Close specified device
> close_device( &device );
> printf( "done.\n" );
>
> return 0;
> }
>
> Thank you?
>

--
Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Cetin Aslantepe

unread,
Apr 28, 2021, 5:49:19 PM4/28/21
to
Dear Keith,

Thank you for posting in the right group .

Cetin Aslantepe

unread,
Apr 28, 2021, 6:09:55 PM4/28/21
to
Dear Supporter,

I have been trying to control a stepper motor via GUI(WinForms) with my little programming knowledge.

With the example programs of device, I get commands (movements) performed.
All functions are already stored under a DLL.

I was told that only by applying threads two main programs (device and winforms) is possible. Are threads necessary?

If yes, how should I design the program with threads best?
Are there other solutions?

First of all, I would like to use the GUI (WinForms) to make the first simple movements.
How should I proceed?

First of all, I want my GUI to communicate with the stepper motor?
How would I do that?

I would be very happy about a feedback. Thanks in advance.

I appreciate your help.

With best regards
Cetin Aslantepe

Real Troll

unread,
Apr 28, 2021, 6:12:16 PM4/28/21
to
On 28/04/2021 18:28, Keith Thompson wrote:
>
> Google Groups has a rather horrid bug that quietly drops the "++" from
> the newsgroup name.
>

If you post directly on to C++ link, does it work?

<https://groups.google.com/g/comp.lang.c++>

I would have thought that if people can find this link on google portal
then it should work.  Google Groups are a mess and you can't find direct
links to the posting site any more.




Cetin Aslantepe

unread,
Apr 28, 2021, 6:18:47 PM4/28/21
to
Dear Real Troll,

I'm in the right group now "comp.lang.c++"

The message has been posted in the right group.
This is also discussed in the c group.

About any help I would be grateful.

best regads
cetin

Real Troll

unread,
Apr 28, 2021, 6:33:16 PM4/28/21
to
On 28/04/2021 23:18, Cetin Aslantepe wrote:
>
> About any help I would be grateful.
>

Sure. I would like to help but it is beyond my pay grade.  Sorry about this.

I can create DLLs and all that in C and C++ but to bind the functions in the GUI environment is not something I do in C or C++. I am mainly a C# programmer where GUI is much better IMO. Also, there are many Videos about C# on YouTube dealing with Visual Aspect of the programs.





Ralf Goertz

unread,
Apr 29, 2021, 3:51:12 AM4/29/21
to
Am Wed, 28 Apr 2021 23:10:03 +0100
schrieb Real Troll <real....@trolls.com>:

> On 28/04/2021 18:28, Keith Thompson wrote:
> >
> > Google Groups has a rather horrid bug that quietly drops the "++"
> > from the newsgroup name.
> >
>
> If you post directly on to C++ link, does it work?
>
> <https://groups.google.com/g/comp.lang.c++>

Written as such it is no surprise that you land in the C group and not
the C++ one. My newsreader (maybe erroneously) also drops the two pluses
when clicking on it to open the link in a browser since they are not
percent encoded. With <https://groups.google.com/g/comp.lang.c%2B%2B>
you should be on the safe side. I must admit though that "+" being a
reserved character should in some circumstances also be usable "as is"
if I understand <https://en.wikipedia.org/wiki/Percent-encoding>
correctly:

"Reserved characters that have no reserved purpose in a particular
context may also be percent-encoded but are not semantically different
from those that are not."

But I am not inclined to figure out when that is the case.

> I would have thought that if people can find this link on google
> portal then it should work.  Google Groups are a mess and you can't
> find direct links to the posting site any more.

I haven't tried to post using that link, though.

Richard Harnden

unread,
Apr 29, 2021, 8:59:06 AM4/29/21
to
"New conversation" on both the ++ and %2b%2b versions open a "New
conversation in comp.lang.c" window.

So GG is useless. Everybody knows this.


>

0 new messages