Some way to call CreateThread api?

 

I tried with this:

#import "kernel32.dll"
double CreateThread(int _1, int _2, double function, int _4, int _5, int _6);
#import

#import "user32.dll"
   int MessageBoxA(int hWnd, string szText, string szCaption,int nType);
#import

int init()
{
   double hThread = CreateThread(0, 0, myMessageBox(), 0, 0, 0);
   if (hThread == 0) MessageBoxA(0, "NO THREAD", "NO THREAD", 0);
   return(0);
}

double myMessageBox()
{
   MessageBoxA(0, "joojjoojoj", "ojojojojoj", 0);
}

But I can´t create a new thread, I think is not possible without a dll.

myMessaBox is called from the current thread from myMessageBox() not from CreateThread

 

Are you sure that myMessageBox() returns a value which equals to "a pointer to the application-defined function to be executed by the thread" ?

It has no return statement, in addition the double precision could not be understood as a pointer, and I doubt you have an idea what you are doing.

 
You are passing a double
   double hThread = CreateThread(0, 0, myMessageBox(), 0, 0, 0);
//                                     ^^^^^^^^^^^^^^ this is a function call. 
   double uninitializedDouble = myMessageBox();
   double hThread = CreateThread(0, 0, uninitializedDouble, 0, 0, 0); // Same as.
If you want to pass a function pointer you'd need to use
   double hThread = CreateThread(0, 0, myMessageBox, 0, 0, 0);
//                                    ^^^^^^^^^^^^ pointer to a function.
Except MT4 does NOT HAVE POINTERS so it will not compile!
 
WHRoeder:
You are passing a double If you want to pass a function pointer you'd need to use Except MT4 does NOT HAVE POINTERS so it will not compile!

Yes, this is the problem, I can´t compile. I know is a pointer but only I can compile with a function.
 

You are not compiling "with a function," you are compiling using the the return value FROM a function.

There is no problem, except that you are hard of reading. You answered your own question 1) "I think is not possible without a dll." and 2) I confirmed it. What part of "MT4 does NOT HAVE POINTERS" was unclear?

Reason: