Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Windows API


  • Please log in to reply
20 replies to this topic
BrandonHotkey
  • Members
  • 691 posts
  • Last active: Oct 21 2015 09:41 PM
  • Joined: 21 May 2012
Are here some programmers who knows about Windows api more then me? Where can I find some information some manual or examples how to use input/output operations between programs.
In linux bash and cmd there are operators to redirect input/output (<,>,|) and I am interested how does solve Windows API this problem. I would like to write some command in ahk to dllcommand. My need is to pass input data (image) into program. So is here anybody who can help me or to refer me on some good page?

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
See MSDN Windows API Reference.

In AutoHotkey all works trough DllCall.

For AutoHotkey_H you can use WinApi wrapper so you do not need to care about parameter types.

BrandonHotkey
  • Members
  • 691 posts
  • Last active: Oct 21 2015 09:41 PM
  • Joined: 21 May 2012
Thanks

I watched the MSDN manual, but cannot to find the answer for redirecting input/output to application (how to call application and to pass the data to it).

I use Autohotkey L, what is the difference from Autohotkey H?

I checked the thread for Autohotkey R but I still miss some basic tutorial for start to work with it or with dllCall.

What I would like to do is to change one line in ScreenCapture.ahk to pass image to ImageMagick (convert.exe) to process it before save. See <!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?f=1&t=87063#p540435">viewtopic.php?f=1&t=87063#p540435</a><!-- l -->

BTW: You have broken link there in this post:
<!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?t=55442#p540390">viewtopic.php?t=55442#p540390</a><!-- l -->

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
See AutoHotkey_H.
It is the same as AHK_L + all listed features, additionally it is available as dll (for multi-threading and use in other programs).

convert.exe requires a file, how do you want to pass data to it?

Is that the link I fixed?

BrandonHotkey
  • Members
  • 691 posts
  • Last active: Oct 21 2015 09:41 PM
  • Joined: 21 May 2012
So it is not possible to pass the image to convert.exe?
What would be needed to do it?
I would try to use a clipboard as channel, but I am not sure it this will not affect performance.

Is that the link I fixed?

Yes, that is the link that doesn't work

fragman
  • Members
  • 1591 posts
  • Last active: Nov 12 2012 08:51 PM
  • Joined: 13 Oct 2009
The fastest method would be to use conversion functions from a Dll. Those can be accessed through DllCall by AHK. You can pass a HBITMAP to a function that accepts and processes it.

BrandonHotkey
  • Members
  • 691 posts
  • Last active: Oct 21 2015 09:41 PM
  • Joined: 21 May 2012

The fastest method would be to use conversion functions from a Dll. Those can be accessed through DllCall by AHK. You can pass a HBITMAP to a function that accepts and processes it.


Do you mean GDI+ dll or dll from ImageMagick?

I think it could be very complicated, because ImageMagick is really not simple. It is simple to write some command, but I think it would not be simple to call the inner functions separately. Also I am not expert on IM source, so cannot imaging to manage to do that.

Frankie
  • Members
  • 2930 posts
  • Last active: Feb 05 2015 02:49 PM
  • Joined: 02 Nov 2008
What does your convert command look like?
aboutscriptappsscripts
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run

fragman
  • Members
  • 1591 posts
  • Last active: Nov 12 2012 08:51 PM
  • Joined: 13 Oct 2009
I did not mean anything specific, I was just talking about the best approach in terms of performance. If you are really limited by the conversion speed (make sure to test this, don't just assume it!), then you might want to do it completely in memory without using drives. In the WinAPI this is usually done with HBITMAPs. There are many GDI+ functions that deal with HBITMAPs, you can check out the gdip library for an overview. You can also use third-party code or write your own in C++.

BrandonHotkey
  • Members
  • 691 posts
  • Last active: Oct 21 2015 09:41 PM
  • Joined: 21 May 2012
Yeah, but this is for experts and i am not expert to understand it. It is too hard for me do do it. I do not understand to these programming things concerning graphics.

fragman
  • Members
  • 1591 posts
  • Last active: Nov 12 2012 08:51 PM
  • Joined: 13 Oct 2009
Then it's probably best when you save it to a file and use your convert.exe. How many images do you need to process per second? Why is it performance-critical?

BrandonHotkey
  • Members
  • 691 posts
  • Last active: Oct 21 2015 09:41 PM
  • Joined: 21 May 2012
It is hard to say at this moment. I was thinking about creating a program, but did not created it yet so cannot say how fast it should be. As what I see from what I have done (just few little programs), the AHK is not so fast as one could think, because I must to wait every time when I copy content to clipboard and check it and if it fails, then wait again. And when I insert from clipboard I have to wait too. So cannot say how many images. Reliability is more important but the images would be many many many. So sure man wants best speed as possible. Using clipboard is slow, so I think it could be really better to save to file.

fragman
  • Members
  • 1591 posts
  • Last active: Nov 12 2012 08:51 PM
  • Joined: 13 Oct 2009
In the end you will have to test it.

BrandonHotkey
  • Members
  • 691 posts
  • Last active: Oct 21 2015 09:41 PM
  • Joined: 21 May 2012
I am interested if is there function (probably in GDI+) based on detection of group of pixels.
Input condition for detection should be color of the pixels and amount of pixels in a group.
For example, if you can look on the blue bar Quick Reply. If it would be color #A67A11, the function should look for this color, and to find all pixels, that are adjacent/neighbouring. The minimum number of pixels in a group would be 8000. So the function would filter all pixels, which are not in the bar. And now would be a decision if the result should keep the original color, even with the text "Quick Reply" or to change whole bar to white, and rest of image would be black. Are there some functions or tutorials how to do something similar?

I know it is possible to save the image from screen and to change it later by ImageMagick, but IM has not this function, that is could detect amount of pixels in a group of pixels. So if there would be some solution in GDI+ or elsewhere, I would use it.

cheochi
  • Members
  • 8 posts
  • Last active: Jun 21 2012 08:42 PM
  • Joined: 21 Jun 2012
Nice info.but i don't no how its work..