|
You need to have prnt_scrn.exe for capturing screen shot on a WinCE device.
Syntax of the Print Screen Tool
Prt_scrn [–d NUM] [-s Num1Num2] [–e Num1Num2] filename
Parameters of the Print Screen Tool
-d NUM
Specifies a number of seconds NUM to wait after running the Prt_scrn.exe application before taking the screen shot. The default value for NUM is zero.
-s Num1 Num2
Specifies the location of the upper left vertex of the rectangular region on the screen where to take the screen shot. The values Num1 and Num2 specify, in pixels, the horizontal and vertical coordinates, respectively, of this vertex. The default values for Num1 and Num2 are zero. The default values specify that the upper left vertex is the upper left corner of the screen.
-e Num1 Num2
Specifies the location of the lower right vertex of the rectangular region on the screen where to take the screen shot. The values Num1 and Num2 specify, in pixels, the horizontal and vertical coordinates, respectively, of this vertex. The values for Num1 and Num2 must be greater than the values specified in the -s parameter. The default value for Num1 is the width of the screen in pixels minus one pixel and the default value for Num2 is the height of the screen in pixels minus one pixel. The default values specify that the lower right vertex is the lower right corner of the screen.
filename
Specifies the path and file name of the .bmp file where to save the screen shot. To save the .bmp file to the release directory, add a \release\ prefix to the file name. The filename parameter is a required parameter.
Examples
The following code example shows syntax that instructs the Print Screen tool to take a screen shot on the target device three seconds after running Prt_scrn.exe. This example sends the screen shot to the Snapshot.bmp file in the release directory.
Prt_scrn –d 3 \Release\Snapshot.bmp
The following code example shows syntax that instructs the Print Screen tool to take a screen shot of the (100, 100, 400, 400) screen region on the target device. This example sends the screen shot to the Snapshot.bmp file in the Windows directory on the target device.
Prt_scrn –s 100 100 –e 400 400 \Windows\Snapshot.bmp
|
|
|
|
|
|
Hi..
I am new to this code project..
I have doubt on Visual c++..
My task is to scan the image and find the text in visual c++..
Once if i scan the alphabet it should called the library data base....
1.Create data base
2. How to include the images in the data base
3.Should we include the images in library files..
4.How to call the library files..
Could some one help me out ....
Thanks
|
|
|
|
|
You better seperate the images out of the database as separate image files in the desired format. In the database I would only list the relative path (!!!) to the image of an image directory or server.
Consider changing the image storage for the future!!!
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I want to retrieve handles for all the windows opened in wince machine. Using my application i need to retrieve the handle for the windows that has been opened in desktop and list the title of those windows in a list view .
Thanks in Advance.
|
|
|
|
|
|
I have tried with the folowing code snippet.Still i am not able to retrieve the handle for the window.
WNDENUMPROC lpEnumFunc = &EnumWindowsProc;
TCHAR szName[50];
HWND hTempWnd = NULL;
lpEnumFunc(hTempWnd,lParam);
if(EnumWindows(lpEnumFunc ,LPARAM(hWnd)))
MessageBox(hWnd,L"EnumWindows Successful",NULL,0);
lpEnumFunc(hTempWnd,lParam);
GetWindowText(hTempWnd,szName,50);
MessageBox(hTempWnd,szName,szName,0);
|
|
|
|
|
Well, well try, If that API was supposed to work as per your understanding there are possible risks being caught in an infinite loop or referencing a destroyed window handle.
Call Back functions of an Windows API are not that supposed to be called by you.
struct MYLISTVIEW
{
};
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
#define MAX_TEXT_LEN 256
MYLISTVIEW *plvData = (MYLISTVIEW *)lParam;
if (plvData)
{
TCHAR szWndText[MAX_TEXT_LEN] = _T("");
LONG lStyle = GetWindowLong(hwnd, GWL_STYLE);
LONG lExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
if (IsWindowVisible(hwnd) && !GetParent(hwnd) && hwnd != GetDesktopWindow() && (
!(lExStyle & WS_EX_NOACTIVATE || lExStyle & WS_EX_TOOLWINDOW)))
{
RECT rc = {0};
GetWindowRect(hwnd, &rc);
if (rc.bottom - rc.top && rc.right - rc.left)
{
GetWindowText(hwnd, szWndText, MAX_TEXT_LEN);
AddWndTextToListView(plvData, szWndText);
}
}
}
return TRUE;
}
MYLISTVIEW g_lvData;
void AddOpenedWindowsToListView()
{
EnumWindows(EnumWindowsProc, (LPARAM)&g_lvData);
}
|
|
|
|
|
I am new to visual studio 2008 and I am stuck. Below is a brief summary of the code and the error that accompanies it. I have tried a bunch of fixes to no avail. Perhaps I do not understand the error could someone please help me? Any suggestions would be appreciated.
CString s;
for(int i=0; i< ROIData.GetCount() ; i++)
{
ROIData.GetText(i,s);
sscanf((LPTSTR)((LPCTSTR) s),_T("%s %d %d %d %d %d d"),&tmp,&temp.lbk.l,&temp.lbk.u,&temp.pk.l,&temp.pk.u,&temp.ubk.l,&temp.ubk.u);
temp.label.Format(_T("%s"),tmp);
m_arROI.Add(temp);
}
The error that accompanies the is "error C2664: 'sscanf : cannot convert parameter 1 from 'LPTSTR' to 'const char *'"
I would be happy to provide any other information I can if any more is needed.
Thanks in advance!!!
|
|
|
|
|
|
xzing wrote: sscanf((LPTSTR)((LPCTSTR) s),_T("%s %d %d %d %d %d d"),&tmp,&temp.lbk.l,&temp.lbk.u,&temp.pk.l,&temp.pk.u,&temp.ubk.l,&temp.ubk.u);
As side note to Stuart's reply, you don't need neither (LPCTSTR) , nor (LPTSTR) .If you cannot spot why, then you should read again, carefully, the article suggested by Stuart.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
is there a difference in how menu items are processed in Doc-View apps vs. Dialog-based apps?
I am trying to work with the ON_UPDATE_COMMAND_UI callback in a Dialog-based app for a menu item in the Dialog's main menu.
(I posted my problem here [(Enable/Disable menu items^)]">)
It seems that within my ON_UPDATE_COMMAND_UI function, it doesn't execute the statement pCmdUI->Enable( FALSE ) - thus NOT setting the menu item as I want
Thanks!
|
|
|
|
|
john john mackey wrote: is there a difference in how menu items are processed in Doc-View apps vs. Dialog-based apps?
Yes.
See this article[^]
|
|
|
|
|
You are the frickin MAN!
thanks for the info!
|
|
|
|
|
Hi,
I have been doing some research regarding how to fit a specfied number of characters
In a Rich edit control the following article on the codeProject helped
"http://www.codeproject.com/KB/edit/richeditsize.aspx"
"Calculating a Rich Edit Control Minimum Size"
I get the Idea behind it however on thing is missing the Author starts with
a computation of half of the width of the Client area
int cxLast = ::GetSystemMetrics( SM_CXFULLSCREEN ) / 2;
If I want a certian number of characters to fix in the line of a rich edit control
wouldn't I want to know the Font of The Dialogbox/Richeditcontrol
would that mean instantating of CDC object
Doing a SlectObject getting the Logfont Structure
My question is "Am I losing it" meaning I am really making this more difficult then I have to ?????
Or am I on the right Path
thankx
|
|
|
|
|
ForNow wrote: If I want a certian number of characters to fix in the line of a rich edit control
wouldn't I want to know the Font of The Dialogbox/Richeditcontrol
That might well work for a mono-space font like Courier or Courier New. But what about proportional fonts like Arial or Times New Roman? With a font like that, the number of characters you can fit into a particular width depends on the characters you're displaying - 'W' is a lot wider than 'l'!!
ForNow wrote: would that mean instantating of CDC object
Doing a SlectObject getting the Logfont Structure
In a word yes. And then use GetTextExtentPoint32[^] to get the size of a string you specify or GetTextMetrics[^] (to get font metrics including average character width).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
First I think I finally Understand from your reply and the sample code in the above mentioned URL why they call RichEdittext bottomless ... cuase the height is always the same for a font while the width of each character varies
thats why in the sample code the author was looking for what particualr height will have the right richedit control
width
I know people here always tell me to do reasearch before asking my questions and this time I thought I did
but tell me what you think of this solution
Cfont* font richedit->GetFont();
LOGFONT lf;
font->GetlogFont(&lf);
now lf.lfwidth * richedit->Linelength(-1); // multiple the avergage width by the number of charcters on a line
In a relasted issue I cann't seem to get the notification handler to kick off, I thought that after issuing
Requestresize()Control would be passed to it, I made a breakpoint in the begining of the method and it was never
invoked???
below is 3 pices of information the 1) the declaration of the method 2) the message map entry 3) the actual method
I think I have them all coded correctly
1) afx_msg void OnRequestResize(NMHDR* pNMHDR, LRESULT* pResult);
2) ON_NOTIFY(EN_REQUESTRESIZE,IDC_RICHEDIT21,OnRequestResize)
3) void Show_storage::OnRequestResize( NMHDR* pNMHDR, LRESULT* pResult )
{
_ASSERT( pNMHDR->code == EN_REQUESTRESIZE );
// Storing the requested sized to be used in the binary search
.
.
.
thankx again
|
|
|
|
|
ForNow wrote: First I think I finally Understand from your reply and the sample code in the above mentioned URL why they call RichEdittext bottomless
No - the 'bottomless' rich-edit control is one that sends notifications to its parent that it needs to be resized when the text it contains changes enough that the control can't contain it all any more.
ForNow wrote: but tell me what you think of this solution
That's probably what I'd do
ForNow wrote: In a relasted issue I cann't seem to get the notification handler to kick off, I thought that after issuing
Requestresize()Control would be passed to it, I made a breakpoint in the begining of the method and it was never
invoked???
To receive EN_REQUESTRESIZE notification messages, you must enable the notification by using the EM_SETEVENTMASK message.[^]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
>No - the 'bottomless' rich-edit control is one that sends notifications to its parent >that it needs to be resized when the text it contains changes enough that the control >can't contain it all any more.
I thought just issuing the editctrl.RequestResize(); sends the EN_REQUESTRESIZE to the parent with REQSIZE structure containing the new demissions it ( child rich edit control) would like
>To receive EN_REQUESTRESIZE notification messages, you must enable the notification by >using the EM_SETEVENTMASK message.[^]
I did that I think the problem might be the named I choose foor the notification Handler "OnRequestResize"
I made a prototype of the function in the Dialog Class since thats the parent that will receive the notification
However I when try to set as Break point I get message "No code associated with this Location"
When I try to see the assembler code generated none is for the first part of the method
Could it be that the name I choose for the Event handle OnRequestResize is Similar to a protected method call onRequestResize (lower case o )thats giving me problems ??
I'll try to change the name ..
|
|
|
|
|
I've just added a rich-edit control to a sample MFC dialog app.
In the OnInitDialog handler, I added this:
UpdateData();
richEd.SetEventMask(ENM_REQUESTRESIZE);
Here's the message map entry
ON_NOTIFY(EN_REQUESTRESIZE, IDC_RICHEDIT21, &CmfcdialogDlg::OnEnRequestresizeRichedit21)
Here's the notification handler
void CmfcdialogDlg::OnEnRequestresizeRichedit21(NMHDR *pNMHDR, LRESULT *pResult)
{
REQRESIZE *pReqResize = reinterpret_cast<reqresize>(pNMHDR);
*pResult = 0;
}</reqresize>
I request the resize with
richEd.RequestResize();
in a 'button click' event handler.
My EN_REQUESTRESIZE handler gets called.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
TODO: The control will not send this notification unless you override the // CDialog::OnInitDialog() function to send the EM_SETEVENTMASK message // to the control with the ENM_REQUESTRESIZE flag ORed into the lParam mask.
This accomplished in the OnInitDialog function issuing
richED.SetEventMask(ENM_REQUESTRESIZE);
I dont actually have to do a
CmfcdialogDlg::SendMessage(EM_SETEVENTMASK,0,(LPARAM)ENM_REQUESTRESIZE);
thankx
|
|
|
|
|
Hi,
thankx for all your all I see that you are in the UK 5 hours ahead of me as I am in the states on the East Coast
I got requestresize exit working (excuse me for my use of words "exit") as I Work as A MainFrame programmer
I have a couple of more general questions
the porpouse of the Bottomless Rich edit control is to get a perfect fit in Height and with for the Text
Depending on the amount of text and where you would like to break up the text is Where the Notfication Handler
will help
Last question I have been using WM_SETTEXT to get text to the Rich edit is the Steamin method a better way of doing
this
thankx again
|
|
|
|
|
ForNow wrote: Last question I have been using WM_SETTEXT to get text to the Rich edit is the Steamin method a better way of doing this
If the text is large (megabyte+) or is actually RTF (contains markup), yes. I've seen a couple of pages that suggest you should always use EM_STREAMIN because WM_SETTEXT is unreliable with rich edit controls - but if it's working for you...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
when excuting this (procID is a control panel applet)
HANDLE lView=OpenProcess(PROCESS_ALL_ACCESS,false,procID);
if (lView)
{
if ( !LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&tokenLuid ) )
j=GetLastError();
tokenPriv.PrivilegeCount = 1;
tokenPriv.Privileges[0].Luid = tokenLuid;
tokenPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
tokenHandle=NULL;
if (!OpenProcessToken(lView,TOKEN_ADJUST_PRIVILEGES,&tokenHandle))
j=GetLastError();
if ( !AdjustTokenPrivileges(tokenHandle,FALSE,&tokenPriv,sizeof(TOKEN_PRIVILEGES) , (PTOKEN_PRIVILEGES) NULL, (PDWORD) NULL) )
j=GetLastError();
// Allocate virtual memory for ListView
LVITEM *_lvi=(LVITEM*)VirtualAllocEx(lView, NULL, sizeof(LVITEM),MEM_COMMIT, PAGE_READWRITE);
if (!VirtualQueryEx(lView,_lvi,&memBasicInfo,sizeof(MEMORY_BASIC_INFORMATION)))
j=GetLastError();
no errors are triggered, memBasicInfo returns the correct parameters, ie i have full access to the allocated memory. But if i follow it up by:
if (WriteProcessMemory(lView, _lvi, &lvi, sizeof(LVITEM),&byteCount))
j=GetLastError();
i still get error 5, but bytecount gives the correct count. I disabled the antivirus scanner, so it's not interfering
I am flabbergasted.
|
|
|
|
|