* *

Coding

User

Welcome, Guest. Please login or register.
May 25, 2013, 09:39:13 AM

Login with username, password and session length

Menu

Stats

Members
  • Total Members: 491
  • Latest: TOPMO3
Stats
  • Total Posts: 12063
  • Total Topics: 1688
  • Online Today: 88
  • Online Ever: 150
  • (September 26, 2012, 02:29:19 PM)
Users Online
Users: 1
Guests: 39
Spiders: 2
Total: 42
Larry McCaughn
Google
Baidu

Recent Topics

Author Topic: How to use win32APIs in IWB  (Read 1056 times)

0 Members and 1 Guest are viewing this topic.

Offline vmars316

  • Newbie
  • *
  • Posts: 11
  • Bananas: 0
  • I haven't set any personal text yet
How to use win32APIs in IWB
« on: July 30, 2012, 08:52:52 PM »
Greetings,
Below is a simple console hotBasic program to GetLocalTime via winAPI.
I am wondering how would I write the same pgm under IWBasic ?
Also, I have another pgm where I need to SetClipboardViewer , as in:
DECLARE FUNCTION SetClipboardViewer LIB "USER32" _
       (hWndNewViewerVm AS LONG) AS LONG
DECLARE FUNCTION ChangeClipboardChain LIB "USER32" _
       (hWndNewViewerVm AS LONG, hWndNextViewerVm AS LONG) AS LONG
DECLARE FUNCTION SendMessageA LIB "USER32" _
       (hwnd AS LONG, wMsg AS LONG, wParam AS LONG, lParam AS LONG) AS LONG

In general, i need to know,
"How to use win32APIs in IWB+".

I have been reading the IWB Help files.
Your IWB DOCs are really great!
Thanks...Vernon

$APPTYPE CONSOLE
Deflng ReturnFromGetLocalTime
Defstr d$
'
TYPE DateConstruct
wYear as WORD
wMonth as WORD
wDayOfWeek as WORD
wDay as WORD
wHour as WORD
wMinute as WORD
wSecond as WORD
wMilliseconds as WORD
END TYPE
'
DIM dt as DateConstruct
'
DECLARE FUNCTION GetLocalTime LIB "KERNEL32" _
      (dt AS DateConstruct) AS LONG

ReturnFromGetLocalTime = GetLocalTime(dt)

dd$ = str$(dt.wDay): IF LEN(dd$) = 1 Then dd$ = ("0"+dd$)
mm$ = (str$(dt.wMonth): IF LEN(mm$) = 1 Then mm$ = ("0"+mm$)
d$ = mm$+dd$+str$(dt.wYear))

PRINT(d$)

pause
END
"All things in moderation, except for love and forgiveness."
 www.vmars316.com

Online Larry McCaughn

  • Administrator
  • Full Member
  • *****
  • Posts: 193
  • Bananas: 4
  • Gender: Male
Re: How to use win32APIs in IWB
« Reply #1 on: July 31, 2012, 05:54:53 AM »
The following takes your posted code and puts it in a format that IWB will accept.
Code: [Select]
declare import, GetLocalTime(DateConstruct x)
string d$,dd$,mm$
 
TYPE DateConstruct
 word wYear
 word wMonth
 word wDayOfWeek
 word wDay
 word wHour
 word wMinute
 word wSecond
 word wMilliseconds
END TYPE
DateConstruct dt
GetLocalTime(dt)
dd$ = ltrim$(str$(dt.wDay)): IF LEN(dd$) = 1 Then dd$ = "0"+dd$
mm$ = ltrim$(str$(dt.wMonth)): IF LEN(mm$) = 1 Then mm$ = "0"+mm$
d$ = mm$+dd$+ltrim$(str$(dt.wYear))
PRINT d$
PRINT
PRINT "Press any key to continue"
waitcon
END

However the following shows how to get the same result using the IWB DATE$ function.
Code: [Select]
PRINT DATE$("MMddyyyy")
PRINT
PRINT "Press any key to continue"
waitcon
END

If you are going to continue with questions about IWB I suggest you join the IWB forums and ask your questions there and use the forum search feature.  If you prefer to stay here then use the search feature for IBasic Pro and EBasic which uses the same basic syntax.
 
« Last Edit: July 31, 2012, 05:55:42 AM by Larry McCaughn »
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)

Offline vmars316

  • Newbie
  • *
  • Posts: 11
  • Bananas: 0
  • I haven't set any personal text yet
Re: How to use win32APIs in IWB
« Reply #2 on: July 31, 2012, 01:01:29 PM »
Thanks:
When I try to compile the above code, I get the following error:
* Compiling...
GetLocalTime.iwb
nasm: fatal: unable to open input file `C:\Users\Public\Documents\IWBasic\projects\GetLocalTime.a'
Error(s) in assembling C:\Users\Public\Documents\IWBasic\projects\GetLocalTime.a

1) Pls, why is it looking for "GetLocalTime.a"?
2) <<to continue with questions about IWB I suggest you join the IWB forums>>
Sure glad to: However, if you mean Forum:
 http://www.ionicwind.com/forums/index.php?board=20.0  Is this the Forum that you mean ?
I have been trying for weeks, to get Registered on that Forum, to no avail.  Can you enable me to Register Successfully  When I Register it comes back with
"Thank you for registering. The admin must approve your registration before you may begin to use your account, you will receive an email shortly advising you of the admins decision."

But I never get the Admin Approval.  Can you fix this ?

Thanks...Vernon
"All things in moderation, except for love and forgiveness."
 www.vmars316.com

Online Larry McCaughn

  • Administrator
  • Full Member
  • *****
  • Posts: 193
  • Bananas: 4
  • Gender: Male
Re: How to use win32APIs in IWB
« Reply #3 on: July 31, 2012, 01:19:24 PM »
What are you trying to compile it with? what version?
what OS?
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)

Offline vmars316

  • Newbie
  • *
  • Posts: 11
  • Bananas: 0
  • I haven't set any personal text yet
Re: How to use win32APIs in IWB
« Reply #4 on: July 31, 2012, 01:51:29 PM »
Larry,
Just to be clear, could you please give me the URL for both. If you mean here:
 " http://www.ionicwind.com/forums/index.php?board=20.0 ", did you miss the part about me trying for weeks to get registered/access to that Forum. And begging for your help ?

Anyways, I have the downloadTrial version:
iwbasic development environment 2.09
compiler version: 2.095

Thanks...Vernon
"All things in moderation, except for love and forgiveness."
 www.vmars316.com

Online Larry McCaughn

  • Administrator
  • Full Member
  • *****
  • Posts: 193
  • Bananas: 4
  • Gender: Male
Re: How to use win32APIs in IWB
« Reply #5 on: July 31, 2012, 02:11:06 PM »
post the iwb file you are trying to compile so I can try it.
 
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)

Online Larry McCaughn

  • Administrator
  • Full Member
  • *****
  • Posts: 193
  • Bananas: 4
  • Gender: Male
Re: How to use win32APIs in IWB
« Reply #6 on: July 31, 2012, 02:19:42 PM »
did you miss the part about me trying for weeks to get registered/access to that Forum. And begging for your help ?
No I didn't miss it.  Like I said multiple times.  Your IP was listed on multiple sites as a spammer so I rejected your registration.
You posted on Aurel site and he emailed me. That same day I sent emails saying you could reregister.
That was nearly 2 weeks ago.
I couldn't control when you chose to re-register.
And it wasn't our fault that you showed up on those list.
If we didn't screen registrations against those list then the forums would be full of porn and every other kind of spam.
I just saw where you validated your re-registration on the IW forum.
So, now you have access to both forums.
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)

 

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

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