Jump to content

WinAPIInternals.au3 error (629,16)


Recommended Posts

I found some neat functions and one of them needs "Includes" that I do not have in my "Include" folder.

I copied a few from GitHub.com that appear to work, But I get an error when attempting to use WinAPIInternals.au3

The error is on line 629, character 16:

628 Func __Iif($bTest, $vTrue, $vFalse)
629     Return $bTest ? $vTrue : $vFalse
630 EndFunc   ;==>__Iif

The 16th character is the question mark. I never seen this used, it looks like it needs to be:

628 Func __Iif($bTest, $vTrue, $vFalse)
629     Return $bTest, $vTrue : $vFalse
630 EndFunc   ;==>__Iif

But that is wrong also.

I cant find anywhere else to get WinApIInternals.au3

Thanks for any help

Link to comment
Share on other sites

OK,

Now I have a different error in WinAPISys.au3:

C:\Program Files (x86)\AutoIt3\Include\WinAPISys.au3(1141,48) : WARNING: $STR_STRIPLEADING: possibly used before declaration.

Here is the code inside of WinAPISys:

1138 Func _WinAPI_GetModuleHandleEx($sModule, $iFlags = 0)
1139    Local $sTypeOfModule = 'ptr'
1140    If IsString($sModule) Then
1141        If StringStripWS($sModule, $STR_STRIPLEADING + $STR_STRIPTRAILING) Then
1142            $sTypeOfModule = 'wstr'
1143        Else
1144            $sModule = 0
1145        EndIf
1146    EndIf

1148    Local $aRet = DllCall('kernel32.dll', 'bool', 'GetModuleHandleExW', 'dword', $iFlags, $sTypeOfModule, $sModule, 'ptr*', 0)
1149    If @error Or Not $aRet[0] Then Return SetError(@error, @extended, 0)
    ; If Not $aRet[0] Then Return SetError(1000, 0, 0)

1152    Return $aRet[3]
1153 EndFunc

Maybe I just need to declare $STR_STRIPLEADING ?

Link to comment
Share on other sites

$STR_STRIPLEADING and $STR_STRIPTRAILING are declared in standard include "StringConstants.au3". The standard include file "WinAPISys.au3" has includes that include the "StringConstants.au3". So if you use the standard includes from the latest autoit version the syntax error you have should not occur.

 

Link to comment
Share on other sites

Hi AutoitMike
Something goes wrong in your AutoIt installation and I'm afraid several AutoIt versions are mixed in the same installation folder.

On 10/20/2022 at 6:25 PM, AutoitMike said:

Im using 3.3.8.1

 

3 hours ago, AutoitMike said:

OK,

Now I have a different error in WinAPISys.au3:

C:\Program Files (x86)\AutoIt3\Include\WinAPISys.au3(1141,48) : WARNING: $STR_STRIPLEADING: possibly used before declaration.

Here is the code inside of WinAPISys:

1138 Func _WinAPI_GetModuleHandleEx($sModule, $iFlags = 0)
1139    Local $sTypeOfModule = 'ptr'
1140    If IsString($sModule) Then
1141        If StringStripWS($sModule, $STR_STRIPLEADING + $STR_STRIPTRAILING) Then

1) AutoIt 3.3.8.1 was released on January 2012 and there was no WinAPISys.au3 file in it (just re-checked). In this version, there was only a huge file named WinApi.au3 (375Kb) which will be splitted into plenty of files named WinAPIxxxxx.au3 in a future release.

2) WinAPISys.au3 appears later, starting "autoit-v3.3.10.0 (invasion of Yashied WinApiEx func)" released on December 2013, but even there, the lines inside this file don't match yours. Below are lines 1138-1141 from WinAPISys.au3, version 3.3.10.0 :

1138 ; Modified.......: Jpm
1139 ; ===============================================================================================================================
1140 Func _WinAPI_GetModuleHandleEx($sModule, $iFlags = 0)
1141    Local $TypeOfModule = 'ptr'

3) Your lines are found starting "autoit-v3.3.14.0" released on July 2015 :

1138 Func _WinAPI_GetModuleHandleEx($sModule, $iFlags = 0)
1139    Local $sTypeOfModule = 'ptr'
1140    If IsString($sModule) Then
1141        If StringStripWS($sModule, $STR_STRIPLEADING + $STR_STRIPTRAILING) Then

I suggest you'd make a clean installation of AutoIt, probably deleting before everything that's found in your installation folder, then installing the lastest official release.

After that, if some of your scripts won't work correctly (because include files have changed through the years) then you'll have to adapt your scripts to the last release. Also many AutoIt & UDF bugs have been fixed through the years. If you don't do that, I'm afraid you'll often find the kind of issues you described.

If another reader got a different opinion, please share your thoughts here.
Good luck

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...