Sign in to follow this  
Followers 0
MyEarth

Help with DLLCall

17 posts in this topic

#1 ·  Posted (edited)

Hi community, a new member here! :D

I'll come from AHK but now i'm tired and i want to use a better coding software like autoit

I have some problem with DLLCall, this was the original script:

#NoEnv
SetWorkingDir %A_ScriptDir%
OnExit, ExitSub
hDLL := DllCall("LoadLibrary", Str, "Library86.dll", Ptr) ;for x86
;hDLL := DllCall("LoadLibrary", Str, "Library64.dll", Ptr) ;for x64

if (hDLL)
{
hTest := DllCall("SetWindowsHookEx", Int, 5, Ptr, DllCall("GetProcAddress", Ptr, hDLL, AStr, "CBProc", ptr), Ptr, hDLL, Ptr, 0, Ptr)
if (!hHook)
{
MsgBox, SetWindowsHookEx is failed
ExitApp
}
}
else
{
MsgBox, LoadLibrary is failed
ExitApp
}

MsgBox, Good Work, LoadLibrary is load
Return

Esc::ExitApp

ExitSub:
if (hTest)
DllCall("UnhookWindowsHookEx", Ptr, hTest)
if (hDLL)
DllCall("FreeLibrary", Ptr, hDLL)

ExitApp

Some advice? Many thanks, i'm glad to stay here :D

Edited by MyEarth

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

why not try in help file func name _Winapi_SetWindowsHookEx

instead dllcall?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Thanks for your interest. I have few post so i can reply only 4 times until 20 December 2012 - 08:57 PM.

I would be happy if you make an example based on my script, if you want and have time, for better understand the Function.

Just for DLLCall:

DllCall("LoadLibrary", Str, "Library86.dll", Ptr)
DllCall("SetWindowsHookEx", Int, 5, Ptr, DllCall("GetProcAddress", Ptr, hDLL, AStr, "CBProc", ptr), Ptr, hDLL, Ptr, 0, Ptr)
DllCall("UnhookWindowsHookEx", Ptr, hTest)
DllCall("FreeLibrary", Ptr, hDLL)

Share this post


Link to post
Share on other sites

Thanks for your interest. I have few post so i can reply only 4 times until 20 December 2012 - 08:57 PM.

You should be fine now ...

Jos :)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

You should be fine now ...

Jos :)

Thanks Jos, now i can reply to all :D

Share this post


Link to post
Share on other sites

For now, i have convert this line of AHK:

hDLL := DllCall("LoadLibrary", Str, "Library86.dll", Ptr)

To this Autoit code. I think is correct, right?

$hDLL = DllCall("Library86.dll", "Str", "LoadLibrary", "Ptr")

I need some help for other SetWindowsHookEx, UnhookWindowsHookEx and FreeLibrary...thanks ;)

Share this post


Link to post
Share on other sites

Bump, please any help is grateful, this scipt is very important for me ;)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

You have not been able to convert any more of that at all in a full day?

Not, and i don't know if that DLLCall work, noone confirmed that

or you just want someone to do it for you?

Isn't a 1000 line of code, only four lines ( or three if my conversion is correct ) with the same subject, the DllCall...i'm not asking for the moon :D

Edited by MyEarth

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

i did suggest you to take a look in help file for _WinAPI_SetWindowsHookEx command

strangely but in help file under the explanation about that specific func you do have example that not only include usage of _WinAPI_SetWindowsHookEx but _WinAPI_UnhookWindowsHookEx

now if you still wanna go with dll call on your own but i hardly see the point i would suggest you to open WinAPI.au3 file located in include folder of your autoit instalation, with your scite editor and look at func _WinAPI_SetWindowsHookEx to see how exactly do it trigger user32 dll.

as for your Library86.dll and your not working AHK script, we heare dont know AHK, we know AutoIt, so did you provide anything for us to try to compare not working autoit code with working correct syntax? how can anyone know if something is working if noone have anything that points him to what shud and how shud he do it. Did you explain what your script should represent, what shud it be doing, whats it your end result that you expect from it? Where is that dll located? can i finde it in my windows dir? is there a link to the api documentation? are funcs on that dll exported at all?

My point is not to flame you, my point is to open your eyes that you got heare to learn (i hope) AutoIt, not to learn us AHK. Sometimes incomplete questions cannot be answered regardles of how hard you try.

so im gona redirect you to small tutorial in hope itl do you some good of understanding dll and au3. Considering that you had take a look at that funcs from help file and opened WinAPI.au3 to see how someone else is dooing it i hope that your next question will be more helpful for us in order to help you.

Edited by bogQ
1 person likes this

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Perhaps I did not explain well, my AHK script WORK. I'd like to convert to Autoit

Now i don't have problem with loop, HotkeySet etc. but only with DllCall

Now i have posted this line:

$hDLL = DllCall("Library86.dll", "Str", "LoadLibrary", "Ptr")

And nooone confirmed if it is correct or not, i only see a useless lecture, from my point of view, also I did not ask any full script, only 4 LINES of code, the only part that I can not solve alone, I have limits and I have no problem admitting

I have follow the forum for a lot of time and i see many time script for user only posting thread with an idea of a script...

The Library86.dll is an internal library of my company, i can't post it and i think it is not necessary.

This is all story, if someone want to help with that DllCall i'm grateful, otherwise friends as before.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Noone can confirm or conwert this cos noone know AHK, and cos you did not provide documentation for that dll and geave something to test it on. so we cant help but you can test if @error is returned after dll func usage, if there is @error than your probably doooing something wrong. so check for @error and see what did it return, then open help file on that func and look under return error to see why exactly did you get that speciric error number.

Clear enought with no lectures this time?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

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

;~ http://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx

$hDLL = DllCall('Kernel32.dll', 'handle', 'LoadLibrary', 'str', 'Library86.dll')
If IsArray($hDLL) Then $hDLL = $hDLL[0]

Edited by Tekk

Share this post


Link to post
Share on other sites

Hi community, a new member here! :D

I'll come from AHK but now i'm tired and i want to use a better coding software like autoit

I have some problem with DLLCall, this was the original script:

#NoEnv
SetWorkingDir %A_ScriptDir%
OnExit, ExitSub
hDLL := DllCall("LoadLibrary", Str, "Library86.dll", Ptr) ;for x86
;hDLL := DllCall("LoadLibrary", Str, "Library64.dll", Ptr) ;for x64

if (hDLL)
{
hTest := DllCall("SetWindowsHookEx", Int, 5, Ptr, DllCall("GetProcAddress", Ptr, hDLL, AStr, "CBProc", ptr), Ptr, hDLL, Ptr, 0, Ptr)
if (!hHook)
{
MsgBox, SetWindowsHookEx is failed
ExitApp
}
}
else
{
MsgBox, LoadLibrary is failed
ExitApp
}

MsgBox, Good Work, LoadLibrary is load
Return

Esc::ExitApp

ExitSub:
if (hTest)
DllCall("UnhookWindowsHookEx", Ptr, hTest)
if (hDLL)
DllCall("FreeLibrary", Ptr, hDLL)

ExitApp

Some advice? Many thanks, i'm glad to stay here

The Library86.dll is an internal library of my company, i can't post it and i think it is not necessary.

It's strange !

Pasting "GetProcAddress CBProc" in google, the first answer is naturally this post.

But the second is here ! :huh:


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

MyEarth,

The code you posted is identical to that in the AHK thread to which wakillon linked - the title of which is "Hyde (sic) your process from the Task Manager". Is that what you are trying to do with this script? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

No news!

Like his dll, he want surely stay hidden! :P


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
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
Sign in to follow this  
Followers 0