Jump to content

Recommended Posts

Posted

Hi all,

Heres a snippet of the code that throws up the error:

#include <WinAPI.au3>
    $core = 1
    if $core=1 Then
        $sPID=processexists("Processor Benchmarking2.exe")
        $hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $sPID)
        $aRet = _WinAPI_GetProcessAffinityMask($hProc)
        _WinAPI_SetProcessAffinityMask($hProc,0x01);Set affinity for dual core
        _WinAPI_CloseHandle($hProc)
    Elseif $core=2  Then
        $sPID=processexists("Processor Benchmarking2.exe")
        $hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $sPID)
        $aRet = _WinAPI_GetProcessAffinityMask($hProc)
        _WinAPI_SetProcessAffinityMask($hProc,0x03);Set affinity for dual core
        _WinAPI_CloseHandle($hProc)
    EndIf

the Error reported:

C:\Documents and Settings\Gray_Paul\My Documents\Scripting\Testbed\processor benchmarking2.au3(386,51) : WARNING: $PROCESS_ALL_ACCESS: possibly used before declaration.

$hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\Gray_Paul\My Documents\Scripting\Testbed\processor benchmarking2.au3(386,51) : ERROR: $PROCESS_ALL_ACCESS: undeclared global variable.

$hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Now the strange thing is i took this code from another one of my programs that works absolutely fine.

Any ideas?

thanks in advance

-1

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Posted

Doesn't look like you're defining PROCESS_ALL_ACCESS anywhere. I googled for the value, and I think this should work:

Global Const $PROCESS_ALL_ACCESS = 0x1f0fff

Also, you should check $sPID before you try and call OpenProcess, if it doesn't exist as a process, your script will bomb.

Posted

Doesn't look like you're defining PROCESS_ALL_ACCESS anywhere. I googled for the value, and I think this should work:

Global Const $PROCESS_ALL_ACCESS = 0x1f0fff

Also, you should check $sPID before you try and call OpenProcess, if it doesn't exist as a process, your script will bomb.

No go with that but thanks for the idea... Strange thing though is im using this code in another program and it works...

Also in the main script i check processexsists first.

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Posted

No go with that but thanks for the idea... Strange thing though is im using this code in another program and it works...

Well now that you're defining it, you should at least be getting a different error, no?

Posted

#include <Constants.au3>

damn damn damn....sorry all for the wasting of forum space ^_^

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...