Home > Software engineering >  VB to handle problems
VB to handle problems

Time:09-20

Get a child control or child window handle, how to use the SendMessage function to achieve internal coordinates by handle to click on this form

CodePudding user response:

I use gdi achieved DPI resolution and pixel, to calculate the print of the picture size (cm), but to take image resolution (PPI), I see in the EXIF have this information, don't know how to take, consult everybody greatly

CodePudding user response:

It is recommended to use clswindow, reference:
http://blog.csdn.net/sysdzw/article/details/9083313
http://download.csdn.net/detail/sysdzw/9295969

Below is a simple demo, handle to get the current notepad and set as the active window, and then click the window inside the coordinates of 40, 40, namely file menu
 Dim w As New clsWindow 
W.G etWindowByClassNameEx (" Notepad "). The Focus
W.C lickPoint w. eft + 40, w.T op + 40

CodePudding user response:

webmaster terrible!

CodePudding user response:

http://www.autohotkey.com

CodePudding user response:

reference 4 floor zhao4zhong1 response:
http://www.autohotkey.com
you push ahk for many years, also didn't see you send a code, estimates that often stroll BBS directly to ignore your reply,

CodePudding user response:

reference 5 floor sysdzw reply:
Quote: refer to 4th floor zhao4zhong1 response:

http://www.autohotkey.com
you push ahk for many years, also didn't see you send a code, estimates that often stroll BBS directly to ignore your reply,

 Loop {
Sleep, 500

If WinExist (" netease - Microsoft Internet Explorer ")
The or WinExist (" netease - Windows Internet Explorer ")
The or WinExist (" AD ")
The or WinExist (" Microsoft Internet Explorer, "" not finished loading data, please try again later!" )
{
WinActivate
WinCLose
}

If WinExist (" error ")
Or WinExist (" Microsoft Office Word, "" this action will require a copy a variety of styles, whether to switch to" text "style?" )
Or WinExist (" Microsoft Office Word, "" record the clipboard style sheet will be asked to copy a variety of styles, whether to switch to" text "style?" )
{
WinActivate
The Send! N
}
}

CodePudding user response:

/* CaptureScreen (aRect bCursor, sFileTo, nQuality) 
1) If the optional parameter bCursor is True, captures the cursor too.
2) If the optional parameter sFileTo is 0, set the image to the Clipboard.
If it is omitted or "", saves the to screen. The BMP in the script folder,
Otherwise the to sFileTo which can be BMP/JPG/PNG, GIF, TIF.
3) The optional parameter nQuality is applicable only when sFileTo is JPG. Set it to The desired quality level of The resulting JPG, an integer between 0 and 100.
4) If aRect is 0/1/2/3, captures the - desktop window/active/active client area/active monitor.
5) aRect can be comma delimited sequence of coordinates, e.g., "Left, Top, Right, Bottom" or "Left, Top, Right, Bottom, Width_Zoomed, Height_Zoomed".
In this case, only that portion of the rectangle will be captured. Additionally, In the latter case, zoomed to the new width/height, Width_Zoomed/Height_Zoomed.

Example:
CaptureScreen (0)
CaptureScreen (1)
CaptureScreen (2)
CaptureScreen (3)
CaptureScreen (" 100, 100, 200, 200 ")
CaptureScreen (" 100, 100, 200, 200, 400, 400 "); Zoomed
*/

/* the Convert (sFileFr sFileTo, nQuality)
Convert (" C: \ image. BMP ", "C: \ image JPG")
Convert (" C: \ image. BMP ", "C: \ image JPG", 95)
Convert (0, "C: \ clip. PNG"); Save the bitmap in the clipboard to sFileTo if sFileFr is "" or 0.
*/

; CaptureScreen ()
; Return

CaptureScreen (aRect=0, bCursor=False, sFile="", nQuality=" ")
{
If! ARect
{
SysGet, nL, 76; The virtual screen left & amp; Top
SysGet, nT, 77,
SysGet, nW, 78; Virtual screen width and height
SysGet, nH, 79
}
Else If aRect=1
WinGetPos, nL, nT, nW, nH, A
Else If aRect=2
{
WinGet, hWnd, ID, A
VarSetCapacity (rt, 16, 0)
DllCall (" GetClientRect ", "Uint," hWnd, Uint, & amp; Rt)
DllCall (" ClientToScreen ", "Uint," hWnd, Uint, & amp; Rt)
NL:=NumGet (rt, 0, "int")
NT:=NumGet (rt, 4, "int")
NW:=NumGet (rt, 8)
NH:=NumGet (rt, 12)
}
Else If aRect=3
{
VarSetCapacity (mi, 40, 0)
DllCall (" GetCursorPos ", "int64P", pt)
DllCall (" GetMonitorInfo ", "Uint," DllCall (" MonitorFromPoint ", "int64, pt," Uint ", 2), "Uint NumPut (40 mi) - (4)
NL:=NumGet (mi, 4, "int")
NT:=NumGet (mi, 8, "int")
NW:=NumGet (mi, 12, "int") - nL
NH:=NumGet (mi, 16, "int") - nT
}
The Else
{
StringSplit, rt, A_Tab aRect A_Space `, % % % %
NL:=rt1; Into the convert to the Left, top, right, bottom Left, top, width, height
NT:=rt2
NW:=rt3 - rt1
NH:=rt4 - rt2
ZnW:=rt5
ZnH:=rt6
}

MDC:=DllCall (" CreateCompatibleDC ", "Uint, 0)
HBM:=CreateDIBSection (mDC, nW, nH)
OBM:=DllCall (" SelectObject ", "Uint, mDC, Uint, hBM)
HDC:=DllCall (" GetDC ", "Uint, 0)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • API
  • Related