AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AutoHotkey.dll
Goto page Previous  1, 2, 3 ... 16, 17, 18 ... 34, 35, 36  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
coder
Guest





PostPosted: Sat Jul 03, 2010 11:41 am    Post subject: Reply with quote

HotKeyIt wrote:
@coder, what happens when you run a script with original AutoHotkey.exe without using dll?



i'm not user original AutoHotkey.exe, i use AutoHotkey_H (ANSI)


HotKeyIt wrote:
ANSI version cannot work with unicode path.


it work fine, but if line (var, path, etc) have symbol "я" -- it alert error.

example:
0) create script "msgbox, тестовая проверка"
1) save script in UTF-8 encoding
2) run script in ANSI build -- Autohotkey alert error

0) remove from script symbol "я" (script = "msgbox, тестова проверка")
1) save script in UTF-8 encoding
2) run script in ANSI build -- no error


0) create script "msgbox, тестовая проверка" (original script, without changes)
1) save script in UTF-8 encoding
2) run script in Unicode build -- no error


HotKeyIt wrote:
Did you try that


tried, and i found where bug...

1) compile script
2) type "cd c:\" in the cmd
3) run compiled exe from console

if script like this:

Code:
#Persistent
If 0
   FileInstall,AutoHotkey.dll,AutoHotkey.dll
MsgBox % A_ScriptDir

Thread_Auto =
(`%
msgbox, %A_ScriptDir%
)

auto_dll:=AhkDllThread("AutoHotkey.dll")
auto_dll.ahktextdll("#NoTrayIcon`n" Thread_Auto)
auto_dll2:=AhkDllObject("AutoHotkey.dll")
auto_dll2.ahktextdll("#NoTrayIcon`n" Thread_Auto)

#Include %A_ScriptDir%\func_threads_init.ahk



it say - "c:\test"; "c:\"; "c:\"


if script like this:
Code:
#Persistent
If 0
   FileInstall,AutoHotkey.dll,AutoHotkey.dll
MsgBox % A_ScriptDir

Thread_Auto =
(
msgbox, %A_ScriptDir%
)

auto_dll:=AhkDllThread("AutoHotkey.dll")
auto_dll.ahktextdll("#NoTrayIcon`n" Thread_Auto)
auto_dll2:=AhkDllObject("AutoHotkey.dll")
auto_dll2.ahktextdll("#NoTrayIcon`n" Thread_Auto)

#Include %A_ScriptDir%\func_threads_init.ahk


all msgbox say "c:\test"

It's strange... =)
Back to top
coder
Guest





PostPosted: Sat Jul 03, 2010 12:14 pm    Post subject: Reply with quote

HotKeyIt wrote:
so when you run your httpQuery script without using dll does it crash as well?


I not tested... now i wrote 2 simple script (with ahkdll, and without) and run their... after ~24 hours I'll write about of results... =)
Back to top
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Sat Jul 03, 2010 5:23 pm    Post subject: Reply with quote

For me it displays ???????? ???????? in both cases when using ANSI version Confused

For the second one it displays C:\Test in all cases, note the script for the other (A_ScriptDir) is not dynamic.
Also note!
MSDN GetCurrentDirectory wrote:
Multithreaded applications and shared library code should not use the GetCurrentDirectory function and should avoid using relative path names. The current directory state written by the SetCurrentDirectory function is stored as a global variable in each process, therefore multithreaded applications cannot reliably use this value without possible data corruption from other threads that may also be reading or setting this value. This limitation also applies to the SetCurrentDirectory and GetFullPathName functions. The exception being when the application is guaranteed to be running in a single thread, for example parsing file names from the command line argument string in the main thread prior to creating any additional threads. Using relative path names in multithreaded applications or shared library code can yield unpredictable results and is not supported.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
YMP



Joined: 23 Dec 2006
Posts: 418
Location: Russia

PostPosted: Sun Jul 04, 2010 4:17 am    Post subject: Reply with quote

HotKeyIt wrote:

For me it displays ???????? ???????? in both cases when using ANSI version

The ANSI code for "я" is 0xFF. Just use the character from your ANSI charset that has that code.
Back to top
View user's profile Send private message
Guest_AutoHotkey_L
Guest





PostPosted: Mon Jul 05, 2010 11:24 pm    Post subject: Re: ahkFunction crashing Reply with quote

Guest_AutoHotkey_L wrote:
tinku99 wrote:
I have fixed ahkFunction so it doesn't crash. I have also cleaned up its implementation a little.

Thanks for taking a look and working on a fix.

I confirmed that there is no more crashing Smile I don't seem to be getting back the strings I'm expecting from ahkFunction though...

Should I try to provide some code to reproduce?

Any comments on this?

The crashing from before seems gone, but for the cases I've tested, ahkFunction doesn't appear to be returning the string values I expect. I see only '1'.

Tried to reproduce with a smaller set of code which is below. I think it demonstrates some issue, but the results don't appear to be the same as in the full-blown scenario (still seems problematic though):

With the AutoHotkey.dll in the ReleaseA directory of the HotkeyIt zip file (1.
0.48.05.L52dllH17 SHA-1: fb41686713b7319e2e85e3b3409b606c55ad8870) ahkFunction appears to return strings as expected.

With the most recent tinku99 AutoHotkey.dll I have here (SHA-1: 0e4c7daf198dc56524757015dea46f48b7400ec1) ahkFunction appears to return an empty string.

ahkFunctionReturnValue.ahk
Code:

#NoEnv
#Persistent

OutputDebug, % "-------"

OutputDebug, % "A_AhkVersion: " . A_AhkVersion

AHKDllPath := A_ScriptDir . "\AutoHotkey.dll"

OutputDebug, % "About to call LoadLibrary"
handleLibrary
  := DllCall("LoadLibrary"
           , "Str", AHKDllPath)
If (ErrorLevel != 0)
{
  OutputDebug, % "DllCall (LoadLibrary) set ErrorLevel to: " . ErrorLevel
  ExitApp
}
OutputDebug, % "DLLCall (LoadLibrary) returned: " . handleLibrary

OutputDebug, % "About to call ahkdll"
Result
  := DllCall(AHKDllPath . "\ahkdll"
           , "Str", A_ScriptDir . "\helper.ahk"
           , "Str", ""
           , "Str", ""
           , "Cdecl UInt")
If (ErrorLevel != 0)
{
  OutputDebug, % "DllCall (ahkdll) set ErrorLevel to: " . ErrorLevel
  ExitApp
}
OutputDebug, % "DllCall (ahkdll) returned: " . Result

Parameter := "Hoping this comes back"
OutputDebug, % "About to call ahkFunction"
Result
  := DllCall(AHKDllPath . "\ahkFunction"
           , "Str", "InHelper"
           , "Str", Parameter
           , "Cdecl Str")
If (ErrorLevel != 0)
{
  OutputDebug, % "DllCall (ahkFunction) set ErrorLevel to: " . ErrorLevel
}
OutputDebug, % "DllCall (ahkFunction) returned: " . Result
If (Result == "")
{
  OutputDebug, % "  Result appears to be empty..."
}

OutputDebug, % "About to call FreeLibrary"
Result
  := DllCall("FreeLibrary"
           , "UInt", handleLibrary)
If (ErrorLevel != 0)
{
  OutputDebug, % "DllCall (FreeLibrary) set ErrorLevel to: " . ErrorLevel
  ExitApp
}
OutputDebug, % "DllCall (FreeLibrary) returned: " . Result

ExitApp


helper.ahk
Code:

#Persistent

OutputDebug, % "Via DLL: A_AhkVersion: " . A_AhkVersion

InHelper(PassedThing)
{
  OutputDebug, % "Via DLL: InHelper entered with: " . PassedThing
  Return PassedThing
}
Back to top
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Tue Jul 06, 2010 5:47 am    Post subject: Re: ahkFunction crashing Reply with quote

Guest_AutoHotkey_L wrote:
I confirmed that there is no more crashing Smile I don't seem to be getting back the strings I'm expecting from ahkFunction though...
Thanks for the bug report. Fixed. Try it now: redownload
Also, fixed ahkgetvar()
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Guest_AutoHotkey_L
Guest





PostPosted: Tue Jul 06, 2010 11:06 am    Post subject: Re: ahkFunction crashing Reply with quote

tinku99 wrote:
Guest_AutoHotkey_L wrote:
I confirmed that there is no more crashing Smile I don't seem to be getting back the strings I'm expecting from ahkFunction though...
Thanks for the bug report. Fixed. Try it now: redownload
Also, fixed ahkgetvar()

So far it's looking much better!

Thanks for the fix Smile
Back to top
Guest_AutoHotkey_L
Guest





PostPosted: Sun Jul 11, 2010 1:20 am    Post subject: Re: ahkFunction crashing Reply with quote

Guest_AutoHotkey_L wrote:
tinku99 wrote:
Guest_AutoHotkey_L wrote:
I confirmed that there is no more crashing Smile I don't seem to be getting back the strings I'm expecting from ahkFunction though...
Thanks for the bug report. Fixed. Try it now: redownload
Also, fixed ahkgetvar()

So far it's looking much better!

Thanks for the fix Smile

Any chance of the change(s) making it into HotkeyIt's version too? (The dates for the files in HotkeyIt's zip suggest to me that this hasn't happened there yet, but may be that's off.)
Back to top
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Sun Jul 11, 2010 9:49 am    Post subject: Reply with quote

AutoHotkey_H is now up to date.

