|
hai all,
i have to solve a small problem and i need help from u people. i have an application where i am using MS Chart. and i am taking values from a file. i need to know how do i plot this values from taking from the file. the values in the file is integers and only one interger in a line.
for example
45
34
36
23
75
so how do plot this value.
chandrasekharan
|
|
|
|
|
Take a look at this article - it has a simple graph function.
http://www.codeproject.com/audio/waveInFFT.asp
|
|
|
|
|
|
hai all,
i have to solve a small problem and i need help from u people. i have an application where i am using MS Chart. and i am taking values from a file. i need to know how do i plao this values from taking from the file. the values in the file is integers and only one interger in a line.
for example
45
34
36
23
75
so how do plot this value.
chandrasekharan
|
|
|
|
|
When performance is not an issue and when all that we want is just a snapshot of the desktop, we can consider the GDI option. This mechanism is based on the simple principle that the desktop is also a window - that is it has a window Handle (HWND) and a device context (DC). If we can get the device context of the desktop to be captured, we can just blit those contents to our application defined device context in the normal way. And getting the device context of the desktop is pretty straightforward if we know its window handle - which can be achieved through the function GetDesktopWindow(). Thus, the steps involved are:
Acquire the Desktop window handle using the function GetDesktopWindow();
Get the DC of the desktop window using the function GetDC();
Create a compatible DC for the Desktop DC and a compatible bitmap to select into that compatible DC. These can be done using CreateCompatibleDC() and CreateCompatibleBitmap(); selecting the bitmap into our DC can be done with SelectObject();
Whenever you are ready to capture the screen, just blit the contents of the Desktop DC into the created compatible DC - that's all - you are done. The compatible bitmap we created now contains the contents of the screen at the moment of the capture.
Do not forget to release the objects when you are done. Memory is precious (for the other applications).
Void CaptureScreen()
{
int nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
int nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
HWND hDesktopWnd = GetDesktopWindow();
HDC hDesktopDC = GetDC(hDesktopWnd);
HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);
HBITMAP hCaptureBitmap =CreateCompatibleBitmap(hDesktopDC,
nScreenWidth, nScreenHeight);
SelectObject(hCaptureDC,hCaptureBitmap);
BitBlt(hCaptureDC,0,0,nScreenWidth,nScreenHeight,
hDesktopDC,0,0,SRCCOPY|CAPTUREBLT);
SaveCapturedBitmap(hCaptureBitmap); //Place holder - Put your code
//here to save the captured image to disk
ReleaseDC(hDesktopWnd,hDesktopDC);
DeleteDC(hCaptureDC);
DeleteObject(hCaptureBitmap);
}
In the above code snippet, the function GetSystemMetrics() returns the screen width when used with SM_CXSCREEN, and returns the screen height when called with SM_CYSCREEN. Refer to the accompanying source code for details of how to save the captured bitmap to the disk and how to send it to the clipboard. Its pretty straightforward. The source code implements the above technique for capturing the screen contents at regular intervals, and creates a movie out of the captured image sequences.
In consideration to the above code please let me know how to capture the network PC`s desktop to my software..
I want to capture it continously i dont want to save it, i want it`s Rectangular Area in ma software...
Please let me know how to do this(of course sockets are used) or create a method for this...
|
|
|
|
|
|
HassanKU busted!.Good job Mark.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Just giving him/her a hard time!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Does anyone have a suggestion as to how to convert a double value to text so it can be displayed in a CEdit window?
Thanks.
John P.
|
|
|
|
|
Since you are using MFC, try:
CString str;
str.Format("%f", 123.45);
m_edit.SetWindowText(str); Or:
char szStr[16];
sprintf(szStr, "%f", 123.45);
m_edit.SetWindowText(szStr);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks, David --- you da man!
John P.
|
|
|
|
|
Since you're usimg MFC, just associate a double variable instead of a string with the windows. DDX will handle the conversions for you.
Judy
|
|
|
|
|
Thanks, Judy. I was not aware of that. That is very useful to know. I appreciate your response.
John P.
|
|
|
|
|
how to display messagebox when click system menu(X) on dialogbox.
Thank to all
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Derive your own class from CDialog and override the OnClose() function which is called by the system when the [X] button is pressed.
|
|
|
|
|
Just handle the cancel button click event.
void CYourDlg::OnBnClickedCancel()
{
AfxMessageBox("Don't close!");
}
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
He wants to catch the [X] in the system-menu, not the Cancel button ...
Here's the code:
void CYourDlg::OnClose()
{
AfxMessageBox("Don't close!");
}
... and don't forget to add the ON_WM_CLOSE() macro in the dialog's message-map.
|
|
|
|
|
Hey that still works with System menu's [x]. Did you check that? but yes mentioning "WM_CLOSE" is required!
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Hey, I just checked it, and you know what ? You're absolutely right !!!
Sorry, my bad You rule !!
Guy.
|
|
|
|
|
VuNic wrote: Hey that still works with System menu's [x]. Did you check that? but yes mentioning "WM_CLOSE" is required!
What do you mean by "mentioning WM_CLOSE is required"?
|
|
|
|
|
Assuming he's operating on a default dialog with OnCancel implemented, he can simply override it and handle it by the way he wanted. It works without him needing to make any extra effor. But ofcourse handling WM_CLOSE is the proper way. That apparently relates to [X] close!.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Actually I was searching for OnCancel but it's not there with 7.1 compiler. VS6.0 displays the cancel event handler as "::OnCancel". but in 7.1 it's generating OnBnClickedCancel.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Why would you suggest that? If you write your code in OnCancel() , then it would be obviously executed when the Esc key is pressed and also when the cancel button is pressed. Handling WM_CLOSE is the right way.
|
|
|
|
|
Yeah, nobody would want their application to get closed with an Esc. I really wonder why MFC has it that way :unsure:. So handling WM_CLOSE is the best way. Thanks for stressing that one out.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
VuNic wrote: Yeah, nobody would want their application to get closed with an Esc.
You assume things.
VuNic wrote: I really wonder why MFC has it that way :unsure:. So handling WM_CLOSE is the best way.
That is by design. Pressing the Esc key in a dialog based app will execute some extremely old windows code. As a developer, you are not supposed to develop complex applications which is dialog based. As a user, he would always expect a dialog to get dismissed when the Esc key is pressed. For instance, if you right click on the desktop and choose properties, you will expect the properties window to get dismissed on pressing Esc. I am working on my first article, and I have elaborated on this dialog box closing glitch issue more clearly.
|
|
|
|