|
on a single click how do i take a snapshot and print of currently displayed screen using VC++/MFC
|
|
|
|
|
There are lot of articles in the code project about capturing screen. Why dont you have a search?
|
|
|
|
|
|
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I have a MFC class which is derived from CWinApp. It has got two methods set and get. I have to use this set method in a Win32 lib. But when I include the header file of above MFC application. I am getting a compilation error like
C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h> . Can I know how to solve this problem.
Thanks & Regards
|
|
|
|
|
what about using a wrapper function which doesnot include MFC headers in its declaration to get and set properties with CWinApp based class.
|
|
|
|
|
I use FILE to read datas from file.But it does not read full datas.
For Ex: if my file have 9 datas it reads only 6 datas then it jumped out from the loop.
when i see the YCS file.. it contains 9 datas, so no problem in writing.
Problem only in reading data. THis is my code...Whats the problem???Pls help me.
void ReadThermodata()
{
char FPath[] = "C:\\SelCompLst.YCS";
FILE *fp;
SThermoData pData;
if((fp = fopen((LPCTSTR)FPath,"r"))==NULL)
{
return;
}
int cnt = 0;
while( fread( &pData, sizeof( struct SThermoData ), 1 ,fp ) )
{
ThermoDataList.push_back(pData);
cnt = cnt + 1;
}
}
Anu
|
|
|
|
|
This is just a wild guess, try opening the file in "r+b" mode...
when the file is opened in text mode,there is possibility for the file to stop at ascii values like 26....
Hope this helps!
|
|
|
|
|
it seems its a binary mode data file, you need to open it with "rb", some value of data in binary mode is EOF in text mode.
|
|
|
|
|
We tried "rb" to open the file. But no use. It just read very few datas.
Anu
|
|
|
|
|
check what is the error, using ferror, _get_errno
|
|
|
|
|
Anu_Bala wrote: Whats the problem???Pls help me.
Have you bothered to use the debugger to step through the code?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello
I am looking for a image\video compression\decompression library to serve video over TCP\IP.
I get frames from my web cam in 320*240 resolution and RGB24 format so each frame is 320*240*3 = 230400 byte = 225 kbyte.
I am using Directshow to get streams from files or capture devices in server side. But I don't want use it also in client side. I am building my client in pure WinAPI. So I am looking for ANSI or only Win32 dependent open or closed free libraries for C\C++.
Can you suggest any ?
Best Regards,
Akin Ocal
|
|
|
|
|
Myphone[^] might give you good leads.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
This[^] might help you as well.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
i have a dialog with background color
when i minimize the dialog and maximize again i am loosing the color of the dialog
if i switch to another window and come back to same dialog the color will appear on the dialog again
whats the problem
i should not loos the color of the dialod when i minni mize and maximize
any message handlr i have to handle ?
|
|
|
|
|
How did you change the background color??
|
|
|
|
|
Seems like a paint issue.
Try overriding the OnEraseBkgnd() function.Write the code to put color on the screen there.
Hope this works out for you.(never tried this though...)
cheers!
PS:do comment or call the CDialog::OnEraseBkgnd( pDC ) first before putting in your paint code
modified on Tuesday, May 13, 2008 12:39 AM
|
|
|
|
|
do comment or call the CDialog::OnEraseBkgnd( pDC ) first, before putting in your paint code
|
|
|
|
|
|
Hi
Handle the WM_CTLCOLORDLG and place your painting code inside the handler.
<br />
<br />
HBRUSH CBkColorDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
<br />
<br />
<br />
if(nCtlColor == CTLCOLOR_DLG)<br />
{<br />
hbr = CreateSolidBrush(RGB(2,22,222));<br />
}<br />
else if(nCtlColor == CTLCOLOR_STATIC)<br />
{<br />
pDC->SetBkMode(TRANSPARENT);<br />
hbr = CreateSolidBrush(RGB(2,22,222));<br />
}<br />
<br />
return hbr;<br />
}<br />
<br />
that's it
Regargs
Nitheesh
|
|
|
|
|
Serious resource leak there
Those brushes should be created and destroyed
outside of the WM_CTLCOLOR handler!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi!
I am working with a class, derived from CRecordView. It is a basic customer-maintenance type module where you can either select the record by typing in the key number or scroll back and forth, uisng the standard RecordView buttons. Problem is that quick lookups and scrolling appears to me mutually exclusive.
The person who originally wrote the class solved this by coding the lookup like this:
MoveFirst();
while(!IsEOF())
{
if(m_Nummer==nr)
return TRUE;
MoveNext();
}
This works if the number of records are reasonable (say up to 5000). If I code the lookup with a normal filter and Requery then it is lightinly fast, but Moves fail, presumably because it tries to move within that result set of one record.
Can anyone suggest a solution where I can:
a) Just type in a number and have it pull up the record and
b) be able to use previous/next navigation?
|
|
|
|
|
Anders Gustafsson wrote: ...Moves fail, presumably because it tries to move within that result set of one record.
Have you tried checking IsBOF() also?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes. If I set m_strFilter and do a requery, I find my record. I then clear m_strFilter. If I then hit previous/next the framework will kick off an extended fetch that will error with 100 (SQL No DATA).
What does work, but is kind of ugly is this:
Open the table, scroll through all records, for each do a:
m_pSet->GetStatus(rStatus);
m_Index[m_pSet->m_Nummer] = rStatus.m_lCurrentRecord + 1;
This builds an index of all records and their absolute numbers. Then in my lookup routine:
m_pSet->m_strFilter = "Nummer=?";
m_pSet->m_Nummerfilter = m_persGrund.m_persnrEdit.m_set.m_Nummer;
m_pSet->Requery();
m_pSet->m_strFilter = "";
m_pSet->Requery();
m_pSet->SetAbsolutePosition(m_Index[m_persGrund.m_persnrEdit.m_set.m_Nummer]);
But this seems like a tremenous kludge for such a simple task?
modified on Monday, May 12, 2008 3:16 PM
|
|
|
|