I have not renamed LowLevel functions like Alias to __Alias because I like them to be accessible even when using Lexikos LowLevel() functions (otherwise they are overridden).
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
Guest_AutoHotkey_L
Guest





PostPosted: Sun Jul 11, 2010 12:45 pm    Post subject: Reply with quote

HotKeyIt wrote:
AutoHotkey_H is now up to date.

Just downloaded and tested some of the bits in ReleaseA -- seems fine so far Smile Thanks a lot!
Back to top
Guest_AutoHotkey_L
Guest





PostPosted: Fri Jul 16, 2010 11:05 am    Post subject: Clipboard variable content Reply with quote

For A_AhkVersion: 1.0.48.05.L52H18, the Clipboard variable seems functional initially but although the clipboard may not be empty, in subsequent ahktextdll invocations, the Clipboard variable looks empty.

Am I doing something wrong?

Code:

#Include AhkDllObject.ahk
;
OutputDebug, % "A_AhkVersion: " . A_AhkVersion
;
AHKDLLObj := AhkDllObject(A_ScriptDir . "\AutoHotkey.dll")
If (!IsObject(AHKDLLObj))
{
  OutputDebug, % "Failed to initialize AhkDllObject"
  ExitApp
}
;
MsgBox, % "Please put something in the clipboard and run dbgview or equivalent"
Result :=
  DynaCall(AHKDLLObj.ahktextdll
         , "OutputDebug, % ""First Clipboard: "" . Clipboard")
Result :=
  DynaCall(AHKDLLObj.ahktextdll
         , "OutputDebug, % ""Second Clipboard: "" . Clipboard")
MsgBox, % "Why does the variable Clipboard appear to be empty for the second DynaCall invocation?"
Back to top
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Fri Jul 16, 2010 5:48 pm    Post subject: Reply with quote

Thanks for reporting, this is now fixed.
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
Guest_AutoHotkey_L
Guest





PostPosted: Fri Jul 16, 2010 11:34 pm    Post subject: Reply with quote

HotKeyIt wrote:
Thanks for reporting, this is now fixed.

Seems to be working better here -- thanks for fixing Smile
Back to top
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Sun Jul 18, 2010 8:23 pm    Post subject: Reply with quote

AutoHotkey_H20 wrote:
- Fixed a bug for dll when it was in root folder
- DynaCall is now managed trough internal DynaToken, similar to objects but less functional and much faster.
- - This DynaToken object is used same way as an object but can be used to call DynaToken only. You can also store them in objects.
- DynaCall can set default parameters now, so you can call the function later with less or even witout parameters: func.()
- A DynaToken can be created multiple times for the same function

Thanks Lexikos for his great help.

Small example:
Code:
DllCall("LoadLibrary","Str",dll:="AutoHotkey.dll")
ahk:=Object( "run1",DynaCall(dll . "\ahktextdll","ui=sss","MsgBox run1")
            ,"run2",DynaCall(dll . "\ahktextdll","ui=sss","MsgBox run2")
            ,"get",DynaCall(dll . "\ahkgetvar","s=sui","a")
            ,"set",DynaCall(dll . "\ahkassign","ss") )
ahk.run1()
ahk.set.a := "test" ;same as ahk.set("a","test") or ahk.set["a","test"]
MsgBox % ahk.get()
ahk.run2()
MsgBox % ahk.get()

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
Guest_AutoHotkey_L
Guest





PostPosted: Mon Jul 19, 2010 9:00 am    Post subject: H18 and H20 difference? Reply with quote

The following code works as expected for H18, but for H20, ErrorLevel is set to -2. (The versions I'm mentioning here are based on what I see for A_AhkVersion.)

FWIW, when testing I made one directory for H18 and one for H20 and put corresponding AutoHotkey.exe, AutoHotkey.dll, AhkDllObject.ahk, and the script below (testh20.ahk) in each directory. The .exe and .dll files were taken from ReleaseU. The test script was then run from the command line in each directory using:

Code:
AutoHotkey.exe testh20.ahk

Is there something I need to change? Or may be there's some pilot error. Please advise.

Code:
#Persistent
;
#Include AhkDllObject.ahk
;
OutputDebug, % "A_AhkVersion: " . A_AhkVersion
;
AHKDLLObj := AhkDllObject(A_ScriptDir . "\AutoHotkey.dll")
If (!IsObject(AHKDLLObj))
{
  OutputDebug, % "Failed to initialize AhkDllObject"
  ExitApp
}
;
Result
  := DynaCall(AHKDLLObj.ahktextdll
            , "MsgBox Hello")
If (ErrorLevel != 0)
{
  OutputDebug, % "DynaCall set ErrorLevel to: " . ErrorLevel
  ExitApp
}
OutputDebug, % "DynaCall result was: " . Result
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 16, 17, 18 ... 34, 35, 36  Next
Page 17 of 36

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group