System API

Can I invoke, using the Arduino IDE, a system API?

What do you mean?

How to use this forum

I mean for example, if my OS is Windows, can I call the CreateProcess API (http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) from the setup method?

include "WinBase.h"

void setup() { CreateProcess(...); }

And if I can't call the system API in this way, is there another way to do what I'm asking?

The short answer is no. The code that you write in the IDE runs on the Arduino, not the PC. By the way, setup() is a function, not a method, but that does not change what you can do.

Can you please explain what you want to do by creating a new process on the PC ?

The CreateProcess is only an example, as I wrote; I need to know if I can interact with the system API in some way. What's the long answer?

The long answer is still "no".

The Arduino, and Windows, are two completely different entities. When you run code on the Arduino it runs entirely on the Arduino. It's like, if you put some bread in your toaster you can't get it to pop your washing out of the washing machine.

You will have to use some kind of communication protocol (usually serial) to communicate between the Arduino and Windows. There are many many examples on the web and this forum.

majenko: The long answer is still "no".

You stole my answer !

UKHeliBob:

majenko:
The long answer is still “no”.

You stole my answer !

I am a NINJA!

gliderkite: I mean for example, if my OS is Windows, can I call the CreateProcess API (http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) from the setup method?

No.

You may as well ask if you can play World of Warcraft.

You may as well ask if you can play World of Warcraft.

OK. Can I play World of Warcraft on my Arduino? I have a Duemilanove, a Mega, and a DUE. Which one will be suitable?

PaulS:

You may as well ask if you can play World of Warcraft.

OK. Can I play World of Warcraft on my Arduino? I have a Duemilanove, a Mega, and a DUE. Which one will be suitable?

You don’t play World of Warcraft. You live world of warcraft.

You don't play World of Warcraft. You live world of warcraft.

Ah. That explains a lot. No thanks, I've got a life already.

gliderkite: And if I can't call the system API in this way, is there another way to do what I'm asking?

Assuming the Arduino is able to communicate with the PC somehow, you can send a message from the Arduino to the PC and have an application on the PC receive that message and carry out the required action.

If your Arduino is connected to a Windows PC via USB then you can use the Gobetwino application to do the Windows part of this - on the Arduino, you just need to send out the command message in the format required by Gobetwino.

PaulS:

You may as well ask if you can play World of Warcraft.

OK. Can I play World of Warcraft on my Arduino? I have a Duemilanove, a Mega, and a DUE. Which one will be suitable?

Glad you asked.

The long answer is yes.

But you have to write software on both sides to communicate remotely (remoting). You would have to rebuild something like DCOM or similar remoting technologies (java etc).

An easier way is to create protocol that defines what you ultimately want to achieve. Implement that on both sides and you will be able to communicate at a higher abstraction level and more efficiently. So instead of calling Win32 API's directly you would have commands in your protocol that do higher level functions.

majenko: You don't play World of Warcraft. You live world of warcraft.

You used to. Until they scripted it to death. Now it is "do this quest or the gates to the next area won't open".

Which is like, “if you don’t learn maths, you can’t get a job”.

“But I hate maths!”

What is "world of warcraft"?


Rob

You may as well ask if you can play World of Warcraft.

The real question should be:

But does it run Crysis?

obiwanjacobi: The long answer is yes.

As long as Pluto's orbit around the Sun!