Note-Gfx

Veröffentliche deine funktionierenden Skripte und Funktionen

Moderator: jNizM

daterbcoder
Posts: 1
Joined: 06 Feb 2018, 06:33

Note-Gfx

06 Feb 2018, 06:48

Hallo,
ich habe eine kleines Tool erstellt um Notizen zu erstellen, und Fenster als Bitmap / Bild speichert.
Das Programm besteht aus zwei Programme, das erste um die Notiz zu erstellen, das zweite um das
Bild / Bitmap anzuzeigen.

Das ganzen sollte in einem eigenden Verzeichnis gespeichert werden.
Der zweite Code dient zum anzeigen der Note / Bilder,
bitte unter vgfxnote.exe speichern.

Viel Spass......


PS: Gdip ist da zu Downloaden> https://autohotkey.com/boards/viewtopic.php?f=6&t=6517

Code: Select all

; written be MM - all code is Opensource -- V1 - 06.02.2018
; Gdip standard library v1.45 by tic (Tariq Porter) 
;
; Main Programm - to create a litle Note - this Programm start vgfxnote.exe the view the gfx / Note.
; 

#include gdip.ahk
pToken := Gdip_Startup()
#SingleInstance force
#NoTrayIcon
ListLines, Off
SetControlDelay, -1
SetWinDelay,-1

Hotkey,IfWinActive,onelinenote
hotkey,esc,saveonelinenote
hotkey,!esc,onelinebreak
hotkey,+esc,onelinebreak
hotkey,^esc,onelinebreak
hotkey,f1,c1
hotkey,f2,c2
hotkey,f3,c3
hotkey,f4,c4
hotkey,f5,c5
hotkey,f6,c6
hotkey,f7,c7
hotkey,f8,c8
hotkey,f9,c9
hotkey,f10,c10

;#####################################################################
;Start up ... Search saved Notes and load it... ( Picture)
;#####################################################################

firststart=on
Loop, Files, *.bmp
	{
	ifinstring,A_LoopFileName,picture-
		{
		firststart=
		soundbeep,1000,50
		run,vgfxnote.exe %A_LoopFileName%
		}
	}
if firststart=on
{
msg=
(
------------------------------------------------
      LITLE - NOTE .... by MM 2018
         all Code is opensource.
------------------------------------------------


Hotkeys in the Note Window.
----------------------------------------
> F12  <	- Make a litle Note.
ESC	- Save
F1 - F10 	- Change Color


General Hotkey:
PrintScreen - Make a Screenshot from a Window.
ALT + F11     - Exit
Str   + F11     - This info		


Hotkeys in the Note-Picture Window.
----------------------------------------
LButton 		- Move the Window
Wheelup / Down	- Resize the Window
Shift Wheel	- Zoom
ESC / BS / DEL	- Remove the Note
PrintScreen / p	- Print the Note /   
Rbutton		- View MAX
i / n / t		- Add a litle Note-Text.
c		- Set to the Clipboard.
m  /  r		- View Max and R restore.
)
msgbox,64,INFO,%msg%
}
return
;#####################################################################
;CTRL-F12 Show Info
;#####################################################################
^F11::
msgbox,64,,%msg%
return
;#####################################################################
;ALT-F12 Exit and Close all
;#####################################################################
!F11::
winget, ll,list
loop,%ll%	
	{
	id:= ll%A_Index%
	WinGetTitle,eeee, ahk_id %id%
	ifinstring,eeee,VIEW-Picture-
		{
		soundbeep,400,100
		PostMessage, 0x5555, 11, 22,,%eeee%
		sleep,100
		}
	}
exitapp
;#####################################################################
;F12 new Note...
;#####################################################################
F12::
textn=
col_a1=white
col_a2=black
col_a3=yellow
gui,2:destroy
str=
(
ESC - Save as Note / Bitmap 
        F1 - F10 Color 
Shift / Ctrl + Esc Cancel
      Write your note......
)
reingui:
  
  Gui,2: +LastFound
  gui,2: color,%col_a1%,%col_a2%
  Gui,2: -Border +AlwaysOnTop +ToolWindow ; -SysMenu +Owner -resize  +OwnDialogs +AlwaysOnTop
  Gui,2: Margin,0,0
  Gui,2: font,s16,Arial
  gui,2: add,edit,w400 r3 c%col_a3% -Wrap -VScroll -HScroll vonelineedit,%textn%
  gui,2: show,x200 y200,onelinenote
  
  if textn !
  	MsgBox,64,INFO,%str%,3
