which languages should I learn to learn DllCall and Windows API Functions?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Sabestian Caine
Posts: 420
Joined: 12 Apr 2015, 03:53

which languages should I learn to learn DllCall and Windows API Functions?

08 Dec 2018, 14:48

Hello friends...


I wish to learn DllCall (as until we learn Dllcall, we can not increase the programming area and experience in autohtokey) in AutoHotkey and I have concluded until I learn Windows API Functions and other windows languages, I will not be able to learn DllCall. So please tell me which languages should i learn first to master in dllcall?

I think first I should learn language C and then C++ as they are the basic languages of programming then I should go for JAVA etc.

Please guide me which languages are essential for learning Dllcall??

Thanks a lot.
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: which languages should I learn to learn DllCall and Windows API Functions?

08 Dec 2018, 17:48

- The answer is AutoHotkey.
- Why?
- C++ makes it easier than AutoHotkey by handling the types for you when calling functions, and handling the struct members like an associative array when handling structs.
- [EDIT:] So C++ doesn't really help with learning DllCall, because in C++ the bits that make DllCall hard in AutoHotkey are done for you. (Although C++ introduces new difficulties e.g. passing string variables into a function call.)
- [EDIT:] Learning about DllCall in AutoHotkey comes down to this: if you look up a function e.g. MessageBox or GetWindowRect can you extract the info from MSDN pages, and work out what to put into DllCall. And if there are any structs, do you know how to work out the byte offsets for each struct member and how to use VarSetCapacity/NumGet/NumPut.

Code: Select all

;Winapi function example

;AutoHotkey
DllCall("user32\MessageBox", Ptr,0, Str,"prompt", Str,"title", UInt,0)

//C++
MessageBoxA(0, "prompt", "title", 0); //ANSI
MessageBoxW(0, L"prompt", L"title", 0); //Unicode
MessageBox(0, _T("prompt"), _T("title"), 0); //Unicode or ANSI

Code: Select all

;Winapi struct example

;AutoHotkey
;WinGet, hWnd, ID, ahk_class Notepad
hWnd := DllCall("user32\FindWindow", Str,"Notepad", Ptr,0, Ptr)
VarSetCapacity(RECT, 16, 0)
DllCall("user32\GetWindowRect", Ptr,hWnd, Ptr,&RECT)
vWinX := NumGet(&RECT, 0, "Int")
vWinY := NumGet(&RECT, 4, "Int")
vWinW := NumGet(&RECT, 8, "Int") - vWinX
vWinH := NumGet(&RECT, 12, "Int") - vWinY
vWinPos := Format("x{} y{} w{} h{}", vWinX, vWinY, vWinW, vWinH)
DllCall("user32\MessageBox", Ptr,0, Str,vWinPos, Str,"title", UInt,0)

//C++
HWND hWnd = FindWindow(_T("Notepad"), NULL);
RECT RECT;
GetWindowRect(hWnd, &RECT);
std::wstring vWinX = std::to_wstring(RECT.left);
std::wstring vWinY = std::to_wstring(RECT.top);
std::wstring vWinW = std::to_wstring(RECT.right - RECT.left);
std::wstring vWinH = std::to_wstring(RECT.bottom - RECT.top);
std::wstring vWinPos = L"x" + vWinX + L" y" + vWinY + L" w" + vWinW + L" h" + vWinH;
MessageBoxW(0, vWinPos.c_str(), L"title", 0);

//C++ alternative
HWND hWnd = FindWindow(_T("Notepad"), NULL);
RECT RECT;
GetWindowRect(hWnd, &RECT);
int vWinX = RECT.left;
int vWinY = RECT.top;
int vWinW = RECT.right - RECT.left;
int vWinH = RECT.bottom - RECT.top;
wchar_t vWinPos[1000];
swprintf(vWinPos, 1000, L"x%d y%d w%d h%d", vWinX, vWinY, vWinW, vWinH);
MessageBoxW(0, vWinPos, L"title", 0);
- Java makes it harder because for Java handling the Winapi isn't made easy, you require something like the JNA/the JNI.
- I would still recommend learning more about other programming languages however.

