Search found 78 matches

by 1100++
25 Jul 2020, 14:09
Forum: Ask For Help
Topic: Can't Call WinAPI from mCode
Replies: 4
Views: 1419

Re: Can't Call WinAPI from mCode

I tried that and it still didn't work.
by 1100++
25 Jul 2020, 12:09
Forum: Ask For Help
Topic: Can't Call WinAPI from mCode
Replies: 4
Views: 1419

Can't Call WinAPI from mCode

I'm trying to use the function described here to write a machine code function that calls QueryPerformanceCounter() and returns the result. This might seem unnecessary, but, as it turns out, I was able to get better performance by wrapping QueryPerformanceCounter() in my own DLL function and calling...
by 1100++
22 Jul 2020, 00:00
Forum: Ask For Help
Topic: ThreadObj() Not Found
Replies: 1
Views: 1194

ThreadObj() Not Found

I'm trying to use the ThreadObj() function to monitor when I press the RWin key and retrieve the timestamps created. However, when I try to run a script that uses the function, I get a message saying that it doesn't exist. Here's my code: MonitorRWin := ThreadObj("Loop {`nKeyWait RWin, D`nDllCall(""...
by 1100++
19 Jul 2020, 21:47
Forum: Ask For Help
Topic: Script Can't Wait for Two Things at Once
Replies: 1
Views: 1140

Script Can't Wait for Two Things at Once

I'm trying to incorporate two mechanisms into a script: one to monitor when the RWin key is pressed, and another to monitor when an emulator window becomes active. I use two waiting loops to accomplish my task. Here's my code: #NoEnv #Persistent SetBatchLines -1 GroupAdd Emulator, ahk_class EPSX Gro...
by 1100++
04 Apr 2020, 15:58
Forum: Wish List
Topic: Allow Binding of ByRef Parameters via Bind() Method
Replies: 2
Views: 1036

Allow Binding of ByRef Parameters via Bind() Method

Could it be made possible to bind variables to function objects using the Bind() method and have the passed variable be available to the function ByRef when it is called if the corresponding parameter is a ByRef parameter? For example: var := "Unaltered variable" boundFn := Func("fn").Bind(var) boun...
by 1100++
03 Apr 2020, 00:07
Forum: C/C++
Topic: 32-bit DLL Library Not Working with 32-bit AutoHotkey
Replies: 0
Views: 1583

32-bit DLL Library Not Working with 32-bit AutoHotkey

I wrote some C++ functions into a couple of DLLs that I call from AutoHotkey. One is a 64-bit DLL that I use with 64-bit AutoHotkey, and the other is its 32-bit counterpart that I use with 32-bit AutoHotkey. While the 64-bit version seems to work fine (my version of Windows is 64-bit), the 32-versio...
by 1100++
24 Mar 2020, 23:51
Forum: Ask For Help
Topic: Arsinh Function Not Working Topic is solved
Replies: 6
Views: 595

Re: Arsinh Function Not Working Topic is solved

