Page 8 of 18

Re: GDI+ standard library 1.45 by tic

Posted: 16 Nov 2016, 20:05
by guest3456
just me wrote:

Code: Select all

If Var Is %Integer%
  • v1:
    variable reference: Integer -> "Integer"
  • v2:
    double variable reference: Integer -> "Integer" -> "Integer"
hrmm

then is a double deref even necessary?

Code: Select all

IsInteger(Var) {
   Static Integer := "Integer"
   If Var Is Integer
      Return True
   Return False
}
that seems to work

v1: normal if is command
v2: single var deref in if-expression

Re: GDI+ standard library 1.45 by tic

Posted: 17 Nov 2016, 03:27
by just me

Code: Select all

IsInteger(Var) {
   Static Integer := "Integer"
   If Var Is Integer
      Return True
   Return False
}
Yes, I already did it this way, but I didn't remember.

Re: GDI+ standard library 1.45 by tic

Posted: 17 Nov 2016, 11:58
by guest3456
can anyone get Gdip.Tutorial.11 working on AHK 1.1?

it works fine for me using AHK Basic 1.0

looks like this is the relevant section in Gdip.ahk thats failing. maybe something with these DllCalls? Gdip_All fails too

Code: Select all

Gdip_BitmapFromBRA(ByRef BRAFromMemIn, File, Alternate=0)
{
	if !BRAFromMemIn
		return -1
	Loop, Parse, BRAFromMemIn, `n
	{
		if (A_Index = 1)
		{
			StringSplit, Header, A_LoopField, |
			if (Header0 != 4 || Header2 != "BRA!")
				return -2
		}
		else if (A_Index = 2)
		{
			StringSplit, Info, A_LoopField, |
			if (Info0 != 3)
				return -3
		}
		else
			break
	}
	if !Alternate
		StringReplace, File, File, \, \\, All
	RegExMatch(BRAFromMemIn, "mi`n)^" (Alternate ? File "\|.+?\|(\d+)\|(\d+)" : "\d+\|" File "\|(\d+)\|(\d+)") "$", FileInfo)
	if !FileInfo
		return -4
;msgbox, %FileInfo2%`n%info2%`n%fileinfo1%                      ;// this shows the same in 1.1 and 1.0
	hData := DllCall("GlobalAlloc", "uint", 2, "uint", FileInfo2)
	pData := DllCall("GlobalLock", "uint", hData)
	DllCall("RtlMoveMemory", "uint", pData, "uint", &BRAFromMemIn+Info2+FileInfo1, "uint", FileInfo2)
	DllCall("GlobalUnlock", "uint", hData)
	DllCall("ole32\CreateStreamOnHGlobal", "uint", hData, "int", 1, "uint*", pStream)
	DllCall("gdiplus\GdipCreateBitmapFromStream", "uint", pStream, "uint*", pBitmap)
	DllCall(NumGet(NumGet(1*pStream)+8), "uint", pStream)
	return pBitmap
}

the msgbox works so i think it must be something on the lines below it

looks like its an ANSI/Unicode thing. it works on AHK 1.1 ANSI

Re: GDI+ standard library 1.45 by tic

Posted: 17 Nov 2016, 13:02
by Helgef
guest3456 wrote:I have updated Gdip_All.ahk to support AHK v2
These kinds of user efforts are really important if there is going to be a shift to v2 :thumbup:

Re: GDI+ standard library 1.45 by tic

Posted: 17 Nov 2016, 13:08
by guest3456
Helgef wrote:
guest3456 wrote:I have updated Gdip_All.ahk to support AHK v2
These kinds of user efforts are really important if there is going to be a shift to v2 :thumbup:
yep i think we need to get v2 to beta asap. HotKeyIt says hes been using it for years.

but, i'm trying to run the Gdip.Tutorial examples and while they are working somewhat on v2, i can't seem to exit the example scripts :crazy:

Re: GDI+ standard library 1.45 by tic

Posted: 17 Nov 2016, 22:57
by guest3456
I have updated Gdip_All.ahk again to v1.49. Its now backwards compatible with both AHK v1.1 and AHK v2

I've included all of the Gdip tutorial examples (except one) so you can test and they now work for both AHK versions.