- When I want to use the Winapi I look at the MSDN page for a function.
- I need to figure out the types for each function parameter. The AHK equivalent such as Int or Ptr.
- Some will be familiar, others I can look up on the Internet, on .h files on my hard drive (created when I install Visual Studio), and by code in Visual Studio to test what size a parameter is, and whether it's signed/unsigned. I can also check examples on the forum, but these can often be wrong (e.g. Int or UInt, when it should be Ptr). There's also this:
WinApi
https://hotkeyit.github.io/v2/docs/commands/WinApi.htm
- E.g. Visual Studio Express for Windows Desktop.
- Some Winapi functions require using a struct, a struct is n bytes of binary data, e.g. RECT is 16 bytes. I similarly look up size and signed/unsigned information about the struct parameters. And I use the sizes and knowledge of the rules of struct alignment/padding to work out the necessary offsets (the byte number) at which each struct member appears. The rules are: an n-byte parameter starts at an n-byte offset. If a struct has an n-byte parameter, its overall size must be a multiple of n bytes. When doing the calculations, you must consider that some parameters are actually composed of smaller parameters, e.g. a RECT which is 16 bytes, is made up of 4 4-byte parameters.
- 99% of the time I can figure things out fine, every so often, something weird will come up, and I might ask for help or do some trial-and-error testing.
- I'll be doing a tutorial on DllCall/structs etc but it might be some months.
Last edited by jeeswg on 08 Jan 2019, 17:56, edited 1 time in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
oif2003
Posts: 213
Joined: 17 Oct 2018, 11:43
GitHub: oif2003

Re: which languages should I learn to learn DllCall and Windows API Functions?

08 Dec 2018, 21:03

Hi, knowing C/C++ definitely helps, as it gives you access to more example codes. However, you can just as easily google and learn what you need to know about types/structs to get DllCalls to work. I recommend start using DllCalls right away and start building something. You will pick up what you need as you work through documentations and example codes. Depending on the libraries you use, it might be worthwhile to write a lookup function for Windows error codes; it has certainly saved me time.
User avatar
Sabestian Caine
Posts: 420
Joined: 12 Apr 2015, 03:53

Re: which languages should I learn to learn DllCall and Windows API Functions?

09 Dec 2018, 13:30

jeeswg wrote:
08 Dec 2018, 17:48
- The answer is AutoHotkey.
- Why?
- C++ makes it easier than AutoHotkey by handling the types for you when calling functions, and handling the struct members like an associative array when handling structs.

Code: Select all

;Winapi function example

;AutoHotkey
DllCall("user32\MessageBox", Ptr,0, Str,"prompt", Str,"title", UInt,0)

//C++
MessageBoxA(0, "prompt", "title", 0); //ANSI
MessageBoxW(0, L"prompt", L"title", 0); //Unicode
MessageBox(0, _T("prompt"), _T("title"), 0); //Unicode or ANSI

Code: Select all

;Winapi struct example

;AutoHotkey
;WinGet, hWnd, ID, ahk_class Notepad
hWnd := DllCall("user32\FindWindow", Str,"Notepad", Ptr,0, Ptr)
VarSetCapacity(RECT, 16, 0)
DllCall("user32\GetWindowRect", Ptr,hWnd, Ptr,&RECT)
vWinX := NumGet(&RECT, 0, "Int")
vWinY := NumGet(&RECT, 4, "Int")
vWinW := NumGet(&RECT, 8, "Int") - vWinX
vWinH := NumGet(&RECT, 12, "Int") - vWinY
vWinPos := Format("x{} y{} w{} h{}", vWinX, vWinY, vWinW, vWinH)
DllCall("user32\MessageBox", Ptr,0, Str,vWinPos, Str,"title", UInt,0)

//C++
HWND hWnd = FindWindow(_T("Notepad"), NULL);
RECT RECT;
GetWindowRect(hWnd, &RECT);
std::wstring vWinX = std::to_wstring(RECT.left);
std::wstring vWinY = std::to_wstring(RECT.top);
std::wstring vWinW = std::to_wstring(RECT.right - RECT.left);
std::wstring vWinH = std::to_wstring(RECT.bottom - RECT.top);
std::wstring vWinPos = L"x" + vWinX + L" y" + vWinY + L" w" + vWinW + L" h" + vWinH;
MessageBoxW(0, vWinPos.c_str(), L"title", 0);

