Jump to content

DllCall and an array of strings


Recommended Posts

I have a function as follows:

int myFunction (char** arg, char** ret);

The requested argument is:

arg[] = {"str1","strn",NULL};

and ret is an array of strings with the results.

would someone help me with the dllcall?

Link to comment
Share on other sites

  • Developers

Ok. The helpfile should have told you this, but obviously not-

DllCall ( "dll", "return type", "function" [, "type1", param1 [, "type n", param n]] )

Example:

MsgBox API:

DllCall("user32.dll", "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)

.. wondering here when you will be answering the OP's question .... :shocked:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

What is arg[] = {"str1","strn",NULL}; anyway? I've never seen it before.

Then I would advice you to either post a question about the OP question Or just not to post at all if you are not sure about the answer,

but atleast stop acting like a smart ass by pointing to the Helpfile and even Bolding the word should like you want to say the OP is stupid.

My 2 cents .

:shocked:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Then I would advice you to either post a question about the OP question Or just not to post at all if you are not sure about the answer,

but atleast stop acting like a smart ass by pointing to the Helpfile and even Bolding the word should like you want to say the OP is stupid.

My 2 cents .

:shocked:

Sorry Blakel and thanks JdeB, for slapping me in the face and telling me to stop . I will cease being a smartass, and try to start over. Here I go.

Hi BlakeL,

Sorry about being a smartass earlier, I will now try to help you as much as I can in my power.

Ok so from what I can see, you have your function, myfunction, and then $ret, is an array with the results. And now you want to perform a dllcall on a dll right? Ok, so what I now need to know is what dll you are trying to call, so I can help you with the code.

Regards

Bert

Link to comment
Share on other sites

the question is how do i get an array of strings into a dllcall.

"arg[] = {"str1","strn",NULL};" is a typo

better example of what would be passed in programming in c:

-- c code--

char** ArrayofStrings = {"String One", "String Two", "String Three"};

-- / c code --

Link to comment
Share on other sites

Ok. Get ready, cause here I go.

Now I'm guessing your array would have the type and parameters etc.?

So

Your array looks like:

$myarray[7] = ["Dll", "ReturnType", "Function", "Type1", "Param1", "Type2", "Pram2"]
oÝ÷ Ù*-ë2Ö±~ÝWX¬jëh×6
DllCall ( "dll", "return type", "function" [, "type1", param1 [, "type n", param n]] )
oÝ÷ Ù*.²)ථ¶²Ü(ºWmº¹èºÙbëaÆ®¶­s`¤FÆÄ6ÆÂb33c¶×'&³ÒÂb33c¶×'&³%ÒÂb33c¶×'&³5ÒÂb33c¶×'&³EÒÂb33c¶×'&³UÒÂb33c¶×'&³eÒÂb33c¶×'&³uÒ oÝ÷ Ùg¡j÷­æ«­¬´ß©²jºÚË­Ø^¶Zéj»l{a{»az|«Þ¶©j»lYQzÛ«

That works by $i incrementing by one every time- so every time the loop completes one, $i = +1. Ubound ("Array"), is a function that tells the total in the array. So when $i = 7, the loop ends. The array is called by the variable name ($myarray) and then the value of $i in the [] ([$i]). So thats basically it.

Good luck-

Brett

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...