|
Hey,
Just to make sure i understood right
I query the count at the begining and at the end, then i devide it by the frequency and the result is the soconds?
Thanks
|
|
|
|
|
A thing to note: 'to measure' is the act of determining the value of a property. 'to mess (something up)' is somewhat synonym to 'meddle' or 'create chaos'. I'll assume that by 'messure' you mean the former, not the latter.
|
|
|
|
|
To 'meddle' with the 'value of a property': messure
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Hello,
I created owner drawn listbox and I used double buffering
for preventing flickering because I have a lot of data ,
the problem is that its don't present all the items and ,
whan I scroll it down and up its erases part of the items,
the code is:
void HistDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if(IDC_LIST1 ==nIDCtl)
{
int width=lpDrawItemStruct->rcItem.right-lpDrawItemStruct->rcItem.left;
int height=lpDrawItemStruct->rcItem.bottom-lpDrawItemStruct->rcItem.top;
HDC memDC1 = CreateCompatibleDC(lpDrawItemStruct->hDC);
HBITMAP hMemBmp = CreateCompatibleBitmap(lpDrawItemStruct->hDC,width , height);
HBITMAP hOldBmp = (HBITMAP)SelectObject(memDC1, hMemBmp);
CDC *memDC=CDC::FromHandle(memDC1);
memDC->FillSolidRect(0,0, width, height,RGB(255,255,255));
int ODI_length =
1 + SendDlgItemMessage(IDC_LIST1,
LB_GETTEXTLEN,
lpDrawItemStruct->itemID,
0);
if (ODI_length)
{
wchar_t *ODI_wstr = NULL;
ODI_wstr = new wchar_t[ODI_length];
if (ODI_wstr)
{
COLORREF ODI_old_text_color;
SendDlgItemMessage(IDC_LIST1,
LB_GETTEXT,
lpDrawItemStruct->itemID,
(LPARAM)ODI_wstr);
memDC->DrawText(ODI_wstr,
ODI_length - 1,
&lpDrawItemStruct->rcItem,
DT_RIGHT);
}
}
BitBlt(lpDrawItemStruct->hDC, 0, 0, width,height, memDC1, 0, 0, SRCCOPY);
SelectObject(memDC1, hOldBmp);
DeleteObject(hMemBmp);
DeleteDC(memDC1);
}
}
What doe's I'm doing wrong?
thanks
|
|
|
|
|
aangerma wrote: BitBlt(lpDrawItemStruct->hDC, 0, 0, width,height, memDC1, 0, 0, SRCCOPY);
Shouldn't this be:
LONG left = lpDrawItemStruct->rcItem.left;
LONG top = lpDrawItemStruct->rcItem.top;
BitBlt(lpDrawItemStruct->hDC, left, top, width,height, memDC1, 0, 0, SRCCOPY);
?
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]
|
|
|
|
|
Hello,
I am writing an application that perform image acquisition frome a camera.
The image aqcuisition is done by a DLL Supplied by the camera manufactorer.
Basicaly im initializing the DLL and then i start capture,in my application i defened a function that is called by the DLL every captured frame,this "OnFrameCapturedHandler" function gets the frame as the parameter.
Then i perform some calculation on the frame and i display it on the GUI.
But the problem is that the grabbing is faster then my calculation so what happens is that a new frame comes in while the previous is still processed.So what i need is some way to block or to make "OnFrameCapturedHandler" not to do anything while previos frame is Processed.
I tried to put boolean at the begining of "OnFrameCapturedHandler" and set it to false while still processing and at the end set it to true.
And before entering the "OnFrameCapturedHandler" check it.but it freezes my app.
???
Thnaks.
|
|
|
|
|
I think the comments from Pete O'Hanlon in this thread[^] explain what is wrong and what you need to do.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
I just want to point out that if, as you say "the problem is that the grabbing is faster then my calculation" , then you are destined to lose frames. Threads and frame queues may help with the management of the arriving data but it is basic queueing, if your per-frame processing time exceeds the frame inter-arrival time, you will have problems. This basic tenet was masterfully demonstrated by the late Lucile Ball in the famous "chocolate candy factory" skit. Processing/interarrival mismatch[^]
Once you get the synchronization of the threads and queueing out of the way, you either need to make your processing faster or decide on how you choose which incoming frames to discard.
modified 13-Dec-11 10:46am.
|
|
|
|
|
|
Motion detection / Reverse Camera Software
I will like to create a motion detection application that displays/ previews a moving image on a windows machine when power is applied to a camera and removes the preview when the power is removed from the camera.
I was thinking a motion detection application would be best as when power is off there should be no motion, while the opposite applies when power is applied and the camera is receiving signal.
The app will need to poll the video feed all the time to ensure when power is applied the image is displayed very quickly.
Where do I start and can someone provide some advice.
|
|
|
|
|
Depending on the type of the camera you may 1) receive a signal from the driver when the video signal is lost or 2) receive wholly black images, or 3) receive a frozen image.
Case 1 is obvious to handle.
Case 2 is best solved by computing the average gray level on the whole image (will be exactly 0 or a small constant).
Case 3 is addressed by checking that consecutive images are exactly the same.
You can do this very quickly, say <1 microsecond, by considering a small sample of pixels, say 1000.
True motion detection is relevant only if you want to switch off the camera when the scene is still (but the camera plugged). Otherwise, it is overkill.
|
|
|
|
|
This is quite a wide subject and cannot be answered in a forum like this. I would suggest you start with Google.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I insert flash player activex on the MFC application and write the code
my_flash.put_Movie("C:\file.flv");
my_flash.put_Playing(true)
but file is not playing . also I want to display the controls of flash player activex .
how can I do this
Trioum
|
|
|
|
|
Looks like a '\' is missing in the file path. Try "C:\\file.flv".
|
|
|
|
|
do it still not playing
Trioum
|
|
|
|
|
This is going to be a busy day, I have this ODBC parameter issue, MD5 password Hash, and encryption to tackle today.
After reading the OLEDB post by Microsoft, I decided to give ODBC a try, and so far so good. If I can use parameters to build my SQL Command like in asp.net, I will give the thumbs up for it.
I'm pretty sure I have the order right. But I think I'm missing a statement or handle. Or I should go back to the non W versions, and start again. I'm not really sure.
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
WCHAR pzSQLCommand[512];
swprintf_s(pzSQLCommand, 512,
L"INSERT INTO UserInfo(FirstName) "
L"VALUES(@FirstName)");
pzSQLCommand[wcslen(pzSQLCommand) + 1] = L'\0';
SQLHDESC hIpd = NULL;
retcode = SQLGetStmtAttrW(hstmt, SQL_ATTR_IMP_PARAM_DESC, &hIpd, 0, 0);
retcode = SQLSetDescFieldW(hIpd, 0, SQL_DESC_NAME, L"@FirstName\0", SQL_NTS );
retcode = SQLBindParameter(hstmt, 0, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 0, 0, pzFirstName, 25, &cbFirstName );
retcode = SQLPrepareW(hstmt, pzSQLCommand, wcslen(pzSQLCommand) );
retcode = SQLExecute(hstmt);
|
|
|
|
|
I got this to work, but I think the SQLGetStmtAttr and SQLSetDescField was skipped.
But I think the order is correct, and each statement returned a 0
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
WCHAR pzSQLCommand[512];
swprintf_s(pzSQLCommand, 512,
L"INSERT INTO UserInfo(FirstName) "
L"VALUES(?)");
pzSQLCommand[wcslen(pzSQLCommand) + 1] = L'\0';
retcode = SQLPrepare(hstmt, pzSQLCommand, SQL_NTS );
retcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 25, 0, pzFirstName, wcslen(pzFirstName), NULL );
retcode = SQLGetStmtAttr(hstmt, SQL_ATTR_IMP_PARAM_DESC, &hIpd, 0, 0);
retcode = SQLSetDescField(hIpd, 1, SQL_DESC_NAME, L"@FirstName", SQL_NTS );
retcode = SQLExecute(hstmt);
|
|
|
|
|
I don't know what your question is.
And there is no way for SQLGetStmtAttr to be "skipped" in the code that you posted.
|
|
|
|
|
The original question was no question because I had no clue why it didn't work, so I wasn't really able to ask a precise question.
The 2nd post works, but I wasn't able to use VALUES(@FirstName) and then state
retcode = SQLSetDescField(hIpd, 1, SQL_DESC_NAME, L"@FirstName", SQL_NTS );
So that the data in the SQLBindParameter would hook up or link to the SQL Command @FirstName.
So I just went back to the VALUES(?), and the record writes to the table.
What I meant by skipped is that the statement is there, but is not relevant is any way, because only stored procedures can use the naming convention according to some MSDN documentation that I read.
But who knows, maybe I can get it working if I dig deeper. Right now, I 'm going to finish out the function with the Timestamp and MD5 Hash, and try the parameter again later.
This is my first ODBC Experience in which I'm submitting data to a table, and wanted to get it right before I write 20 more of these by the end of the month.
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
WCHAR pzSQLCommand[512];
swprintf_s(pzSQLCommand, 512,
L"INSERT INTO UserInfo(FirstName, LastName, UserName, PhraseHint, Phrase, PasswordClear, Email, DateOpened, FrontAdmin, SecurityLevel, Enabled, LastLogin) "
L"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
pzSQLCommand[wcslen(pzSQLCommand) + 1] = L'\0';
retcode = SQLPrepare(hstmt, pzSQLCommand, SQL_NTS );
retcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 25, 0, pzFirstName, wcslen(pzFirstName), NULL );
retcode = SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 40, 0, pzLastName, wcslen(pzLastName), NULL );
retcode = SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 80, 0, pzAccountName, wcslen(pzAccountName), NULL );
retcode = SQLBindParameter(hstmt, 4, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 80, 0, pzSecretQuestion, wcslen(pzSecretQuestion), NULL);
retcode = SQLBindParameter(hstmt, 5, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 80, 0, pzSecretAnwser, wcslen(pzSecretAnwser), NULL);
retcode = SQLBindParameter(hstmt, 6, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 80, 0, pzPassword, wcslen(pzPassword), NULL);
retcode = SQLBindParameter(hstmt, 7, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 80, 0, pzEmailAddress, wcslen(pzEmailAddress), NULL);
retcode = SQLBindParameter(hstmt, 8, SQL_PARAM_INPUT, SQL_C_TYPE_TIMESTAMP, SQL_DATETIME, 16, 0, pzDateOpened, 0, NULL);
retcode = SQLBindParameter(hstmt, 9, SQL_PARAM_INPUT, SQL_C_BIT, SQL_BIT, 0, 0, &bFrontAdmin, 1, NULL);
retcode = SQLBindParameter(hstmt, 10, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &pzSecurityLevel, 1, NULL);
retcode = SQLBindParameter(hstmt, 11, SQL_PARAM_INPUT, SQL_C_BIT, SQL_BIT, 0, 0, &bUserEnabled, 1, NULL);
retcode = SQLBindParameter(hstmt, 12, SQL_PARAM_INPUT, SQL_C_TYPE_TIMESTAMP, SQL_DATETIME, 16, 0, pzLastLogin, 16, NULL);
retcode = SQLGetStmtAttr(hstmt, SQL_ATTR_IMP_PARAM_DESC, &hIpd, 0, 0);
retcode = SQLSetDescField(hIpd, 1, SQL_DESC_NAME, L"@FirstName", SQL_NTS );
retcode = SQLSetDescField(hIpd, 2, SQL_DESC_NAME, L"@LastName", SQL_NTS );
retcode = SQLSetDescField(hIpd, 3, SQL_DESC_NAME, L"@UserName", SQL_NTS );
retcode = SQLSetDescField(hIpd, 4, SQL_DESC_NAME, L"@PhraseHint", SQL_NTS );
retcode = SQLSetDescField(hIpd, 5, SQL_DESC_NAME, L"@Phrase", SQL_NTS );
retcode = SQLSetDescField(hIpd, 6, SQL_DESC_NAME, L"@PasswordClear", SQL_NTS );
retcode = SQLSetDescField(hIpd, 7, SQL_DESC_NAME, L"@Email", SQL_NTS);
retcode = SQLSetDescField(hIpd, 8, SQL_DESC_NAME, L"@DateOpened", SQL_NTS);
retcode = SQLSetDescField(hIpd, 9, SQL_DESC_NAME, L"@FrontAdmin", SQL_NTS);
retcode = SQLSetDescField(hIpd, 10, SQL_DESC_NAME, L"@SecurityLevel", SQL_NTS);
retcode = SQLSetDescField(hIpd, 11, SQL_DESC_NAME, L"@Enabled", SQL_NTS);
retcode = SQLSetDescField(hIpd, 12, SQL_DESC_NAME, L"@LastLogin", SQL_NTS);
retcode = SQLExecute(hstmt);
|
|
|
|
|
jkirkerx wrote: The original question was no question because I had no clue why it didn't work,
so I wasn't really able to ask a precise question.
Hi,
You posted some code because you did not know what question to ask.
Well, Not to be funny! This is a Developers Site. Developers are supposed to be logical to a Fault. (Otherwise the Machine will beat you, because It's logical to a Fault), and you would not be a developer for long.
You cannot just post a pile of code in the hope that someone out there will tell you what's wrong with it (See the posting Guidelines). First of all, No One but yourself knows from a Code Fragment -What Environment it is called in, -what you intend the code to do.
To bring it down to a stateble question is called Debugging! That's the hard thing to do, but Unavoidable.
We All like to be creative, just type code into a file, Hi, It compiles, No Syntax errors, or forgotten header files. That's only step 1. The Compiler could make sense of what you wrote. That does not mean that the compiler wrote what you had in mind!
You seem to be overwelmed by the task at hand.
Reccommendation: Simplify the task, to the state of Trivial, Debug, Learn what works, and then expand it to the task at hand. This may sound Slow, but, believe me, it is the fasest way. It also enables you, when you get stuck, to ask a simple question: 'This' Simple thing does not work, Why Not.
Success,
Bram
Bram van Kampen
|
|
|
|
|
I see your point. I just didn't post a very good question, most of my questions are better. This ODBC was overwhelming, The basics were really easy, but when it came down to data types, and how they are measured in size, that was a new learning experience.
Anyways, I just got a clean write from the code. Could not really debug it, -1 doesn't tell much of a story in ODBC, and the datetime was hard to figure out, because there really is no datetime in ODBC.
If I upset you, I apologize, won't be here much longer, just till the end of the month.
|
|
|
|
|
Hi all,
i am play video file using Dirct Show in my application.
but some of MOV and other files are are not play in Window Media Player also in my application.
but the are play in other player,
so how can i identify the file is valid and can play in any one of Media Player.
thanks in advance.
|
|
|
|
|
That's done with codecs.
You'll have to install a codec that can decode that stream type.
|
|
|
|
|
can you please more specific about this and help me with any example if possible.
|
|
|
|
|