return
;###################################
onelinebreak:
gui,2:destroy
return
;###################################
c1:
col_a1=white
col_a2=black
col_a3=yellow
ControlGetText,textn,edit1,onelinenote
gui,2:destroy
gosub reingui
return
;###################################
c2:
col_a1=black
col_a2=white
col_a3=black
ControlGetText,textn,edit1,onelinenote
gui,2:destroy
gosub reingui
sendinput,{right}
return
;###################################
c3:
col_a1=Fuchsia
col_a2=Fuchsia
col_a3=black
ControlGetText,textn,edit1,onelinenote
gui,2:destroy
gosub reingui
sendinput,{right}
return
;###################################
c4:
col_a1=Yellow
col_a2=Yellow
col_a3=black
ControlGetText,textn,edit1,onelinenote
gui,2:destroy
gosub reingui
sendinput,{right}
return
;###################################
c5:
col_a1=Yellow
col_a2=Blue
col_a3=white
ControlGetText,textn,edit1,onelinenote
gui,2:destroy
gosub reingui
sendinput,{right}
return
;###################################
c6:
col_a1=Lime  
col_a2=Lime  
col_a3=white
ControlGetText,textn,edit1,onelinenote
gui,2:destroy
gosub reingui
sendinput,{right}
return
;###################################
c7:
col_a1=Lime  
col_a2=Lime  
col_a3=black
ControlGetText,textn,edit1,onelinenote
gui,2:destroy
gosub reingui
sendinput,{right}
return
;###################################
c8:
col_a1=Red  
col_a2=Red
col_a3=black
ControlGetText,textn,edit1,onelinenote
gui,2:destroy
gosub reingui
sendinput,{right}
return
;###################################
c9:
col_a1=Red  
col_a2=Red
col_a3=white
ControlGetText,textn,edit1,onelinenote
gui,2:destroy
gosub reingui
sendinput,{right}
return
;###################################
c10:
col_a1=Red  
col_a2=Yellow
col_a3=black
ControlGetText,textn,edit1,onelinenote
gui,2:destroy
gosub reingui
sendinput,{right}
return
;#####################################################################
saveonelinenote:
	send,{left}
	send,{left}
	sleep,800
	send,!{PrintScreen}
	sleep,400
	editpr=
	pBitmap:=Gdip_CreateBitmapFromClipboard()
	Gdip_GetDimensions(pBitmap, Width, Height)
	if Width=0
		{
		soundbeep,300,100
		gui,2:destroy
		return
		}
	file=picture-%A_Now%.bmp
	Gdip_SaveBitmapToFile(pBitmap,file, Quality=75)
	Gdip_DisposeImage(pBitmap)
	Run, vgfxnote.exe %file%
	gui,2:destroy
	return
;#####################################################################
;Save a Window to bitmap....
;#####################################################################
PrintScreen::
	send,!{PrintScreen}
	sleep,400
	pBitmap:=Gdip_CreateBitmapFromClipboard()
	Gdip_GetDimensions(pBitmap, Width, Height)
	
	pBitmap2 := Gdip_CreateBitmap(Width+12, Height+12)	
	G := Gdip_GraphicsFromImage(pBitmap2)

	pbrush1:=Gdip_BrushCreateSolid(0xff000000)
	pPen:=Gdip_CreatePen(0xffFFD800,8)
	Gdip_FillRectangle(g,pbrush1,0,0,Width+12,height+12)
	
	Gdip_DeletePen(pPen)
	Gdip_DeleteBrush(pBrush1)

	pbrush1:=Gdip_BrushCreateSolid(0xfffffffff)
	pPen:=Gdip_CreatePen(0xffFFD800,4)
	Gdip_FillRectangle(g,pbrush1,4,4,Width+4,height+4)
	
	Gdip_DrawImage(g,pBitmap,6,6,Width,height)
	
	Gdip_DisposeImage(pBitmap)
	Gdip_DeletePen(pPen)
	Gdip_DeleteBrush(pBrush1)
	Gdip_DeleteGraphics(pGraphics)
	

	file=picture-%A_Now%.bmp
	Gdip_SaveBitmapToFile(pBitmap2,file, Quality=75)
	Gdip_DisposeImage(pBitmap2)
	Run, vgfxnote.exe %file%