//C++ alternative
HWND hWnd = FindWindow(_T("Notepad"), NULL);
RECT RECT;
GetWindowRect(hWnd, &RECT);
int vWinX = RECT.left;
int vWinY = RECT.top;
int vWinW = RECT.right - RECT.left;
int vWinH = RECT.bottom - RECT.top;
wchar_t vWinPos[1000];
swprintf(vWinPos, 1000, L"x%d y%d w%d h%d", vWinX, vWinY, vWinW, vWinH);
MessageBoxW(0, vWinPos, L"title", 0);
- Java makes it harder because for Java handling the Winapi isn't made easy, you require something like the JNA/the JNI.
- I would still recommend learning more about other programming languages however.

- When I want to use the Winapi I look at the MSDN page for a function.
- I need to figure out the types for each function parameter. The AHK equivalent such as Int or Ptr.
- Some will be familiar, others I can look up on the Internet, on .h files on my hard drive (created when I install Visual Studio), and by code in Visual Studio to test what size a parameter is, and whether it's signed/unsigned. I can also check examples on the forum, but these can often be wrong (e.g. Int or UInt, when it should be Ptr). There's also this:
WinApi
https://hotkeyit.github.io/v2/docs/commands/WinApi.htm
- E.g. Visual Studio Express for Windows Desktop.
- Some Winapi functions require using a struct, a struct is n bytes of binary data, e.g. RECT is 16 bytes. I similarly look up size and signed/unsigned information about the struct parameters. And I use the sizes and knowledge of the rules of struct alignment/padding to work out the necessary offsets (the byte number) at which each struct member appears. The rules are: an n-byte parameter starts at an n-byte offset. If a struct has an n-byte parameter, its overall size must be a multiple of n bytes. When doing the calculations, you must consider that some parameters are actually composed of smaller parameters, e.g. a RECT which is 16 bytes, is made up of 4 4-byte parameters.
- 99% of the time I can figure things out fine, every so often, something weird will come up, and I might ask for help or do some trial-and-error testing.
- I'll be doing a tutorial on DllCall/structs etc but it might be some months.


Thanks a lot dear jeeswg ...

Dear jeeswg, i am thinking to learn c language as it is basic language for windows. After learning it i will go for c++. As i have no programming background, so i think it will be some difficult for me to grasp the concept of c and c++ but slowly i will make command on them. In fact, as far as i know, dllcall gives huge possibility and it has much potentials for doing great stuff which are not directly possible by native Autohotkey. I use Autohotkey too much in my daily computer work but still i am unable to do more complex stuff due to lack of knowlegde of dllcall and windows API functions etc. Moreover, most of the great functions written in autohotkey are not possible to write without dllcall indeed. Hence, i think the knowledge of dllcall and other programming language is quite necessary to use autohotkey more efficiently. What are your views regarding it? Please tell and guide. Thank you sir..
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: which languages should I learn to learn DllCall and Windows API Functions?

09 Dec 2018, 14:00

