Author Topic: Spriggsy's API Collection  (Read 2946 times)

0 Members and 1 Guest are viewing this topic.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #45 on: October 05, 2020, 02:41:32 AM »
Updated 02:40 AM on 10/05/2020

Added MessageBeep function from User32 which plays WAV audio for each of the standard Windows message sounds.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #46 on: October 07, 2020, 01:48:06 AM »
Updated 01:45 AM on 10/07/2020

Added OpenClipboard and GetClipboard functions from User32. Program is basically a rewrite of what is going on behind the scenes with var$ = _CLIPBOARD$. Uses PeekPoke library from the Wiki found here: https://www.qb64.org/wiki/PEEK_and_POKE_Library
Also, added more functions to DoEnvironmentSubstA API for speed comparison between each of the different functions that achieve the same end result (if used the same way).

Added InternetOpenA, InternetConnect, FtpGetFile from Wininet. Will add code for HttpOpenRequest and HttpSendRequest in the future. Code will revamp all my online APIs to be more advanced.
« Last Edit: October 07, 2020, 02:06:27 AM by SpriggsySpriggs »

Offline Dav

  • Seasoned Forum Regular
  • Posts: 341
Re: Spriggsy's API Collection
« Reply #47 on: October 08, 2020, 10:58:55 AM »
Nice collection you have going here!

- Dav

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #48 on: October 08, 2020, 11:07:42 AM »
Appreciate it, @Dav !

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #49 on: October 09, 2020, 01:10:39 AM »
Updated 01:09 AM on 10/09 AM

Added GetBinaryType from Kernel32. This inspects a binary executable file and returns what type it is; 32, 64, MS-DOS, etc.

Updated 01:54 AM on 10:09 AM

Added GetTempPath and GetTempFileName from Kernel32 which can be used to get a temp folder and filename for files in your applications.
« Last Edit: October 09, 2020, 01:55:40 AM by SpriggsySpriggs »

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #50 on: October 09, 2020, 08:48:59 PM »
Updated 08:47 PM on 10/09/2020

Added GetDateFormat and GetCurrencyFormat from Kernel32. Here is a screenshot showing a sample output:

 


And the usage:

Code: QB64: [Select]
  1. PRINT Currency("123456789")
  2. PRINT FormatDate("MM*dd*yyyy")
  3. PRINT GetDateType(DATE_LONGDATE)

The above code for Currency spits out a formatted monetary value based on the current user's preferences.The number used in my example should return formatted with the local currency you use.
« Last Edit: October 09, 2020, 08:52:52 PM by SpriggsySpriggs »

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #51 on: October 10, 2020, 12:25:33 PM »
Updated 12:20 PM on 10/10/2020

Fixed a bug with the UuidCreate timestamp functions. The function only looked for months either greater than or less than 10 (October). Now it is fixed for months INCLUDING October.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #52 on: October 14, 2020, 12:58:50 AM »
Soon to be adding advanced WinAPI usage demonstrating creating trainers in QB64. I hope to also create an actual tutorial for start to finish with making the trainer. It will take a lot of personal time and right now I'm trying to find a job. When I find time throughout the day here and there I will attempt to make progress on that.

Offline bplus

  • Forum Resident
  • Posts: 5525
  • B+ Knot again!
Re: Spriggsy's API Collection
« Reply #53 on: October 14, 2020, 12:51:17 PM »
What's a "trainer"? Some difference from a tutorial? (besides spelling)

BTW I believe what you do productively in your spare time is great sign what kind of job you should be pursuing.

If you can train people who are free to come and go and aren't invested only for a letter grade, then I think that also an awesome sign.

Maybe you can use this on your resume? Best wishes...
« Last Edit: October 14, 2020, 12:57:33 PM by bplus »

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #54 on: October 14, 2020, 12:54:19 PM »
What's a "trainer"? Some difference from a tutorial? (besides spelling)
@bplus A trainer is a program that modifies the memory of a game to allow for things like adjusting your health, ammo, etc. I will be making a tutorial to show how to make your own trainers, though.

Offline bplus

  • Forum Resident
  • Posts: 5525
  • B+ Knot again!
Re: Spriggsy's API Collection
« Reply #55 on: October 14, 2020, 01:01:42 PM »
@SpriggsySpriggs

Man you have such a different background of terminology and experience from mine. I am glad you haunt this place, if I could only understand what you say better :)

For me if I wanted to improve my weapons and my vitality in a game I'd just hack the data files my stuff is being stored in.

I think in my day it was called cheating but Trump would say, no, just taking advantage of opportunity presented. :)
« Last Edit: October 14, 2020, 01:05:21 PM by bplus »

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #56 on: October 14, 2020, 02:50:39 PM »
@bplus It's positivity like yours that keeps me coming back to the forum with more projects.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #57 on: October 16, 2020, 11:41:43 PM »
Updated 10/16/2020 at 11:39 PM

Added OpenProcess, ReadProcessMemory, and WriteProcessMemory from Kernel32 WinAPI under filename "PeepingTom.bas". This library allows you to do modern PEEK-ing and POKE-ing in modern QB64.

Dedicated thread here: https://www.qb64.org/forum/index.php?topic=3134.0

Updated 10/17/2020
Fixed peekstring function so it doesn't just call peekbyte repeatedly and grabs the whole string in one go.
« Last Edit: October 17, 2020, 11:24:21 AM by SpriggsySpriggs »

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #58 on: October 17, 2020, 10:59:19 PM »
Updated 10/17/2020

Replaced some functions in the UUID code for better HTTPS functionality. More lines of code, but no more file creation to read back responses. Faster work on the API calls.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 554
  • If you're API and you know it clap your hands
    • My GitHub
Re: Spriggsy's API Collection
« Reply #59 on: October 18, 2020, 01:23:47 AM »
Updated 01:18 AM on 10/18/2020

Using GetTempPath and GetTempFilename with Gravatar and OMDB APIs as well as using Wininet WinAPI functions to handle internet connectivity for downloading images and responses so as to show more WinAPI usage rather than just using urlmon. I find this makes for a more reliable way than simply just writing the response to a file and reading the contents. This new method stores the response in a string buffer that can be read immediately. For images, I do get a temp file name using GetTempPath and GetTempFileName so the files aren't being written to the directory the executable is launched from. More steps and far more complex but it is definitely worth it in the long run as it is more instructive for WinAPI usage and for showing how an HTTP request is structured.

Updated 02:12 AM on 10/18/2020

Fixed code for getting images in the OMDB and Gravatar API for the string buffer concerning number of bytes to write to the output file. Also, updated the Robohash API to match the same schema of image downloading as OMDB and Gravatar.
« Last Edit: October 18, 2020, 02:13:47 AM by SpriggsySpriggs »