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

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Spriggsy's API Collection
« Reply #45 on: October 08, 2020, 10:58:55 am »
Nice collection you have going here!

- Dav

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #46 on: October 08, 2020, 11:07:42 am »
Appreciate it, @Dav !
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #47 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 »
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #48 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:

 
internationalization.png


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 »
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #49 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.
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #50 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.
Shuwatch!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Spriggsy's API Collection
« Reply #51 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: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #52 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.
Shuwatch!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Spriggsy's API Collection
« Reply #53 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: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #54 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.
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #55 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 »
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #56 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.
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #57 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 »
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #58 on: October 26, 2020, 04:00:33 pm »
Updated 03:52 PM on 10/26/2020

Added XInputGetState, XInputSetState, and XInputGetBatteryInformation from XInput1_4 WinAPI DLL. The functions are located in "XInputControllerTest - Merged.bas". The demo is an InForm application. Rather than try to bundle all the files into another folder I've opted to just combine them all into one file. CONST declarations are located at the top of the program.

« Last Edit: October 26, 2020, 04:12:34 pm by SpriggsySpriggs »
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Spriggsy's API Collection
« Reply #59 on: October 26, 2020, 04:14:09 pm »
Updated 4:13 PM on 10/26/2020

Added pipecom from my pipecom library which pipes console output to QB64. It is a cross-platform library that works on Windows, Macintosh, and Linux.

See here for a post with more detail: https://www.qb64.org/forum/index.php?topic=3168.msg124345#msg124345
Shuwatch!