- I found this video by Derek Banas great, as an introduction to C++.
C++ Programming - YouTube
https://www.youtube.com/watch?v=Rub-JsjMhWY
- I list various other programming language resources here:
resources for learning a programming language - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 17&t=56140
- I didn't learn C, I went straight to C++, and I hear C is essentially a subset of C++. I checked about 20 videos on YouTube and couldn't find anything decent re. C versus C++, the distinction.
- I think that DllCall and structs are the key to further progress in AutoHotkey, and I might add to that list, COM.
- I often hear people saying vaguely, I want to learn more things, and that's understandable, I think I've probably felt like that at times too. But what I do nowadays is ask these questions: (a) how can I do specific task X, and learn whatever I need to know to active it, (b) how can I do basic string/mathematical/object things, (c) what are some of the obvious things someone might want to do for a programming language/tool.
- Stack Overflow is quite good for basic examples when learning a new programming language.
- Learning about other programming languages did not help me to improve at DllCall or structs etc at all. Having Visual Studio has been useful in querying information relating to DllCall and structs however, via C++ code to check info about parameter/struct types and looking in h files. (Very often you need to know the value of a constant, and sometimes MSDN pages list those numbers, sometimes they don't.)
- Learning other programming languages is also useful if you want to translate something into AHK, or understand parts of the AHK source code. And of course edit/add to the AHK source code.
- To learn more about DllCall I would try to find some existing code, look up any Winapi functions used that are called by DllCall and see if I could recreate that DllCall line myself. And in general, I would try to achieve some code objective, try to write the code, and look up any relevant existing code on the forum, and when needed, look up information re. Winapi functions and DllCall.
- Anyway, in short to learn anything, it's just googling and more googling, and sometimes asking questions.
- Also, Bing often gives much better results when searching the AutoHotkey forums. I.e. for finding information in the more obscure, less viewed threads.

- I'd welcome any comments by other people, particularly about C.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Helgef
Posts: 4072
Joined: 17 Jul 2016, 01:02
Contact:

Re: which languages should I learn to learn DllCall and Windows API Functions?

09 Dec 2018, 14:38

@ jeeswg, that is not good advice, he wants to understand what he does, not just learn how to.

Proceed with C, and learn from good text books, universities and by reading documentation, not just google.

I wish you the best of luck, cheers.
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: which languages should I learn to learn DllCall and Windows API Functions?

09 Dec 2018, 14:54

- @Helgef: The OP centres around *DllCall*, which sometimes requires the use of structs. The core problems with DllCall are type sizes/signs, struct alignment, and knowing the values of constants. I do not feel that being able to program in other languages has any relevance to answering these questions. (The one caveat is that C++ code and h files can be used to get you some of the information needed for DllCall.)
- When I've *really* wanted to understand something, textbooks and documentation often aren't good enough or don't exist. Here are some good examples:
jeeswg's homepage - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 42#p144442
- What would you consider the actual documentation for C or C++, that is online. The links that I have found for this have not been particularly good.
- And are you saying that going to multiple universities is useful advice?
- Trying to find the right textbook is expensive and time-consuming, if you've found any good ones please share some recommendations.

- Btw how are people meant to find good textbooks and universities? Googling?
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
DRocks
Posts: 548
Joined: 08 May 2018, 10:20

Re: which languages should I learn to learn DllCall and Windows API Functions?

10 Dec 2018, 06:31

I am impressed how short c++ is. I aleays thought that it would be more complicated than AutoHotkey but it just looks a bit different..

Am i right to say that when you are at a point you are doing things with c++ equivalents in AHK its time to learn c++?

PS: udemy is not expansive and has courses on almost anything. I bought c++ course for 12$ and HTML CSS JavaScript for beginners. Its awesome and its in video format so best eay to learn for me.
User avatar
Sabestian Caine
Posts: 420
Joined: 12 Apr 2015, 03:53

Re: which languages should I learn to learn DllCall and Windows API Functions?

10 Dec 2018, 12:42

jeeswg wrote:
09 Dec 2018, 14:00
- I found this video by Derek Banas great, as an introduction to C++.
C++ Programming - YouTube
https://www.youtube.com/watch?v=Rub-JsjMhWY
- I list various other programming language resources here:
resources for learning a programming language - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 17&t=56140
- I didn't learn C, I went straight to C++, and I hear C is essentially a subset of C++. I checked about 20 videos on YouTube and couldn't find anything decent re. C versus C++, the distinction.
- I think that DllCall and structs are the key to further progress in AutoHotkey, and I might add to that list, COM.
- I often hear people saying vaguely, I want to learn more things, and that's understandable, I think I've probably felt like that at times too. But what I do nowadays is ask these questions: (a) how can I do specific task X, and learn whatever I need to know to active it, (b) how can I do basic string/mathematical/object things, (c) what are some of the obvious things someone might want to do for a programming language/tool.
- Stack Overflow is quite good for basic examples when learning a new programming language.
- Learning about other programming languages did not help me to improve at DllCall or structs etc at all. Having Visual Studio has been useful in querying information relating to DllCall and structs however, via C++ code to check info about parameter/struct types and looking in h files. (Very often you need to know the value of a constant, and sometimes MSDN pages list those numbers, sometimes they don't.)
- Learning other programming languages is also useful if you want to translate something into AHK, or understand parts of the AHK source code. And of course edit/add to the AHK source code.
- To learn more about DllCall I would try to find some existing code, look up any Winapi functions used that are called by DllCall and see if I could recreate that DllCall line myself. And in general, I would try to achieve some code objective, try to write the code, and look up any relevant existing code on the forum, and when needed, look up information re. Winapi functions and DllCall.
- Anyway, in short to learn anything, it's just googling and more googling, and sometimes asking questions.
- Also, Bing often gives much better results when searching the AutoHotkey forums. I.e. for finding information in the more obscure, less viewed threads.

- I'd welcome any comments by other people, particularly about C.

Dear jeeswg, first of all i appreciate your sprite of guiding newbies like me... You are really doing outstanding work..


Sir, as you told that leaning c++ and other language will not help leaning dllcall and other ahk stuff, then please tell me in what context learning c++ will help me to proceed in ahk? Moreover i want to know that ahk is similar to what programming language? Some time ago someone mentioned that ahk is quite similar to Python. Is it true? Is ahk is mixture of many programming languages? thanks..
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: which languages should I learn to learn DllCall and Windows API Functions?

10 Dec 2018, 16:48

- I think that all programming languages are quite similar. Define variables, string/mathematical manipulation, objects, loops, functions etc.
- Furthermore, if there's an innovation in one, people in other languages will ask for similar functionality.
- The main difference I've seen between programming languages is types. Either you have to explicitly specify types everywhere, like C++ and Java, or you don't have to, like AutoHotkey and Python.
- I find types the key thing that makes code verbose and 'complicated'. E.g. you have to specify a type every time you define a variable, and writing a function to handle multiple types can be awkward. E.g. AHK objects can handle key names and key values that are strings or numbers, whereas in other languages that would be 4 different object types.
- I'd say that AutoHotkey and Python are quite similar because you don't have to worry about types. The main difference is that Python doesn't use curly braces, you use indentation instead. However, the creator of Python said this was a bad idea, and I wouldn't be surprised if one day they make the bold decision and bring back curly braces.
- For me, learning programming languages has been like learning spoken languages, different words and some different grammar rules, but that's it. It was actually a bit more of a challenge to learn SQL than a new programming language, not that SQL was hard, but that it was addressing different things, and I had to think about new ideas, learning new programming languages was more a case of just translating things.
- When you've learned one programming language well, you've learned them all.
- I'm working on a summary of the 4 programming languages mentioned above, comparing them.

- I mentioned before using C++ to get information about structs and DllCall parameters via running C++ code and h files (header files).
- The AHK source code provides numerous code examples outlining what Winapi functions to use, and what parameter values to use.
- Sometimes an AHK command / function doesn't do exactly what I want it to do. Looking at the source code I may be able to recreate and modify the functionality using DllCall. E.g. loops handling long filenames:
259-char path limit workarounds - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=26170
- Here are various DllCall examples, often based on the AHK source code.
AutoHotkey via DllCall: AutoHotkey functions as custom functions - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=37871
- There might be different approaches for sending keys/activating windows/downloading files etc, when experimenting with different approaches, it's useful to know what AHK does, i.e. you wouldn't need to recreate that approach.
- Knowing other programming languages makes it easier to translate advanced code to AHK.
- If I have a problem I might see if there is any existing AHK code (complete scripts or some bits of relevant code), or (rarely) I might look for C++ examples on various forums and translate them. Sometimes DllCall will be involved, sometimes it won't be. For each Winapi function I could: list the AHK version of the parameter types cf. the Winapi link below, list any values for constants, and list any sizes/parameter offsets for any structs. Each of those things can be quite challenging in terms of *searching* for information, but they aren't really *programming* challenges. So those are what I consider the main difficulties when using DllCall.
WinApi
https://hotkeyit.github.io/v2/docs/commands/WinApi.htm
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
oif2003
Posts: 213
Joined: 17 Oct 2018, 11:43
GitHub: oif2003

Re: which languages should I learn to learn DllCall and Windows API Functions?

10 Dec 2018, 17:46

jeeswg wrote:
10 Dec 2018, 16:48
- I think that all programming languages are quite similar.
Hi Jeeswg, perhaps you mean this in the most general sense, but I think it could be misleading to someone who is new to programming. To say, "all programming languages are similar", is like saying, "all cars are similar", that is, until you actually need one, then you realize they serve different purposes. While I do not think it is necessary or maybe even useful to learn C (considering the time trade off), I can see how an university level introductory course can be beneficial, or perhaps a book/ebook if one is sufficiently motivated.
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: which languages should I learn to learn DllCall and Windows API Functions?

10 Dec 2018, 18:01

- @oif2003: All extant programming languages are quite similar. It's written as a challenge, can you successfully knock that sentence off its perch? (I was led there by the thought that yes, AutoHotkey and Python are similar, but how can I pin it down ... ultimately, it's because all programming languages are pretty similar, especially those that don't use types, and often languages are similar because users demand the features/syntax that others have.)
- I feel that so far on this thread, you and Helgef have contributed what any average person with zero knowledge of programming could say: read some books, do a course, look at some websites. In all things I like *specifics*. Any tips? Any resources? Any interesting reflections?
- In your defence, you made reference to this earlier, which is helpful.
System Error Codes (0-499) - Windows applications | Microsoft Docs
https://docs.microsoft.com/en-us/window ... es--0-499-
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
oif2003
Posts: 213
Joined: 17 Oct 2018, 11:43
GitHub: oif2003

Re: which languages should I learn to learn DllCall and Windows API Functions?

10 Dec 2018, 18:43

jeeswg wrote:
10 Dec 2018, 18:01
- @oif2003: All extant programming languages are quite similar. It's written as a challenge, can you successfully knock that sentence off its perch?
- I feel that so far on this thread, you and Helgef have contributed what any average person with zero knowledge of programming could say: read some books, do a course, look at some websites. In all things I like *specifics*. It would be interesting to hear your more specific takes on the questions.
- In your defence, you made reference to this earlier, which is helpful.
System Error Codes (0-499) - Windows applications | Microsoft Docs
https://docs.microsoft.com/en-us/window ... es--0-499-
I will not pretend to be an expert at this, but even a cursory search on google of "OOP vs Functional Programming" or "Multiple Dispatch" will give you a lot of interesting reads on how programming languages are designed and their limitations, so different programming languages are clearly not the same. As for showing how they are not similar, I will not attempt that, as what one define as "similar" can be very subjective.

For specifics, I recommend something like Think Python unless OP has specific needs, such as hacking a game or building a particular app: https://interactivepython.org/runestone ... index.html
I do not use Python, but I am having a blast working through Think Julia and chewing through Julia's manual. Since Think Julia is a port of Think Python, I imagine it'd be pretty awesome, too.

I think some of the reasons many people like to recommend taking a course or working through a book are (and not limited to):
1) they offer structure, which helps with understanding and information retention,
2) provides a way to measure progress and self-assess, it is easy to get lost googling all day unless one has strong motivation to finish a project,
3) it's less likely to miss elegant/simple solutions in the language since classes and books usually do a good job covering the basics and showcasing its strengths
4) makes it easier for beginners to find answers (from teacher/classmates), and ask better questions, too as formal training usually put more emphasis on definitions and terms