return


Und der teil um die Note / bilder anzuzeigen.

Code: Select all

; written be MM - all code is Opensource -- V1 - 06.02.2018
; Gdip standard library v1.45 by tic (Tariq Porter) 

Process, Priority,,Normal
#NoTrayIcon
ListLines, Off
#SingleInstance off
#WinActivateForce
SetWinDelay,-1
SetControlDelay, -1
#include gdip.ahk
pToken := Gdip_Startup()
Width2:=400
height2:=300
maxonoff=
timer:=0
savepos:=0
savepos_old:=1
xl:=0
yl:=0
beep=
file=%1%
;file=mm3.bmp
file_save=%file%
xpa:=0
xpn:=0
dxx:=0
wn:=1
wt=VIEW-Picture-%file%

Random, wait,50,150
Hotkey,IfWinActive,%wt%
hotkey,WheelUp,up
hotkey,+WheelUp,up2
hotkey,WheelDown,dn
hotkey,+WheelDown,dn2
hotkey,+lbutton,mb
hotkey,ESC,exit
hotkey,BS,exit
hotkey,DEL,exit
hotkey,PrintScreen,ps
hotkey,P,ps
hotkey,rbutton,max
hotkey,m,max2
hotkey,r,max2res
hotkey,e,edit
hotkey,i,addtext
hotkey,n,addtext
hotkey,t,addtext
hotkey,c,setclip


;###################################################################################
;###################################################################################


			config=winpos-%wt%.ini
			Iniread,_wx,%config%,WINPOS,XX,0
			Iniread,_wy,%config%,WINPOS,YY,0
			Iniread,_ww,%config%,WINPOS,WW,0
			Iniread,_wh,%config%,WINPOS,HH,0
reload:
			ifexist,%file%
				pBitmap:=Gdip_CreateBitmapFromFile(File)
			else
				exitapp
			
			SetTimer, savepos,500,-1000 

			Gdip_GetDimensions(pBitmap, Width, Height)
			
			if Width=0
				{
				Gdip_DisposeImage(pBitmap)
				SoundBeep,400,400
				exitapp
				}
				
			ccf:=Width/Height
			

			if _ww 
				{
				Width2:=_ww
				height2:=_wh
				}
			else
				{
				Width2:=Width
				height2:=Height
				}
			
			
			gui,1: +Border -Caption +ToolWindow -SysMenu -resize 
			Gui,1: margin,0,0
			Gui,1: Add, Picture,x0 y0 0xE vMyPicture
			hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)	
			GuiControlGet, hwnd, hwnd, MyPicture
			SetImage(hwnd, hBitmap)
			Gui, 1: Show, AutoSize,%wt%
			
			org_width:=width
			org_height:=height

			;Bugger(_wx . " - " . _wy . " - " . _ww . " - " . _wh . " - " . Width2 . " - " . height2 . " - " . xl . " - " . yl . " - " . width . " - " . height)
			
			if _ww
				{
				Setmage(_wx,_wy,_ww,_wh,0,0,Width2,height2,xl,yl,width,height)
				}			


			OnMessage(0x201,"WM_LBUTTONDOWN")
			OnMessage(0x5555, "MsgMonitor")
			OnMessage(0x5556, "MsgMonitor")
			
			WinGetPos,wX,wY,,, WinTitle,%wt%
						
return
;###################################################################################
;###################################################################################
ps:
	soundbeep,1433,50			
	ifexist,%file%
		run, print %file%
	soundbeep,1433,50
	return
;###################################################################################
;###################################################################################
edit:
	run, edit %file_save%
return
;###################################################################################
;###################################################################################
setclip:
	soundbeep,1000,50
	Gdip_SetBitmapToClipboard(pBitmap)
	soundbeep,1000,50
	return

