Jump to content

API's

- - - - -

  • Please log in to reply
7 replies to this topic

#1
Tonchi

Tonchi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 471 posts
  • Location:Varaždin
  • Programming Language:C, C++, C#
here is the code


class Api

    {

        public const uint WS_EX_STATICEDGE = 0x00020000;

        public const uint WS_CHILD = 0x40000000;

        public const uint WS_VISIBLE = 0x10000000;

        public const uint WS_HSCROLL = 0x00100000;

        public const uint WS_VSCROLL = 0x00200000;


        public const int GWL_WNDPROC = -4;


        public const int WM_ACTIVATEAPP = 0x1C;

        public const int WM_COMMAND = 0x111;

        public const int WM_CLOSE = 0x10;

        public const int WM_DESTROY = 2;

        public const int WM_DROPFILES = 0x233;

        public const int WM_ERASEBKGND = 0x14;

        public const int WM_KEYDOWN = 256;

        public const int WM_LBUTTONDBLCLK = 515;

        public const int WM_LBUTTONDOWN = 513;

        public const int WM_LBUTTONUP = 514;

        public const int WM_MOVE = 0x3;

        public const int WM_MOUSEMOVE = 512;

        public const int WM_MOVING = 0x216;

        public const int WM_NCHITTEST = 0x0084;

        public const int WM_NCLBUTTONDOWN = 161;

        public const int WM_NCLBUTTONDBLCLK = 163;

        public const int WM_PAINT = 0xF;

        public const int WM_RBUTTONDOWN = 516;

        public const int WM_TIMER = 0x113;

        public const int WM_PRINT = 0x317;

        public const int WM_PRINTCLIENT = 0x318;

        public const int WM_SETREDRAW = 0xB;

        public const int WM_SIZING = 0x214;

        public const int WM_SIZE = 0x5;

        public const int WM_USER = 0x400;

        public const int WM_STRINGDATA = WM_USER + 3;


        public const int VK_HOME = 36;

        public const int VK_END = 35;

        public const int VK_PRIOR = 33;

        public const int VK_NEXT = 34;

        public const int VK_LEFT = 37;

        public const int VK_UP = 38;

        public const int VK_RIGHT = 39;

        public const int VK_DOWN = 40;


of course it's just a part of class API
what i want to know is what those numbers means...i know it's constants but why 35 or 38 or 0x214

#2
fayyazlodhi

fayyazlodhi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 403 posts
The only possible relation that could have been there would be some thing like for e.g. VK_LEFT would be left arrow key with an ascii value of 37 or something.

However, I don't think there is any relationship here. Generally we start naming constants with the intention of grouping similar ones together.

Yet another scenario could be when such macros are written while parsing traffic through internet based upon IETF RFC's. In that scenario, RFC tells you that a 34 on 10th byte means it is procotol x and so on.

May be it is adhering to some windows internal convention but i am inclined to doubt it.

Edit: Decimal or hex both values ultimately translate into binary so they have absolutely no significance unless you have a reason to remember one of them.

#3
Tonchi

Tonchi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 471 posts
  • Location:Varaždin
  • Programming Language:C, C++, C#
that API is for movie player...for windows media player buttons like play, stop, etc.
i'm trying to remake that player so i have to understand that API...will it be a problem to send you all API to yor PM so you can try to explain it to me...

#4
fayyazlodhi

fayyazlodhi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 403 posts
No please send it

#5
Tonchi

Tonchi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 471 posts
  • Location:Varaždin
  • Programming Language:C, C++, C#
it's too big for PM i will send you on email

#6
fayyazlodhi

fayyazlodhi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 403 posts
I went through the API and googled. It appears Windows API has some default values when we create a simple for e.g. form

Those defaults are already picked up when we create an object of say form class. It is part of windows style abstract class
pinvoke.net: Window styles (Constants)

If you notice the above link shows the class which is provided as abstract which means you can inherit it in your code and have to provide definitions of functions with the signatures mentioned in the class. You cannot instantiate the class directly.

Why? Simply because windows has already added a meaning in it's GDI (graphics interface) and others for each of these constant values and used those macros.
The care they take is to use separate bit for each value so if you have a variable containing flags, you could check it's individual bits to see if that particular one is on or off

e.g.
public const uint WS_MINIMIZE = 0x20000000; // this tells window is currently minimized
public const uint WS_VISIBLE = 0x10000000; // If this bit is true, it means window is currently visible

So you should simply use this API and the macro's without modifying them.

#7
Tonchi

Tonchi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 471 posts
  • Location:Varaždin
  • Programming Language:C, C++, C#
how can i change the picture of a play or stop button???
i've try on classic way but API don't allow me

#8
fayyazlodhi

fayyazlodhi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 403 posts
You mean doing this in may be constructor doesn't work? What's the error or output?


      this.startButton = new System.Windows.Forms.Button();

        this.SuspendLayout();


        this.startButton.Image = new Bitmap("newimage.jpg");






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users