I am not saying your approach is necessarily wrong, only that the traditional approach seems to be more suitable for most people.
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: which languages should I learn to learn DllCall and Windows API Functions?

10 Dec 2018, 19:49

- Got any good resources re. OOP/FP/PP etc. I generally found only very poor materials when I looked at it previously.
- Do any of those paradigms ever result in very different ways of doing core programming tasks in different languages?
- I tend to think that although C++ and Java are tricky to use, you could write functions and thus wrap things in a certain way and thus write code with an ease similar to AutoHotkey or Python.
- Thanks for the Think Python recommendation. (The Think books have a coloured rectangle and an animal on them.) I notice that Think Julia isn't one of the series (yet?), but an html book. Julia worth it to learn?
- (Haha a 'port' would hint that the two languages and therefore possibly all languages are similar.)
- It's funny, I haven't wanted or needed a programming book yet. I might give one a shot just to see if I can fill anything in, or for some other ideas/perspectives. I read Code by Charles Petzold and have always been too busy to read Programming Windows, but a few pages of it came up during a Google search on greying out icons.
- I have always valued the documentation for any software/languages though, for me it's usually documentation plus searching.
- Funnily enough, the Internet lets you hear from people directly, be it The Old New Thing or video lectures.
- I like free resources because I can immediately point people to them, and refer back to them at a later date. Not so easy with a paywalled video or an unrecorded lecture from n years ago.
- Sometimes books belabour things and slow you down. I like to jump straight to the main point when doing things.
- I think people forget how often they google things while trying to follow a book.
- Defining your own goals, and going straight to it, can be better than doing random tasks. Doing what you want to or need to do can be better than being restrained by what the book covers.
- I don't much like the stupid and unnecessary pressures and hoops that courses put you through. The worst-case scenario is withholding information from you to test you on it, rather than letting you make the judgement of investigating something at that moment.
- Quite often, new things are added to a language, and so methods from a few years ago are a bit out-of-date.
- I've generally been very dissatisfied with courses that I've taken, I feel that the knowledge is incomplete, and if I wanted to cover the material properly I'd have to study it all over again independently in a more thorough way. The longer the course, the greater the waste.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
oif2003
Posts: 213
Joined: 17 Oct 2018, 11:43
GitHub: oif2003