;###################################################################################
;###################################################################################
addtext:
InputBox, tt, Enter a Note, Enter a litle Note.					
	if tt !
		return		


	pBitmap1 := Gdip_CreateBitmapFromFile(file_save)
	Gdip_GetImageDimensions(pBitmap1, origW, origH)					; Get width and height of original image
	pBitmap2 := Gdip_CreateBitmap(origW, origH+50)						; Create a new bitmap
	G := Gdip_GraphicsFromImage(pBitmap2)								; Get a pointer to the graphics of the bitmap
	Gdip_DrawImage(G, pBitmap1, 0,50, origW,origH)				; Draw the original image onto the new bitmap
	Gdip_DisposeImage(pBitmap1)


	WT_Wincopyonoff=off
	Gdip_DeletePen(pPen)
	Gdip_DeleteBrush(pBrush1)
	SelectObject(hdc, obm)
	DeleteObject(hbm)
	DeleteDC(hdc)
	Gdip_DeleteGraphics(pGraphics)
	Gdip_DisposeImage(pBitmap)
	
	filedelete,%file_save%

	Font = Arial
	Gdip_FontFamilyCreate(Font)
	Options = x0p y0p w%Width%p Left cbbffd800 r4 s30
	Gdip_TextToGraphics(G, tt, Options, Font, Width, 40)


	st:=Gdip_SaveBitmapToFile(pBitmap2,file_save,75)				; Save the new bitmap to file
	Gdip_DisposeImage(pBitma2)										; Delete the new bitmap
	Gdip_DeleteGraphics(G)
	gui,1:destroy
	file:=file_save
	
	config=winpos-%wt%.ini
	Iniread,_wx,%config%,WINPOS,XX,0
	Iniread,_wy,%config%,WINPOS,YY,0
	Iniread,_ww,%config%,WINPOS,WW,0
	Iniread,_wh,%config%,WINPOS,HH,0
	
	_wh:=_wh+50

	gosub reload

return
;###################################################################################
;###################################################################################
max:
	SetTimer, savepos,off
	WinGetPos,xpp,ypp,wpp,hpp,%wt%
	Width2_old:=Width2
	height2_old:=height2
	winsmaxmin("min")
	WinActivate,%wt%
	loop,300
		{
		Width2:=Width2*1.05
		height2:=height2*1.05
		
		if (Width2>(A_ScreenWidth*0.8))
			break	
		if (height2>(A_ScreenHeight*0.8))
			break

		}
		Width2:=round(Width2)
		height2:=round(height2)
		gosub up	
		CenterWindow(wt)
		Loop
			{
    			GetKeyState, state,RButton, P
    			if state = U  
       				break
			}

	Width2:=Width2_old
	height2:=height2_old
	Setmage(xpp,ypp,wpp,hpp,0,0,Width2,height2,xl,yl,width,height)
	SetTimer, savepos,500,-1000
	Width2_old:=
	winsmaxmin("")
return

;###################################################################################
;###################################################################################
max2:
	if maxonoff=on
		{
		gosub max2res
		return
		}
	maxonoff=on
	winsmaxmin("min")
	WinGetPos,xpp,ypp,wpp,hpp,%wt%
	Width2_old:=Width2
	height2_old:=height2
	
	loop,300
		{
		Width2:=Width2*1.05
		height2:=height2*1.05
		
		if (Width2>(A_ScreenWidth*0.8))
			break	
		if (height2>(A_ScreenHeight*0.8))
			break

		}
		Width2:=round(Width2)
		height2:=round(height2)
		gosub up	
		CenterWindow(wt)
		WinSet,top,,%wt%
		WinActivate,%wt%
return
;###################################################################################
max2res:
	if maxonoff=on
		{
		winsmaxmin("")
		maxonoff=
		}
	if Width2_old
		{
		Width2:=Width2_old
		height2:=height2_old
		width:=org_width
		height:=org_height
		xl:=0
		yl:=0
		Setmage(xpp,ypp,wpp,hpp,0,0,Width2,height2,xl,yl,width,height)
		Width2_old:=
		
		}
	WinSet,top,,%wt%
	return
;###################################################################################

CenterWindow(WinTitle)
{
    WinGetPos,,, Width, Height, %WinTitle%
    WinMove, %WinTitle%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2)
}
;###################################################################################
;###################################################################################
mb:
			MouseGetPos, xpn, ypn 
			xpa:=xpn
			ypa:=ypn		
			Process, Priority,,Realtime
			Critical
			SetBatchLines, -1
			Loop
			{
    				GetKeyState, state,LButton, P
    				if state = U  
       					break
			MouseGetPos, xpn, ypn 			
			if (xpn<xpa)
				{	
				xl:=xl+(xpa-xpn)
				ViewImage(0,0,Width2,height2,xl,yl,width,height)
				}
			if (xpn>xpa)
				{
				xl:=xl-(xpn-xpa)		
				ViewImage(0,0,Width2,height2,xl,yl,width,height)
				}
			if (ypn<ypa)
				{	
				yl:=yl+(ypa-ypn)
				ViewImage(0,0,Width2,height2,xl,yl,width,height)
				}
			if (ypn>ypa)
				{
				yl:=yl-(ypn-ypa)		
				ViewImage(0,0,Width2,height2,xl,yl,width,height)
				}

			xpa:=xpn
			ypa:=ypn			
			}
Process, Priority,,normal
return
;###################################################################################
;###################################################################################
up2:
	Critical
	SetBatchLines, -1
	Width:=Width+30
	height:=Width/ccf		
	ViewImage(0,0,Width2,height2,xl,yl,width,height)
	return
;###################################################################################
;###################################################################################

dn2:
	Critical
	SetBatchLines, -1
	Width:=Width-20
	height:=Width/ccf		
	ViewImage(0,0,Width2,height2,xl,yl,width,height)
	return

;###################################################################################
;###################################################################################
up:
	Critical
	SetBatchLines, -1
	Width2:=Width2+20
	height2:=Width2/ccf	
	WinMove, %wt%,,wx,wy,Width2,height2	
	ViewImage(0,0,Width2,height2,xl,yl,width,height)
	return
;###################################################################################
;###################################################################################
dn:
	Critical
	SetBatchLines, -1
	Width2:=Width2-30
	height2:=Width2/ccf	
	WinMove, %wt%,,wx,wy,Width2,height2
	ViewImage(0,0,Width2,height2,xl,yl,width,height)
	return	
;###################################################################################
;###################################################################################
exit2:
	Gdip_DisposeImage(pBitmap)
                   
exitapp		
;###################################################################################
;###################################################################################
exit:
	if file_save=mm3.bmp
		{
		Gdip_DisposeImage(pBitmap)
		exitapp	
		}


	MsgBox, 4, , Do you want to close this ? (Press YES or NO)
	IfMsgBox No
		return
	WT_Wincopyonoff=off
	Gdip_DisposeImage(pBitmap)
                  	
	

	cc=%A_WorkingDir%\backup-picture\
	ifnotexist,%cc%
		FileCreateDir,%cc%		

	winname=winpos-%wt%.ini
	filedelete,%winname%
	cc=%A_WorkingDir%\backup-picture\%file_save%
	filecopy,%file_save%,%cc%
	filedelete,%file_save%
	exitapp
return

;###################################################################################
;###################################################################################
savepos:
		if maxonoff=on
			return
		;Bugger(timer)
		timer++
		if (timer=wait)
			{
			WinSet,top,,%wt%
			loop,90
				{
				tr:=160+a_index
				sleep,1
				WinSet, Transparent,%tr%,%wt%
				}
			sleep,300
			loop,90
				{
				tr:=250-a_index
				sleep,1
				WinSet, Transparent,%tr%,%wt%
				}
			timer:=0
			}
		
	
		MouseGetPos,,, win
		WinGetTitle,title, ahk_id %win%
		if title=%wt%
			{
			WinActivate,%wt%
			WinSet, Transparent,off,%wt%
			wttrans=
			wina=ok
			return
			}
		else
			{
			if wttrans !
				{
				if wina=ok
					{
					WinActivate,%title%
					wina=
					}
				if Width2_old
					return
				wttrans=on
				WinSet, Transparent, 160,%wt%
				}
			}


		winname=winpos-%wt%.ini
		WinGetPos,x,y,w,h,%wt%
		savepos:=x+y+w+h
		if (savepos<>savepos_old)
			{
			IniWrite,%x%,%winname%,WINPOS,XX
			IniWrite,%y%,%winname%,WINPOS,YY
			IniWrite,%w%,%winname%,WINPOS,WW
			IniWrite,%h%,%winname%,WINPOS,HH
			savepos_old:=x+y+w+h
			}
			

return
;IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
; Window MouseMove
;IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII

  WM_LBUTTONDOWN()
	{
	global wt	
	if (A_Gui)
		{
		Gui, +LastFound
		PostMessage, 0xA1, 2 ; WM_NCLBUTTONDOWN
		Loop
			{
    			GetKeyState, state,LButton, P
    			if state = U  
       				break
			}
		winname=winpos-%wt%.ini
		loadsavewinpos("save",wt,winname)
			
		}
	
	
	}