Never mind, I know what's wrong. I got the argument scaling formula wrong. Here's my corrected function: arsinh(x) { static terms := [0, 0, 0, 0, 0, 0, 0, 0] If x is not number return power := 1, s := abs(x) While s > .0625 s := sqrt((sqrt(s * s + 1) - 1) / 2), power *= 2 terms[1] := x := (x < 0 ? -...
by 1100++
22 Mar 2020, 12:33
Forum: Ask For Help
Topic: Arsinh Function Not Working Topic is solved
Replies: 6
Views: 595

Arsinh Function Not Working Topic is solved

I'm trying to write a function that calculates the arsinh of a number. I'm using a formula found on this Wikipedia page to calculate it. Here's my code: arsinh(x) { static terms := [0, 0, 0, 0, 0, 0, 0, 0] If x is not number return power := 1, s := abs(x) While s > .0625 s := sqrt(sqrt(s * s + 1) - ...
by 1100++
17 Jan 2020, 15:19
Forum: Ask For Help
Topic: Hotkeys Not Working Topic is solved
Replies: 3
Views: 476

Re: Hotkeys Not Working Topic is solved

Helgef, the post you linked to inspired a workaround. #NoEnv SetBatchLines -1 DllCall("QueryPerformanceFrequency", "Int64*", freq) Loop { KeyWait RWin, D DllCall("QueryPerformanceCounter", "Int64*", RWinP) KeyWait RWin } return #If qpc() - RWinP << 1 <= freq and A_PriorKey == "RWin" and WinExist("A"...
by 1100++
16 Jan 2020, 15:05
Forum: Ask For Help
Topic: Hotkeys Not Working Topic is solved
Replies: 3
Views: 476

Hotkeys Not Working Topic is solved

I'm trying to write a script that will minimize the active window when I press the right Windows key alone, and close the active window when I press the right Windows key while the right control key is held down. This is what I have so far. #NoEnv SetBatchLines -1 DllCall("QueryPerformanceFrequency"...
by 1100++
16 Jan 2020, 10:19
Forum: Ask For Help
Topic: Wrong Exit Reason Displayed on Script Reload
Replies: 6
Views: 933

Re: Wrong Exit Reason Displayed on Script Reload

For whatever reason, it doesn't work on the script I posted. It gives the reason "Exit" when reloaded.
by 1100++
16 Jan 2020, 07:24
Forum: Ask For Help
Topic: Wrong Exit Reason Displayed on Script Reload
Replies: 6
Views: 933

Wrong Exit Reason Displayed on Script Reload

Whenever I reload this particular script, it always gives "Exit" as the exit reason, instead of "Reload". ; // Directives // #NoEnv #LTrim #UseHook #SingleInstance #KeyHistory 500 #Include %A_ScriptDir% #Hotstring EndChars -%()[]{}:'/\,.?! `n`t;" ;" ; // Auto-Execute Section // SetBatchLines -1 SetW...
by 1100++
03 Jan 2020, 00:51
Forum: C/C++
Topic: DllCall Produces Strange Error Code
Replies: 7
Views: 3589

Re: DllCall Produces Strange Error Code

I think I've determined that the error code comes from the call to LoadLibrary() that I perform before calling the function; apparently, my call to GetProcAddress() afterward has no effect on the value.
by 1100++
03 Jan 2020, 00:24
Forum: C/C++
Topic: DllCall Produces Strange Error Code
Replies: 7
Views: 3589

Re: DllCall Produces Strange Error Code

Using SetLastError(0); inside one of the functions resulted in an A_LastError value of zero.
If I call SetLastError(n) before calling one of my functions, the value n is preserved through the function call.
by 1100++
02 Jan 2020, 09:45
Forum: C/C++
Topic: DllCall Produces Strange Error Code
Replies: 7
Views: 3589

Re: DllCall Produces Strange Error Code

Could it be DllMain()? I just used the default version provided with the Visual Studio template.
by 1100++
02 Jan 2020, 09:11
Forum: C/C++
Topic: DllCall Produces Strange Error Code
Replies: 7
Views: 3589

Re: DllCall Produces Strange Error Code

Yes.
by 1100++
02 Jan 2020, 06:46
Forum: C/C++
Topic: DllCall Produces Strange Error Code
Replies: 7
Views: 3589

DllCall Produces Strange Error Code

In order to use C++ code within AutoHotkey, I've been writing the code into functions that I compile into DLLs with Visual Studio and call with DllCall() . However, while most of the functions work as expected and set ErrorLevel to 0 after being called, they always set A_LastError to 126—"The specif...
by 1100++
01 Jan 2020, 15:06
Forum: C/C++
Topic: Code Not Working (Vectors) Topic is solved
Replies: 2
Views: 2899

Re: Code Not Working (Vectors) Topic is solved

I figured it out. #include <iostream> #include <vector> using namespace std; typedef struct { __int64 size = 0; vector<__int64>* array; } int_array; int main () { int_array num_array; num_array.array = new vector<__int64>; num_array.array->resize(5); // Apparently, reserve() doesn't do what I though...
by 1100++
01 Jan 2020, 13:01
Forum: C/C++
Topic: Code Not Working (Vectors) Topic is solved
Replies: 2
Views: 2899

Code Not Working (Vectors) Topic is solved

As a test, I wrote a code sample that includes a pointer to a vector in a struct. It attempts to create an instance of the struct, assign a new vector to it, assign a value to one of the vector's members, and then print that value as read from the vector. #include <iostream> #include <vector> using ...
by 1100++
30 Dec 2019, 19:21
Forum: C/C++
Topic: How to Access Members of a Vector from a Pointer Topic is solved
Replies: 1
Views: 2846

Re: How to Access Members of a Vector from a Pointer Topic is solved

I figured out how to do it. #include <iostream> #include <vector> typedef struct { __int64 size; vector<__int64>* numbers; } num_array; int main() { num_array array; array.numbers->resize(5); // This is how you access a vector from a pointer. (*array.numbers)[0] = 5; cout << (*array.numbers)[0]; ret...

Go to advanced search