❔ Big Problem in C# plz someone help
so i'm new to coding (just so you know so if you say something to advanced i will maybe not know what it is) and i have made or making a a movement for the mouse to go down with basiclly when i left click i want my mouse to go down and rn the code is about 3600 lines and i got some big problems that no one really haces on the internet or at least what i can find, this is the problems in one of the codes:
the name 'EnablePrimaryMouseButtonEvents' does not exist in the current context
and i have much more such as ..
that i had on soooo many locations but i fixed it some what with using this:
now with using does i lost a lot of errors i had in the code but it still says that the "Local function 'IsMouseButtonPressed(int)' must declare a body because it is not marked 'static extern'"
(for example) and idk what to do with that info. i guess i'm supposed to give it a comand on what is "IsMouseButtonPressed" but idk how to give it a command that works or does not give me does errors
6 Replies
now if someone wants the hole code then tell me and i will edit some stuff just because i am going to make this something that is privet, because the code is done but i needed to make it work and while doing it does things happend, but just tell me if you want the code and i will give you it (or send it here)
The error you send means, that the compiler does not know what
EnablePrimaryMouseButtonEvents
is supposed to be. It simply does not exist and so the program cannot work.
For example you got a simple Hello World Program
You could put that string
Hello World
into it's own variale.
This is functionally the same.
But now you do this:
What is the program supposed to do?
It has no clue what goodbyeVariable
is supposed to be.
Is it some other string
?
Is it a function that returns a string
?
What you basically did with declaring those local functions was the following:
Great, now the program knows it's a string
.
But that string has no value?
So it won't print anything.ok got i will see what i can do it with +rep
i wounder if i can use user32.dll in some way cuz it will help with movement
If you are in .NET 7 you can use this https://learn.microsoft.com/en-us/dotnet/standard/native-interop/pinvoke-source-generation
P/Invoke source generation - .NET
Learn about compile-time source generation for platform invokes in .NET.
I guess
Before .NET7 there is [DllImport] to work with external dlls
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.