return
;###################################################################################
;###################################################################################
loadsavewinpos(st,win,file)
{
	if st=save
		{
		WinGetPos,x,y,w,h,%win%
		IniWrite,%x%,%file%,WINPOS,XX
		IniWrite,%y%,%file%,WINPOS,YY
		IniWrite,%w%,%file%,WINPOS,WW
		IniWrite,%h%,%file%,WINPOS,HH
		}
	if st=load
		{
		Iniread,x,%file%,WINPOS,XX,0
		Iniread,y,%file%,WINPOS,YY,0
		Iniread,w,%file%,WINPOS,WW,0
		Iniread,h,%file%,WINPOS,HH,0
		if w=0
			return
		else
			WinMove,%win%,,x,y,w,h
		}	
}
;###################################################################################
;###################################################################################
MsgMonitor(wParam, lParam, msg)
{
    exitapp
}
;###################################################################################
;###################################################################################

;result := Bugger("Hallo")
;---------------------------------------------------------------------------------------------------------------------------------------
bugger(ByRef StringToSend)  ; ByRef saves a little memory in this case.
; This function sends the specified string to the specified window and returns the reply.
; The reply is 1 if the target window processed the message, or 0 if it ignored it.
{
Critical
SetBatchLines, -1
    TargetScriptTitle:="Bugger.exe"
    VarSetCapacity(CopyDataStruct, 3*A_PtrSize, 0)  ; Set up the structure's memory area.
    ; First set the structure's cbData member to the size of the string, including its zero terminator:
    SizeInBytes := (StrLen(StringToSend) + 1) * (A_IsUnicode ? 2 : 1)
    NumPut(SizeInBytes, CopyDataStruct, A_PtrSize)  ; OS requires that this be done.
    NumPut(&StringToSend, CopyDataStruct, 2*A_PtrSize)  ; Set lpData to point to the string itself.
    Prev_DetectHiddenWindows := A_DetectHiddenWindows
    Prev_TitleMatchMode := A_TitleMatchMode
    DetectHiddenWindows On
    SetTitleMatchMode 2
    SendMessage, 0x4a, 0, &CopyDataStruct,, bugger.exe  ; 0x4a is WM_COPYDATA. Must use Send not Post.
    DetectHiddenWindows %Prev_DetectHiddenWindows%  ; Restore original setting for the caller.
    SetTitleMatchMode %Prev_TitleMatchMode%         ; Same.
    return ErrorLevel  ; Return SendMessage's reply back to our caller.
}

;___________________
;___________________
;___________________


/*
bugger.ahk .exe Source -> debugger...
#NoTrayIcon
ListLines, Off
SetControlDelay, -1
SetWinDelay,-1

str=
(
F1 - CLR Screen

Bugger("Sting zum debuggen senden.")
;---------------------------------------------------------------------------------------------------------------------------------------
bugger(ByRef StringToSend)  ; ByRef saves a little memory in this case.
; This function sends the specified string to the specified window and returns the reply.
; The reply is 1 if the target window processed the message, or 0 if it ignored it.
; From AHK DOC (c) AHK
{
Critical
SetBatchLines, -1
    TargetScriptTitle:="Bugger.exe"
    VarSetCapacity(CopyDataStruct, 3*A_PtrSize, 0)  ; Set up the structure's memory area.
    ; First set the structure's cbData member to the size of the string, including its zero terminator:
    SizeInBytes := (StrLen(StringToSend) + 1) * (A_IsUnicode ? 2 : 1)
    NumPut(SizeInBytes, CopyDataStruct, A_PtrSize)  ; OS requires that this be done.
    NumPut(&StringToSend, CopyDataStruct, 2*A_PtrSize)  ; Set lpData to point to the string itself.
    Prev_DetectHiddenWindows := A_DetectHiddenWindows
    Prev_TitleMatchMode := A_TitleMatchMode
    DetectHiddenWindows On
    SetTitleMatchMode 2
    SendMessage, 0x4a, 0, &CopyDataStruct,, bugger.exe  ; 0x4a is WM_COPYDATA. Must use Send not Post.
    DetectHiddenWindows `%Prev_DetectHiddenWindows`%  ; Restore original setting for the caller.
    SetTitleMatchMode `%Prev_TitleMatchMode`%         ; Same.
    return ErrorLevel  ; Return SendMessage's reply back to our caller.
}
)



  Gui,7: +LastFound
  Gui,7: +Border +AlwaysOnTop +ToolWindow ; -SysMenu +Owner -resize  +OwnDialogs +AlwaysOnTop
  Gui,7: Margin,0,0
  Gui,7: font,s12,Arial
  gui,7: add,edit,w400 r20,%str%
  gui,7:show,,bugger.exe
  OnMessage(0x4a, "Receive_WM_COPYDATA")  ; 0x4a is WM_COPYDATA
 return


7guiclose:
exitapp

f1::ControlSetText,Edit1,,bugger.exe 


Receive_WM_COPYDATA(wParam, lParam)
{
Critical
SetBatchLines, -1
ControlGetText, text,Edit1,bugger.exe	
    StringAddress := NumGet(lParam + 2*A_PtrSize)  ; Retrieves the CopyDataStruct's lpData member.
    CopyOfData := StrGet(StringAddress)  ; Copy the string out of the structure.
    text=`r`n%CopyOfData%%text%
    ControlSetText,Edit1,%text%,bugger.exe  
    return true 
}

*/
;___________________
;___________________
;___________________