Re: which languages should I learn to learn DllCall and Windows API Functions?

10 Dec 2018, 20:41

jeeswg wrote:
10 Dec 2018, 19:49
I am afraid I cannot offer you any insights on OOP/FP/PP. If you want to know more about FP, you may want to look into Lambda Calculus, where programs can be proven to be correct mathematically. One of the things I recently learned from reading Julia's manual is (and I feel very stupid for not realizing this sooner), OOP is essentially a single dispatch system, where methods depends on the object. In Julia, methods belongs to the function, and the method used depends on the arguments (all of them) instead of only the first one (usually "this" in OOP).

One of the good things about books is, if you got the chops, you can always skip ahead. I often find myself doing the exact opposite, however. Forgive me if I am wrong, but I think you are either reading the wrong books or you are not reading them correctly, the same goes for courses.

If you are not allergic to math and you want to learn about machine learning, my limited understanding on the subject is that Julia is a very good choice. The code is elegant, consistent, and very fast. If you browse through the contents of Think Julia and Think Python, you will find that the structure and exercises are quite different. There are no CarTalk puzzles (which I thoroughly enjoyed) in Think Python, and I also didn't see anything about Markov analysis. In short, Think Julia looks quite different from Think Python. Perhaps the project started out as a simple port, and eventually took on a different path. Anyway, I recall the author of Think Julia saying his port is "supported" by Allen Downey, the creator of Think Python on the Julia forum (https://discourse.julialang.org).
User avatar
Sabestian Caine
Posts: 420
Joined: 12 Apr 2015, 03:53

