DO NOT DEAL WITH THIS MEMBER
Would it be possible in VB.NET to draw text on another window?
I googled and found this example:
https://www.daniweb.com/programming/soft...ons-window
But it actually draws everywhere, any window, desktop,etc. I just want something drawn to a particular window. Maybe check if the process is running, then do stuff.
I'm assuming it will need some API or dll imports?
DO NOT DEAL WITH THIS MEMBER
(Sep 22, 2015 10:24 AM)Vrekt Wrote: Would it be possible in VB.NET to draw text on another window?
I googled and found this example:
https://www.daniweb.com/programming/soft...ons-window
But it actually draws everywhere, any window, desktop,etc. I just want something drawn to a particular window. Maybe check if the process is running, then do stuff.
I'm assuming it will need some API or dll imports?
lol, do not use 0 as the handle. you will need to get the handle of the control that you want to draw on.
DO NOT DEAL WITH THIS MEMBER
I had to do this for a project I was working on quite a while ago now. I remember figuring it out was very easy if you just browsed a little around on pinvoke.
Here's a snippet of code I wrote a while back to track the Skype "authenticate access" button for API requests. You can modify it to your liking.
It uses bad practices with putting it in an infinite loop, perhaps you should look at overlay forms instead if you plan on selling your product.
DO NOT DEAL WITH THIS MEMBER
(Sep 22, 2015 10:44 AM)nathan72389 Wrote: lol, do not use 0 as the handle. you will need to get the handle of the control that you want to draw on.
How would I go about finding the 'handle' for my application?
DO NOT DEAL WITH THIS MEMBER
you can use the main window handle. it is inside the process class.
if you need to get more specific then you will have to enumerate through the controls to find the correct one that you are looking for and just use that one.
DO NOT DEAL WITH THIS MEMBER
(Sep 22, 2015 11:43 AM)nathan72389 Wrote: you can use the main window handle. it is inside the process class.
if you need to get more specific then you will have to enumerate through the controls to find the correct one that you are looking for and just use that one.
Ah I see thanks for the help.
DO NOT DEAL WITH THIS MEMBER
here is a really simple example where i draw my name on the calculator
DO NOT DEAL WITH THIS MEMBER
Sep 22, 2015 12:21 PM
(This post was last modified: Sep 22, 2015 12:28 PM by Vrekt.)
Nice example thanks, but now one question remains. When I draw the text it has a white background always, and it doesn't look to good on other things, any work around for this?
My code:
PHP Code
<?php For Each p As Process In Process.GetProcesses
If p.ProcessName = "javaw" And p.MainWindowTitle = "Minecraft 1.8.7" Then Dim gr As Graphics = Graphics.FromHwnd(p.MainWindowHandle) gr.DrawString("TestApplication", New Font("Corbel", 12), Brushes.Black, New Point(0, 0))
End If
Next
(Sep 22, 2015 12:21 PM)Vrekt Wrote: Nice example thanks, but now one question remains. When I draw the text it has a white background always, and it doesn't look to good on other things, any work around for this?
Post your code, so it will be easier to pinpoint exact problem as nathan has already given you answer... ;)
BTC - bc1q3efew3yzfwhdz290dafykaw0a2w56g2j69g2c6
ETH - 0xf1c873217032468990D3313da6509D1b813c4671
USDT - 0xf1c873217032468990D3313da6509D1b813c4671
PP - [email protected]
|