;###################################################################################
;###################################################################################
ViewImage(x1,y1,w1,h1,x2,y2,w2,h2)
{
global pBitmap
global MyPicture
global wt,hwnd
		
		Critical
		SetBatchLines, -1

		WinGetPos,,, WW,HH, %wt%
		pBitmap2 := Gdip_CreateBitmap(WW,HH)
		G := Gdip_GraphicsFromImage(pBitmap2)
		Gdip_DrawImage(g, pBitmap,x1,y1,w1,h1,x2,y2,w2,h2)
		hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap2)
		SetImage(hwnd,hBitmap)
		Gdip_DisposeImage(pBitmap2)
		DeleteObject(hBitmap)
		Gdip_DeleteGraphics(G)

			
return
}
Setmage(wx,wy,ww,wh,x1,y1,w1,h1,x2,y2,w2,h2)
{
global pBitmap
global MyPicture
global wt,hwnd,Width2,height2
		
		Critical
		SetBatchLines, -1
		Width2:=ww
		Height2:=wh	
		WinMove, %wt%,,wx,wy,Width2,height2
		pBitmap2 := Gdip_CreateBitmap(ww,wh)
		G := Gdip_GraphicsFromImage(pBitmap2)
		Gdip_DrawImage(g, pBitmap,x1,y1,w1,h1,x2,y2,w2,h2)
		hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap2)
		SetImage(hwnd,hBitmap)
		Gdip_DisposeImage(pBitmap2)
		DeleteObject(hBitmap)
		Gdip_DeleteGraphics(G)
		
return
}

winsmaxmin(st)
{
 WinGet, id, List
  Loop, %id%
	{
	this_id := id%A_Index%
	WinGetTitle,this_title, ahk_id %this_id%

	ifinstring,this_title,VIEW-picture
		continue

	if this_title in mywins,Start
		continue
	
	if this_title in mywins,viewwt
		continue

	if this_title in mywins,WTCLPVIEW
		continue

	if this_title in mywins,SmalListWindow
		continue

	if this_title in mywins,msgnote
		continue	
		
	if this_title=Program Manager
		this_title=Desktop

	if this_title !
		continue		
	
	if st=min
		WinMinimize,%this_title%
	else
		WinRestore,%this_title%	
	}
}
Last edited by daterbcoder on 07 Feb 2018, 07:31, edited 1 time in total.
BoBo
Posts: 2515
Joined: 13 May 2014, 17:15

Re: Note-Gfx

07 Feb 2018, 04:15

Danke fürs teilen :thumbup:
Kleine anmerkung. Bitte füge deinen scripts den download-link zur Gdip.ahk hinzu (oder fast noch besser, füge diese als anhang diesem thread hinzu) .
Diese function library ist nicht zwingend einfach aufzufinden (mehrere versionen, verwaiste archivseiten etc pp). Nochmals danke 8-)

Return to “Skripte und Funktionen”

Who is online

Users browsing this forum: No registered users and 2 guests