Re: which languages should I learn to learn DllCall and Windows API Functions?

12 Dec 2018, 02:00

jeeswg wrote:
10 Dec 2018, 19:49
- Got any good resources re. OOP/FP/PP etc. I generally found only very poor materials when I looked at it previously.
- Do any of those paradigms ever result in very different ways of doing core programming tasks in different languages?
- I tend to think that although C++ and Java are tricky to use, you could write functions and thus wrap things in a certain way and thus write code with an ease similar to AutoHotkey or Python.
- Thanks for the Think Python recommendation. (The Think books have a coloured rectangle and an animal on them.) I notice that Think Julia isn't one of the series (yet?), but an html book. Julia worth it to learn?
- (Haha a 'port' would hint that the two languages and therefore possibly all languages are similar.)
- It's funny, I haven't wanted or needed a programming book yet. I might give one a shot just to see if I can fill anything in, or for some other ideas/perspectives. I read Code by Charles Petzold and have always been too busy to read Programming Windows, but a few pages of it came up during a Google search on greying out icons.
- I have always valued the documentation for any software/languages though, for me it's usually documentation plus searching.
- Funnily enough, the Internet lets you hear from people directly, be it The Old New Thing or video lectures.
- I like free resources because I can immediately point people to them, and refer back to them at a later date. Not so easy with a paywalled video or an unrecorded lecture from n years ago.
- Sometimes books belabour things and slow you down. I like to jump straight to the main point when doing things.
- I think people forget how often they google things while trying to follow a book.
- Defining your own goals, and going straight to it, can be better than doing random tasks. Doing what you want to or need to do can be better than being restrained by what the book covers.
- I don't much like the stupid and unnecessary pressures and hoops that courses put you through. The worst-case scenario is withholding information from you to test you on it, rather than letting you make the judgement of investigating something at that moment.
- Quite often, new things are added to a language, and so methods from a few years ago are a bit out-of-date.
- I've generally been very dissatisfied with courses that I've taken, I feel that the knowledge is incomplete, and if I wanted to cover the material properly I'd have to study it all over again independently in a more thorough way. The longer the course, the greater the waste.


Thanks again dear jeeswg ... I am quite impressed seeing your contribution for AHK community... :bravo: :bravo:


Jeeswg, As you told that all languages are same and if one learns one language properly then he gets the knowledge of other languages also, so I am a bignner and my first language is AHK, If i learn start learning Python, then would it help me learning AhK more deeply?

Sir, I was watching a tutorial regarding python and it was told that python is object oriented language and it is dynamically typed language and it is a interpreted language. So I want to know what does it actually mean by object oriented language and dynamically typed language and interpreted language? Is AHK also object oriented language, dynamically typed language and interpreted language? Please tell me sir. Thank you..
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: which languages should I learn to learn DllCall and Windows API Functions?

