If (!rImage.Create(rcCapture.Width(), rcCapture.Height(), 32, 0))ĪfxMessageBox(L"Cannot create image!", MB_ICONERROR) ĭcScreen.CreateDC(_T("DISPLAY"), nullptr, nullptr, nullptr) create bitmap and attach it to this object destroy the currently contained bitmap to create a new one So I created this function (based on code on the internet): BOOL CCenterCursorOnScreenDlg::CaptureRect(const CRect& rcCapture, CImage &rImage) I thought I would try to paste it into a image editor, just to see if I had captured the right information. So my next task was to try and create a screen grab and initially copy it to the clipboard. For now, I display the list of monitor names in a CListBox for the user to select that way, but eventually I want a list of display thumbnails. I extended it (for the timebeing) to also remember the list of monitor names. PThis->strMonitorNames.push_back(sMI.szDevice) ĮnumDisplayMonitors(nullptr, nullptr, MonitorEnum, (LPARAM)this) PThis->rcMonitors.push_back(*lprcMonitor) MonitorRects* pThis = reinterpret_cast(pData) Static BOOL CALLBACK MonitorEnum(HMONITOR hMon, HDC hdc, LPRECT lprcMonitor, LPARAM pData) I have found out how to use EnumDisplayMonitors to get the array of monitor rectangles from a question here on SO: struct MonitorRects This is so that the user can click on one of those thumbnails and I then perform a certain action for them. => "C:\Program Files (x86)\HyperSnap 6\HprSnap6.exe" -snap:awin -print:l:inv:af -hidden -exit Thanks everyone for your help.My ultimate goal here is to try and display a small list of monitor thumbnails on a dialog. The HyperSnap window will not appear and stay up. The image will be printed with inverted black and white as specified. It will disappear when the print job is done. With the command listed below, when executed inside a batch command file, a pop-up window with a print message will appear. Just by accident, I found out, if I logged off the operator session and logged back in (same user), then the command would work. Same results were observed when using the batch command file or execute the command directly on DOS. So, I added another switch -hidden and it still did not work. There was no print out and the HyperSnap window would stay up until I closed it manually. => "C:\Program Files (x86)\HyperSnap 6\HprSnap6.exe" -snap:awin -print:l:inv:af -exit When I executee the above command, the HyperSnap window would be displayed with the captured image of the active window. The goal is for the operators to click on the link to execute the HprSnap6.exe to print a HMI graphics. I am working on adding a link (button, I called in my previous e-mail) on graphics to a windows batch command file. The lesser admin *************************************** Allow me to explain my HyperSnap problem and the solution I found (It works on Window 7 and Win2008 server) I work in a manufacturing plant and productions are control with HMI graphihcs. Please try again with HS completely closed. I did not try to create a batch file, but I don't see, why there should be a difference. It of course snapped the active DOS window, but all printing parameters were accepted and worked. I opened a DOS window, went to the HS path and entered your command. If HS is still present in the tray, it won't work. I just tried your command with HyperSnap 7 on a Windows 7 computer and it worked.īefore I go into the details, please note, that HyperSnap has to be EXITED COMPLETELY before using the commandline commands. It would help others, if you could reply in the thread WITH my text citated. So I will answer with this private message. My work pc won't let me add a reply in the thread, no idea why.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |