11 Replies - 959 Views - Last Post: 12 May 2013 - 10:12 AM Rate Topic: -----

#1 hazard74  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 02-December 09

[Question] Learning API

Posted 09 May 2013 - 08:37 AM

Hello,

As the topic above, I want to now how to use API Declaration parameter? so i can make own source code based on API declaration parameter.

Example:

Declare Function GetWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wCmd As Long) As Long


So can someone tell he how to use this code?

Thanks. :)

Is This A Good Question/Topic? 0
  • +

Replies To: [Question] Learning API

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5595
  • View blog
  • Posts: 11,970
  • Joined: 02-June 10

Re: [Question] Learning API

Posted 09 May 2013 - 01:14 PM

Who's API? For what program? This question is pretty much gibberish. Maybe just "lost in translation".

Your choice is to do this in VB6? You're deliberately building new products in a language that's been dead for a decade? Should this be moved to VB.NET?

Please read: This is not the VB.NET forum
Please read: Is learning VB6 now a complete waste of time?
Was This Post Helpful? 0
  • +
  • -

#3 hazard74  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 02-December 09

Re: [Question] Learning API

Posted 09 May 2013 - 11:27 PM

I'm trying to build an application,

and some features of this application is: 1. Can get computer info, 2. can control I/O.

and to make this happen I must using the API right? and of course API that been using in VB6.

Right now I can still understand a basic about API, need more time to understand it well enough so I can construct my own code, if you can help me to understand well that will be grate :) .

Yeah, I know vb6 old but I only have vb6 source code for my project :) .
Was This Post Helpful? 0
  • +
  • -

#4 hazard74  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 02-December 09

Re: [Question] Learning API

Posted 10 May 2013 - 02:24 AM

"of course API that been using in VB6." --> What I mean is Windows API. :)


p/s: I cant edit previous post :wacko:
Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5595
  • View blog
  • Posts: 11,970
  • Joined: 02-June 10

Re: [Question] Learning API

Posted 10 May 2013 - 06:52 AM

I can't translate enough of what you're trying to say to be helpful.
I can't be of much help in something as old as VB6.
There are other experts here that do know VB6. Hopefully someone else will jump in.
Best of luck on your project.
Was This Post Helpful? 0
  • +
  • -

#6 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 301
  • View blog
  • Posts: 1,783
  • Joined: 26-March 09

Re: [Question] Learning API

Posted 10 May 2013 - 07:28 AM

I have to agree, I'm a bit confused as to exactly what you're asking.

If you want to use API's then here is a site that might be useful
Was This Post Helpful? 2
  • +
  • -

#7 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3642
  • View blog
  • Posts: 12,620
  • Joined: 12-December 12

Re: [Question] Learning API

Posted 10 May 2013 - 07:30 AM

The best I could find on the internet is this:
http://support.microsoft.com/kb/113475

which includes a step by step example.

I understand the definitive guide is "Programming Windows Fifth Edition" by Charles Petzold - published in 1998 :)
Was This Post Helpful? 1
  • +
  • -

#8 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: [Question] Learning API

Posted 10 May 2013 - 06:06 PM

Petzold's book is a great one-if you're writing in C! As it says here, "Knowledge of C is required." Dan Appleman's Visual Basic Programmer's Guide to the Win32 API is regularly cited as the definitive book on the subject for VB programmers.

By all means get Appleman's book. That aside, if you want to learn the API, start with a few simple things. The simplest is probably the Sleep function. From there, look into the GetWindowsDirectory function; that will teach you about string manipulation. Then, try adding a horizontal scrollbar (google LB_SETHORIZONTALEXTENT) to a listbox. That will teach you how to grab windows from the screen and manipulate them using SendMessage. (SendMessage is probably the most often-used function.)

To answer the question in your first post, GetWindow allows you to get the handle to a window that's related in one of several ways (you specify what the relationship is--that's the second argument) to the window whose handle you provide as the first argument. Once you have the handle, you can do stuff to it, typically by using SendMessage. So, you probably don't want to start here.

This post has been edited by BobRodes: 10 May 2013 - 06:11 PM

Was This Post Helpful? 1
  • +
  • -

#9 hazard74  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 02-December 09

Re: [Question] Learning API

Posted 10 May 2013 - 06:33 PM

@tlhIn`toq
Thank you :)

@maj3091
Yeap, that website has a good tutorial for a beginner in API like me and it HELPED!! the software also was good :). Thanks.

@andrewsw
Thanks, this website I think is suitable for me to understand more about the API because it was step by step. Thanks man :)

@BobRodes
That book I was looking for on internet, I think my friend has it but it's ebook, and thanks for the guide to learn more about API. Yeap, I was learning to understand how to using the parameter. Thanks man :)
Was This Post Helpful? 0
  • +
  • -

#10 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: [Question] Learning API

Posted 11 May 2013 - 07:07 AM

That's a great site, maj. Thanks for sharing it. The Windows API is still very relevant in the .Net world (see Managed Windows API, for example), so knowing it is valuable down the line.

This post has been edited by BobRodes: 11 May 2013 - 07:21 AM

Was This Post Helpful? 0
  • +
  • -

#11 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3642
  • View blog
  • Posts: 12,620
  • Joined: 12-December 12

Re: [Question] Learning API

Posted 11 May 2013 - 09:38 AM

View PostBobRodes, on 11 May 2013 - 01:06 AM, said:

Petzold's book is a great one-if you're writing in C! As it says here, "Knowledge of C is required." Dan Appleman's Visual Basic Programmer's Guide to the Win32 API is regularly cited as the definitive book on the subject for VB programmers.

Thank you @Bob. Yes, I meant that book, but at the last moment wrote down the other one :whistling: (don't know why..).

I used to have some VB books that introduced this subject quite well, can't remember which ones now though. I still have the ApiViewer 2004 on my computer, and the declarations text file - which I think was pre-installed with VB6(?).

This post has been edited by andrewsw: 11 May 2013 - 09:45 AM

Was This Post Helpful? 0
  • +
  • -

#12 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: [Question] Learning API

Posted 12 May 2013 - 10:12 AM

Yeah, the API text viewer uses the declarations text file and has been a standard tool at least since VB4.

This post has been edited by BobRodes: 12 May 2013 - 10:17 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1