Jump to content

WinAPIInternals.au3 error


 Share

Recommended Posts

Hello!

When I went to turn my .au3 into an .exe, I encountered an error that I never had while using F5 in SciTE to run the program. The error seems to be sourced in the included WinAPIInternals.au3 and stemming from the function below.

; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetString($pString, $bUnicode = True)
    Local $iLength = _WinAPI_StrLen($pString, $bUnicode)
    If @error Or Not $iLength Then Return SetError(@error + 10, @extended, '')

    Local $tString = DllStructCreate(($bUnicode & 'wchar' : 'char') & '[' & ($iLength + 1) & ']', $pString) ;first ampersand was a question mark
    If @error Then Return SetError(@error, @extended, '')

    Return SetExtended($iLength, DllStructGetData($tString, 1))
EndFunc   ;==>_WinAPI_GetString

This is what SciTE tells me about the error:

"C:\Users\Baconaise\Desktop\TSS\autoit-v3.3.8.1\install\Include\WinAPIInternals.au3"(208,56) : error: unbalanced paranthesis expression.
    Local $tString = DllStructCreate(($bUnicode & 'wchar' :
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Baconaise\Desktop\TSS\autoit-v3.3.8.1\install\Include\WinAPIInternals.au3"(208,56) : error: syntax error
    Local $tString = DllStructCreate(($bUnicode & 'wchar' :
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Baconaise\Desktop\TSS\autoit-v3.3.8.1\install\Include\WinAPIInternals.au3"(208,104) : error: syntax error
    Local $tString = DllStructCreate(($bUnicode & 'wchar' : 'char') & '[' & ($iLength + 1) & ']', $pString)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Baconaise\Desktop\TSS\autoit-v3.3.8.1\install\Include\WinAPIInternals.au3"(208,142) : error: Statement cannot be just an expression.
    Local $tString = DllStructCreate(($bUnicode & 'wchar' : 'char') & '[' & ($iLength + 1) & ']', $pString) ;first ampersand was a question mark
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Baconaise\Desktop\TSS\autoit-v3.3.8.1\install\Include\WinAPISysInternals.au3 - 4 error(s), 0 warning(s)

Please help me understand what is making it mad and how to fix it.

Link to comment
Share on other sites

Post your script, so we can see how you're calling the function.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I'm not sure if the manner in which I call the function is the issue. If I run SciTE's SyntaxCheck Prod on just the WinAPIInternals.au3 by itself without any of my code involved, it gives me the errors I mentioned above. Wouldn't that, to some extent, exonerate my code?

That being said, I've been trying to figure that out (Script is over 4000 lines long). My script doesn't ever directly call _WinAPI_GetString or even have an include for WinAPIInternals.au3.

I do have a #include <WinAPISysWin.au3>, which does have a #include "WinAPISysInternals.au3", which does have a #include "WinAPIInternals.au3". The _WinAPI_GetString function never appears in the WinAPISysWin.au3 or WinAPISysInternals.au3, and the only time it exists in WinAPIInternals.au3 is as itself.

At this point, I don't even remember why, specifically, I have #include <WinAPISysWin.au3> in there, but if I comment it out, it seems to make some radio buttons I have in a child GUI fight with some radio buttons I have in the main GUI. (By fight, I mean that it looks like GUICtrlDelete applies itself to undesired things. I don't know if that's a symptom of GUISwitch() or something else or what.)

Link to comment
Share on other sites

2 minutes ago, baconaise said:

I'm not sure if the manner in which I call the function is the issue. If I run SciTE's SyntaxCheck Prod on just the WinAPIInternals.au3 by itself without any of my code involved, it gives me the errors I mentioned above.

It doesn't do that for me, so I'm guessing you have something wrong in your copy or your code.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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