12 Dec 2018, 03:14

- To learn a language deeply, I would (a) try to solve any problems I needed/wanted to solve, (b) try to solve any problems that I already knew I could solve in another language.
- If you know one language *really* well, then that gives you more ideas from already-solved problems to draw from.
- If you became better at Python than you are at AutoHotkey, only at that point would knowing Python be particularly beneficial for learning AutoHotkey.
- I felt when learning C++ and Java that knowing AutoHotkey well was really beneficial, although dealing with types was a bit of a novelty, everything else felt familiar pretty much. Learning Python was ultimately more like translating code.
- Learning a 2nd language, would help you to see the universal programming principles across multiple/all languages. It would also give you ideas for good syntax to be added to other languages. And as you learn more languages, this gives you ideas for writing code in a very compatible, easy-to-convert way.

- Re. all the buzzwords, people are welcome to chip in ...
- Yes, I believe AHK has those 3 properties also.
- Nowadays I'm not sure which languages don't support OOP.
- Re. 'typed', these 4 terms never seem to be well defined. In short, dynamic and weak typing make programming easier, versus writing half your code to specify and convert/cast types every time you write code. E.g. different variations of strings, numbers and objects.
terminology - Static/Dynamic vs Strong/Weak - Stack Overflow
https://stackoverflow.com/questions/235 ... trong-weak
- Re. compiled, I generally think of C++ exes taking ages to compile, but being quick to run. And re. interpreted, of modifying AHK scripts and them running straightaway. I notice with a few dozen lines that C++ compiling can be quite quick, but then suddenly it gets slow as the code gets bigger. Interpreted languages are supposed to be slower when running, not that I've noticed any particular slowness with AHK, but you don't have the delays re. compiling. However, for some tasks that would be slow if you used AutoHotkey's Loop and NumGet/NumPut, I use machine code executed via the DllCall function.

- I have a lot of sympathy for people trying to understand: what are the main languages and how are they different. Some approaches are: a timeline, a list by popularity, and a run-down of some differences.
- I've added a list of videos re. programming languages generally, here:
resources for learning a programming language - AutoHotkey Community
https://www.autohotkey.com/boards/viewt ... 17&t=56140
- I liked these two in particular by Mike Levin, the first one addresses the 3 issues you mentioned, and some others.
Differences Between Programming Languages - YouTube
https://www.youtube.com/watch?v=qmksVfulV0o
Choosing A Programming Language - YouTube
https://www.youtube.com/watch?v=L3zr3iD2vCA
- There are various sources that keep track of programming language popularity, including this one:
Stack Overflow Developer Survey 2018
https://insights.stackoverflow.com/surv ... -languages
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: which languages should I learn to learn DllCall and Windows API Functions?

21 Dec 2018, 03:52

Re. my earlier comment:
I think that all [extant] programming languages are quite similar.
Here's one of the best sources on comparing programming languages that I've come across:
Perl Tutorial - YouTube
https://www.youtube.com/watch?v=WEghIXs8F6c
i am wondering how you remember all the syntax of almost all top languages.
...
I refresh my memory before the video if I haven't used it for a while. Most languages are very similar
Credentials:
Derek Banas - YouTube
https://www.youtube.com/user/derekbanas/playlists
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Sabestian Caine
Posts: 420
Joined: 12 Apr 2015, 03:53

Re: which languages should I learn to learn DllCall and Windows API Functions?

21 Dec 2018, 04:34

jeeswg wrote:
21 Dec 2018, 03:52
Re. my earlier comment:
I think that all [extant] programming languages are quite similar.
Here's one of the best sources on comparing programming languages that I've come across:
Perl Tutorial - YouTube
https://www.youtube.com/watch?v=WEghIXs8F6c
i am wondering how you remember all the syntax of almost all top languages.
...
I refresh my memory before the video if I haven't used it for a while. Most languages are very similar
Credentials:
Derek Banas - YouTube
https://www.youtube.com/user/derekbanas/playlists


Thanks a lot dear jeeswg... You really provided me very precious information about languages...


Sir, please tell me that is it possible to automate things in python also? as it is possible in AHK? Python is as compatible and flexible for automation as AHk is? Please guide me sir...
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.

Return to “Ask For Help”

Who is online

Users browsing this forum: adrian_9832, Bing [Bot], Google [Bot] and 231 guests