Modify Array VB & PB with a DLL, please need help please :-(

Just starting out? Need help? Post your questions and find answers here.
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Re: Modify Array VB & PB with a DLL, please need help please :-(

Post by Xombie »

KCC - did you finally get this all figured out?
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Modify Array VB & PB with a DLL, please need help please :-(

Post by Kwai chang caine »

XOMBIE...very very thanks for make worry for the poor KCC 8)

In fact, after one month of search ....and several helps by you all...Us and French forum. 8)
I have found nearly what i search..... :oops:

After a long long time and several successive problems....

1/How send a VB dynamical string array to PB ??
Fixed by SROD with the structure 8)

2/How not use the exe pointers ??
I found this solution : "Copy in a new array in the DLL."
Like this i can use the new array, like i want, Dim, Redim, ArraySize, Add lines, Delete lines....

3/How return the array from DLL to exe caller ??
After try several method...i have choose the first found at the beginning: "The pointer of Array"
For my little head..it's the more simple :oops:
But i have changed the VB code, because before, i copy directly pointers of DLL array, in VB array
And when i free the VB exe array, i freeing in the same time the DLL pointers, because it's the same :?
And my error is here...
So now, i fixed that, in VB code i read in memory and copy array, without use the pointers, like this no risk of freeing :D

Finally, that works.....
But i have two regrets...

First.... i'm forced to send the size of array in VB code, otherwise the DLL can't know where stopped to read memory and that crash :(

Next...I'm forced too, to send a flag, for the DLL recognize, what is the exe, who call it :cry:
Because, if it's VB exe....the array is UNICODE, so i need PeekS(UNICODE)
And if it's PB exe....the array is ASCII, because i don't want compil in UNICODE, my DLL
I have the idea: "use TRUE", because in VB = -1 and for PB #True = 1 and multiply arraysize with true :oops:
After i test if the array value is negative, and if yes...the caller is VB :oops:

SROD say to me, it's not good to try to search in the memory if the array passing by the exe is or not UNICODE :shock:
And the "professional" method is to create two different functions...
I listen always my MASTER because he is very intelligent :mrgreen:
But this time, his solution create problems to KCC :(

Two function by function......my DLL is already so big :cry:
So i have listen it, and stop to search solution, because it's difficult to use the API "istextunicode" if the DLL is not UNICODE (That's another member GEBONET who say that to me) :cry:

So....this is my cowpat code :oops:
For a MASTER like you, they are not one month of search, perhaps one hour :lol:

But apparently, SROD say to me, it's not a method use by the professionals
A DLL don't modify an exe array :?

Then.... i'm happy to create this code, even if it's not a regular method :D
Because...i repeat a little bit too much...but it's really the heart of hundred of my functions, and it's really important for me to create a good code :?
The first time...i have create a bad code ..and several softwares is bugged :(

If you can take a little bit of time to see, my code.
And if you found a method for not send sizearray or found if the array send is UNICODE, without compile the DLL in UNICODE....i'm very interesting 8)
And obiously...if you see an error for the memory or other..i'm also interesting 8)

Your advice is very very important for KCC :D

My code passing a VB and PB array dynamical string in DLL, modify the array (Replace five first "Sentence" word to "KCC"), add 2 lines, and return in the VB or PB exe
The second time, it reverse the function (Replace five first "KCC" word to "Sentence"), and always add 2 lines, and return in the VB or PB exe

In the ZIP, you have the caller of DLL PB, the caller of DLL VB, The exe VB caller of DLL, the EXCEL file caller of DLL (Like this you can try without VB6) , and obviously the code and the DLL
http://erdsjb.free.fr/PureStorage/Xombie.zip

I wish you a good day
And again sincerely thanks, to your interest 8)
ImageThe happiness is a road...
Not a destination
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Re: Modify Array VB & PB with a DLL, please need help please :-(

Post by Xombie »

KCC,

I was off on a little trip since the end of last week so I didn't have a chance to look at this yet. I will look at what you have over the next few days to see if I'm able to help with anything. Perhaps I won't be very effective with all the other wonderful help you've received. I'll still take a look, however.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Modify Array VB & PB with a DLL, please need help please :-(

Post by Kwai chang caine »

Thanks XOMBIE

I'm happy to see, that if you don't answer, it's not the fault of my long THREAD :D
Because i say to me: "KCC.... you have frighten off XOMBIE, with all your questions and all your words" :oops:

Now i know it's a trip the reason of your silence :D
It's good to quit sometime the PC 8)
But me...even in vacancy...i have a PC :lol:

I'm sure you can give an important advice.
Because, it's true, there are numerous members who helped me.
Each member gave to KCC a piece of code, a function and i thanks again each of them 8)
But even with great code, when KCC assemble them, KCC can make a cowpat with beautiful flowers :lol:

My code works fine, but since the last time, when i used a code several time, and several functions
I seen, it don't works just after one month... :shock:
And now, i prefer ask at professional before have a second surprise :wink:
And be sure the memory of my PC, is not in sufferance :oops:

Again thanks for your interest 8)
I wish you a good week :D
ImageThe happiness is a road...
Not a destination
Post Reply