See the changes and get it here:

https://github.com/mmikeww/AHKv2-Gdip

Re: GDI+ standard library 1.45 by tic

Posted: 20 Nov 2016, 11:54
by guest3456
backwards compatible Gdip_All.ahk updated again to v1.50

'just me' has fixed the Gdip_BitmapFromBRA() func as well as example Tutorial.11

https://github.com/mmikeww/AHKv2-Gdip

Re: GDI+ standard library 1.45 by tic

Posted: 22 Dec 2016, 02:40
by ahk_learning
Hi,

Im trying to use GDIP library to capture Nox App Player's window but the result are not expected, it have a blank window instead of the content like image below:
Image

the code:

Code: Select all

SetBatchLines -1

#include Gdip.ahk

token := Gdip_Startup()
scrshot:=A_Desktop . "\ScrShot\" . A_Now . ".png"
WinGet, nox,, Nox App Player
;~ bitmap:=Gdip_BitmapFromScreen("hwnd:" . nox)
bitmap:=Gdip_BitmapFromHWND(nox)
Gdip_SaveBitmapToFile(bitmap, scrshot, 100)
GDIP_DisposeImage(bitmap)
GDIP_Shutdown(token)

return
Any suggestion are appreciate.

Thanks

Re: GDI+ standard library 1.45 by tic

Posted: 22 Dec 2016, 10:15
by guest3456
some apps/games just won't let you capture their contents

Re: GDI+ standard library 1.45 by tic

Posted: 23 Dec 2016, 12:27
by guest_only today
Can you take a standard screenshot,if yes you can try use gdip command using the raster parameter.

Re: GDI+ standard library 1.45 by tic

Posted: 26 Dec 2016, 05:22
by ahk_learning
guest_only today wrote:Can you take a standard screenshot,if yes you can try use gdip command using the raster parameter.
Yep, it runs ok with standard screenshot or full screen. I also try the raster param but no luck :headwall:

Re: GDI+ standard library 1.45 by tic

Posted: 27 Dec 2016, 08:19
by guest_on_tuesday
Do not know if it helps you but if i need a similar screengrab as the standard one i iuse:

Code: Select all

raster:=0x40000000 + 0x00CC0020
pBitmap:=Gdip_BitmapFromScreen(Screen,raster)
Best of luck :)

Re: GDI+ standard library 1.45 by tic

Posted: 27 Dec 2016, 09:26
by guest3456
^ should that use bitwise or | instead of add + ?

Re: GDI+ standard library 1.45 by tic

Posted: 28 Dec 2016, 03:33
by guest__today
Yes it should be "|" but here the result is the same :)

Re: GDI+ standard library 1.45 by tic

Posted: 28 Dec 2016, 08:54
by Acecool
ahk_learning wrote:Hi,

Im trying to use GDIP library to capture Nox App Player's window but the result are not expected, it have a blank window instead of the content like image below:
Image

the code:

Code: Select all

SetBatchLines -1

#include Gdip.ahk

token := Gdip_Startup()
scrshot:=A_Desktop . "\ScrShot\" . A_Now . ".png"
WinGet, nox,, Nox App Player
;~ bitmap:=Gdip_BitmapFromScreen("hwnd:" . nox)
bitmap:=Gdip_BitmapFromHWND(nox)
Gdip_SaveBitmapToFile(bitmap, scrshot, 100)
GDIP_DisposeImage(bitmap)
GDIP_Shutdown(token)

return
Any suggestion are appreciate.

Thanks

I have an example Capture Screenshot of Active Window included in my AHK Framework ( uses and includes GDip also includes GDip_All ) and I haven't had any issues with it even though I have had issues with PrintScreen and various utilities... Give it a go and if it works, all of the code is mostly captured in the processes\ screenshot file ( plus 1 or 2 functions in functions\ and I have started using libraries so string.safe in classes\ )... But you will likely not need to go that far: https://bitbucket.org/Acecool/acecoolah ... k/overview

