Click here to Skip to main content
15,881,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to make your own winapi function?
To be more specific, I would like to make a function like GetPixel with identical parameters (_In_ HDC hdc,_In_ int nXPos, _In_ int nYPos). What information should I also know to make my own function, is it a secret of windows or something else?
Thanx for any help :)
Posted
Updated 10-Mar-14 23:23pm
v2

1 solution

Of course you can make an API.
The code for GetPixel-like function would probably end up in a call to the actual GetPixel, that is often an API leverages an existing one.
The secrets for implementing an API are: make the code robust, write good documentation (there are technical details of course, like, for instance, creating a DLL or a static library).
 
Share this answer
 
Comments
novadivlja 11-Mar-14 5:02am    
Maybe i didn't enough clear -> when you call "GetPixel" you don't know what is happen behind the code are not visible! Now what i want is to make my custom function which will do same work as "GetPixel", but don't know what data structure to call. What would you do if you are on linux (where you don't have GepPixel function), how would you find there information of pixel?
CPallini 11-Mar-14 5:13am    
GDI implementation details is not available, as far as I know. However you may have a glimpse of reading this:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff566540(v=vs.85).aspx

On Linux I would use an existing API (while aiming at portable code I wouldn't try to write a Windows-like API, instead, I would try to implement a OS agnostic API).
novadivlja 11-Mar-14 5:25am    
thnx for comment and link that will be my start point :)
CPallini 11-Mar-14 5:47am    
You are welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900