* *

Coding

Welcome, Guest. Please login or register.
Did you miss your activation email?
November 18, 2017, 12:42:56 PM

Login with username, password and session length

Menu

Members
Stats
  • Total Posts: 12175
  • Total Topics: 1736
  • Online Today: 52
  • Online Ever: 195
  • (February 11, 2014, 01:46:08 PM)
Users Online
Users: 0
Guests: 33
Total: 38
Baidu (5)

Author Topic: LoadLibrary & GetProcAddress call in IBasic Pro  (Read 2249 times)

0 Members and 1 Guest are viewing this topic.

Offline TLaRoche

  • Newbie
  • *
  • Posts: 9
  • Bananas: 0
  • Gender: Male
  • Born to code ... doomed to fail...
LoadLibrary & GetProcAddress call in IBasic Pro
« on: September 28, 2014, 04:45:35 AM »
Okay, if I can't declare a function in IBasic Pro using an ordinal value instead of the the function name (as is the case with some of the Windows API .... then how about using LoadLibrary and GetProcAddress. Is there a way in IBasic Pro to call an API function via the address retrieved from calling LoadLibrary and then calling GetProcAddress (ie. dynamically calling an API function)?

Hope I worded everything right.

As always, thank you in advance for any and all help,
T
Just finished backing up to the ol' tape backup drive ... again. Maybe this time restore will work...

Offline Larry McCaughn

  • Head Monkey
  • Administrator
  • Sr. Member
  • *****
  • Posts: 259
  • Bananas: 4
  • Gender: Male
Re: LoadLibrary & GetProcAddress call in IBasic Pro
« Reply #1 on: October 02, 2014, 07:13:51 PM »
... ordinal value instead of the the function name (as is the case with some of the Windows API ....
can you give me an example of a windows api that uses an ordinal number instead of a function number...I've never come across one?
Admin - Here and @ Ionic Wind Software Forums
Author of Custom Button Designer, Custom Chart Designer, Snippet Manager, and IWB+ (A Visual Designer for IWBasic 2.x/3.x)

Offline TLaRoche

  • Newbie
  • *
  • Posts: 9
  • Bananas: 0
  • Gender: Male
  • Born to code ... doomed to fail...
Re: LoadLibrary & GetProcAddress call in IBasic Pro
« Reply #2 on: October 12, 2014, 06:44:33 PM »
Thank you for your response,  and sorry for my late response in return; I've been stuck with work for a while now. Okay, so here is an API call that uses an ordinal value in order to function on a Win 9x/Me system:

(VB Syntax)
Declare Sub Exitwindowsdialog Lib "Shell32.dll" Alias "#60" (ByVal hwndOwner As Long)

And my question again: Is there a way to either declare this function in IBasic Pro or by a call to the function dynamically by using LoadLibrary and GetProcAddress that I have missed?

And again, thanks for any help with this issue.
Just finished backing up to the ol' tape backup drive ... again. Maybe this time restore will work...

Offline Larry McCaughn

  • Head Monkey
  • Administrator
  • Sr. Member
  • *****
  • Posts: 259
  • Bananas: 4
  • Gender: Male
Re: LoadLibrary & GetProcAddress call in IBasic Pro
« Reply #3 on: October 12, 2014, 08:01:29 PM »
I'm running win 7 and couldn't make it work.

Looking up that command and found this:
Platforms
◾Windows 95: Supported.
◾Windows 98: Supported.
◾Windows NT: Requires Windows NT 3.1 or later.
◾Windows 2000: Supported.
◾Windows CE: Unknown.
The ExitWindowsDialog function is officially undocumented.


and it appears to have been last update in 2000.
Admin - Here and @ Ionic Wind Software Forums
Author of Custom Button Designer, Custom Chart Designer, Snippet Manager, and IWB+ (A Visual Designer for IWBasic 2.x/3.x)

Offline TLaRoche

  • Newbie
  • *
  • Posts: 9
  • Bananas: 0
  • Gender: Male
  • Born to code ... doomed to fail...
Re: LoadLibrary & GetProcAddress call in IBasic Pro
« Reply #4 on: October 13, 2014, 04:46:13 AM »
Hi Larry,
Okay, but like I said the VB declaration I listed is correct for Win 9x/Me. This getting slightly off my point.

The main thing is ... can I use LoadLibrary and GetProcAddress to dynamically call a function, or to declare a function somehow by its ordinal.

Thank you for your responses.
Just finished backing up to the ol' tape backup drive ... again. Maybe this time restore will work...

Offline Larry McCaughn

  • Head Monkey
  • Administrator
  • Sr. Member
  • *****
  • Posts: 259
  • Bananas: 4
  • Gender: Male
Re: LoadLibrary & GetProcAddress call in IBasic Pro
« Reply #5 on: October 13, 2014, 09:07:34 AM »
And my point is that unless you are using one of those old versions of windows the command with the #60 or whatever isn't on your computer to call no matter what.

So, I have no idea of how to call a function that isn't there  and I don't have and old machine to see if it will work with it there.

Sorry
Admin - Here and @ Ionic Wind Software Forums
Author of Custom Button Designer, Custom Chart Designer, Snippet Manager, and IWB+ (A Visual Designer for IWBasic 2.x/3.x)

Offline TLaRoche

  • Newbie
  • *
  • Posts: 9
  • Bananas: 0
  • Gender: Male
  • Born to code ... doomed to fail...
Re: LoadLibrary & GetProcAddress call in IBasic Pro
« Reply #6 on: October 13, 2014, 06:06:30 PM »
Larry,
I thank you again for your help on this. Okay,  so the project requiring the use of ordinals is a no go. So, back to the topic at hand. LOL

Can I use LoadLibrary and GetProcAddress to dynamically call a function? For the following function I can  call LoadLibrary and GetProcAddress and get the expected values, I just don't know what IBasic Pro command / instruction to call the function with the address obtained from GetProcAddress:
Code: [Select]
BOOL DvdLauncher (
     HWND HWnd,
     CHAR DriveLetter
);
This API call requires LoadLibrary, and GetProcAddress to access the function's address, and that is where I am with this project.

Larry, I thank you again for helping me clear up the issue about ordinals and to finally put it to rest.

And thanks in advance for your or anyone else's help with this issue.
Just finished backing up to the ol' tape backup drive ... again. Maybe this time restore will work...

Offline Larry McCaughn

  • Head Monkey
  • Administrator
  • Sr. Member
  • *****
  • Posts: 259
  • Bananas: 4
  • Gender: Male
Re: LoadLibrary & GetProcAddress call in IBasic Pro
« Reply #7 on: October 13, 2014, 07:53:01 PM »
maybe this will help
Code: [Select]
DECLARE IMPORT,LoadLibraryA(lpLibFileName:STRING),INT
DECLARE IMPORT,FreeLibrary(hLibModule:INT),INT
DECLARE IMPORT,GetProcAddress(hModule:INT, lpProcName:STRING),INT
DECLARE IMPORT,CallWindowProcA(lpPrevWndFunc:INT, hwnd:INT, msg:INT, wParam:INT, lParam:INT),INT

DEF Library:INT
DEF ProcAddress,ProcAddress2:INT

Library=LoadLibraryA(getstartpath+"msvcrt.dll")
ProcAddress=GetProcAddress(Library, "_ftol")
ProcAddress2=GetProcAddress(Library, "_ftol2")

If ProcAddress=NULL
messagebox 0,"_ftol entry not found, do not attempt to call this function.","Warning"
else
messagebox 0,"_ftol entry found at address"+str$(ProcAddress)+"."+CHR$(13)+CHR$(13)_
+"It is safe to call this function."+CHR$(13)_
+"Use the following to call this function:"+CHR$(13)+CHR$(13)_
+"CallWindowProc(ProcAddress, winhandle, message, wParam, lParam)"_
,"Info"
endif

If ProcAddress2=NULL
messagebox 0,"_ftol2 entry not found, do not attempt to call this function.","Warning"
else
messagebox 0,"_ftol2 entry found at address"+str$(ProcAddress2)+"."+CHR$(13)+CHR$(13)_
+"It is safe to call this function."+CHR$(13)_
+"Use the following to call this function:"+CHR$(13)+CHR$(13)_
+"CallWindowProc(ProcAddress, winhandle, message, wParam, lParam)"_
,"Info"
endif

FreeLibrary(Library)

End
Admin - Here and @ Ionic Wind Software Forums
Author of Custom Button Designer, Custom Chart Designer, Snippet Manager, and IWB+ (A Visual Designer for IWBasic 2.x/3.x)

 

To link to us use this code/button on your site

http://www.codingmonkeys.com/images/cm_link.gif

ShoutBox!

 

lurkalot

September 20, 2017, 01:57:54 PM
Hey that's my job. Didn't choose this username for nothing you know.  :)
 

Larry McCaughn

September 19, 2017, 12:24:13 AM
lurking in the shadows, lurkalot.
 

lurkalot

September 16, 2017, 04:39:43 PM
Good evening all.  Where is everyone?
 

lurkalot

September 12, 2017, 12:57:36 PM
Good to hear, it's nice to see a empty error log. ;)
 

Blue Steel

September 12, 2017, 05:04:25 AM
running sites log files overnight heres the result (I know mainly spiners) "There are currently no error log entries." :)
 

lurkalot

September 12, 2017, 03:19:33 AM
Morning all.  :)
 

Blue Steel

September 12, 2017, 01:12:33 AM
Let it all out ..
these are the things I can't do without  ;)

MikeHart

September 11, 2017, 11:14:22 PM
SHOUT SHOUT  :)
 

GWS

September 11, 2017, 08:16:02 PM
Shouting is Go !  ;D
 

Blue Steel

September 11, 2017, 06:54:02 PM
gradually getting there
 

lurkalot

September 11, 2017, 05:22:46 PM
Yay, you found it.  ;)
 

Larry McCaughn

September 11, 2017, 01:07:13 PM
looks like you're making good progress
 

Blue Steel

September 07, 2017, 10:34:19 PM
yay recent topics are working again in the center of the home page :)
 

Larry McCaughn

July 12, 2017, 05:46:33 PM
Blue Steel is back running the show.  Maybe he'll be able to build some steam in the ole place!
 

Blue Steel

June 26, 2017, 04:58:41 AM
hope i didn't scare too many of you
 

Blue Steel

June 26, 2017, 04:58:12 AM
Boo, i'm still here alive and well , see my post in introductions

MikeHart

July 25, 2016, 01:43:24 AM
That sounds cool. Have to chekc out IWBasic in the next days.
 

Larry McCaughn

July 22, 2016, 11:47:00 PM
I'm hoping to issue a new maintenance release to the IWBasic 3.x IDE in the next few weeks and Larry Sikes has released an update to the Linux version of IWBasic and is currently working on the 64bit version of IWBasic.  Progress should speed up since he has retired and has apparently resolved his m

MikeHart

July 19, 2016, 02:53:02 PM
Anything interesting going on around BASIC?
 

Larry McCaughn

July 18, 2016, 09:14:12 AM
Hello Mike

MikeHart

July 16, 2016, 04:33:25 PM
Hi there all!
 

pistol350

June 24, 2016, 03:41:10 AM
Hello all!
I'm still around although less active!
 

Blue Steel

September 08, 2013, 09:34:55 AM
first page of games in arcade are fixed. only 12 more pages to go
 

Blue Steel

September 08, 2013, 08:41:09 AM
Cleared all highscores on the games . i've been asked to see if i can fix them all. please PM me if you find a game in the arcade that doesn't work, there are way too many for me to go through each and every game.