If you want to install it, drop it into Dropbox\AcecoolAHK_Framework and run _assets\_setup\setup.bat in admin mode and confirm the folder paths ( if wrong you'll need to edit the bat; I will release a new setup bat file where it is more user-friendly or as AHK because AHK needs to be installed prior to installing this ) and press enter which will generate a replacement Documents\AutoHotkey.ahk file ( which launches DropBox\AcecoolAHK_Framework\framework_launcher.ahk )[ note: if one exists it'll be backed up ] and it will symbolically link AHK_INSTALL_PATH\Lib to AcecoolAHK_Framework\libraries\ ( it will rename the original if it exists )... Then run AutoHotkey.exe and for the first launch you won't get a notification to rebuild the inclusion list ( for if you drag and drag new files in; if you simply edit existing files then you can Reload This Script from tray and it won't pop up any nags. For second launch and further it will ask you if you want to skip recreating the inclusion list or not; in most cases select Yes ( default ) which runs the framework and no will rebuild the inclusion list...

Alt + F12 is the hotkey..

I decided to download Nox App Player to give it a shot to save you some time and because it looks interesting... I'll give it a shot and post the result...
Image
Image

Re: GDI+ standard library 1.45 by tic

Posted: 28 Dec 2016, 09:57
by guest3456
Acecool wrote: I have an example Capture Screenshot of Active Window included in my AHK Framework

all of the code is mostly captured in the processes\ screenshot file ( plus 1 or 2 functions in functions\ )
uh, i think some code is missing:

https://bitbucket.org/Acecool/acecoolah ... ew-default

Re: GDI+ standard library 1.45 by tic

Posted: 28 Dec 2016, 11:18
by Acecool
That is one of the functions for it.. It is here:

https://bitbucket.org/Acecool/acecoolah ... ew-default

And what it uses:

HotKey: https://bitbucket.org/Acecool/acecoolah ... lt_f12.ahk

Libraries / Classes:
For string.safe: https://bitbucket.org/Acecool/acecoolah ... string.ahk
For reading and saving settings to config.ini: https://bitbucket.org/Acecool/acecoolah ... ration.ahk

Functions:
https://bitbucket.org/Acecool/acecoolah ... enshot.ahk
https://bitbucket.org/Acecool/acecoolah ... otName.ahk
https://bitbucket.org/Acecool/acecoolah ... rayTip.ahk


Most of this can be ignored - the important file is the processes\ file


And I just noticed something! I seem to have altered my screenshot system away from Gdip ( likely because of a similar issue ) to using NirCMD - run "_assets\bin\NirCmd_x64\nircmd.exe" savescreenshotwin %_path%%_name%

but I didn't remove some of the Gdip calls in Screenshot function likely because I was debugging or something.... My bad.. I'll look into GDip again, but I would also say take a look at NirCMD because it can handle a lot of different and useful tasks ( I also use it for my audio switcher / cycler script ) much quicker than AHK can on its own and without using hacky workarounds ( ie with AHK, from what I've gathered, to change audio device it has to open the menu, and use mouse / keyboard actions to do and can take seconds whereas with NirCMD the same task is done in microseconds and doesn't need to open any new windows which can cause other issues )..

I apologize - I have been reorganizing and cleaning things up ( and functions that aren't used in more than one spot go into their primary script so Screenshot and all will go back into the processes\ file ) but I'll see about adding a GDip example that hopefully also works...

Re: GDI+ standard library 1.45 by tic

Posted: 28 Dec 2016, 11:45
by guest3456
^ right, so you're not even using GDIP, so this is all pointless and in the wrong thread

Re: GDI+ standard library 1.45 by tic

Posted: 28 Dec 2016, 11:59
by Acecool
As I mentioned I forgot that I switched over but I'll do some digging.. It is difficult to keep track of things when you can only process a 40 hour "work week" load / tasks every 160 to 240 + days.

Re: GDI+ standard library 1.45 by tic

Posted: 25 Jan 2017, 15:27
by buliasz
In case someone needs it, I've modified Gdip_All.ahk of mmikeww (guest3456) which work with AHK 2.0+ also. I made one bugfix and made additional little changes, so that it can now be used with the "#Warn All" flag enabled.
Surely there are more changes needed for "#Warn All", but they appear only when you use a particular function. The ones I used are working now.
You can get it here.