|
Brilliant!! It worked
One more thing, What number do I need to use for dwRate to change the frame rate to 25 fps?
Thank you.
|
|
|
|
|
Just give dwRate as 1..hope it will work..
|
|
|
|
|
Hi all,
I have one project which should done in vC++.
We need to Implement An activex component in vc++.
if ur interested we can discuss on that by mail.
Thansk
Kishore
|
|
|
|
|
You should try it in the job offers section[^].Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi,
I have a simple VS2008 C++ MFC application that shows a FormView in which a "Microsoft Office Spreadsheet 10.0" has been inserted. At this point when the program is runing I can manually manipulate -but ONLY with the keyboard! the spreadsheet cells like a usual Excel one.
Now I would like to do the same programatically but I don't know how!
I have added a variable to the component and this variable seems to let me control the spreadsheet through a LPDISPATCH pointer.
This is the instruction that VS2008 automatically put in the DODataExchange() function:
DDX_Control(pDX, IDC_SPREADSHEET1, in_grid);
in_grid is name of the variable added to "SPREADSHEET1" component.
Later in the code I have this instruction:
LPDISPATCH lpd_grid = in_grid.get_ActiveSheet();
Most of functions avalable through in_grid return this type LPDISPATCH. But I have not undestood how I can use this pointer to Write/Read the cell's value.
In so many exemples found here and there LPDISPATCH lpd_grid would be used in this way:
Excel::_WorksheetPtr xlWs = in_grid.AttachDispatch(lpd_grid);
but in the present case the later instruction above would lead to a compiler error.
Does anybody ever used this "Microsoft Office Spreadsheet 10.0" ?
Regards
Bernard
|
|
|
|
|
I need some hint / help in troubleshooting this error.
It gets retruned by both WriteFile and ReadFile when writting to or reading from file opened for asynchronous ( COM port ) access.
The file is created using
m_hCOM = ::CreateFile(lpszDevice, // COMx
GENERIC_READ|GENERIC_WRITE,
0, // exclusive
0, // security irrelevant
OPEN_EXISTING, // it has to be there
FILE_FLAG_OVERLAPPED, // asynchronous
0); // template file
And this is wherw it fails
// write to comm port
iResult = WriteFile(m_hCOM, (char*) data, dwSize, &dwWritten, &osWrite);
with this cryptic error message
"Invalid access to memory location"
DCB, mask and timeouts are properly configured.
At this time I am wiriting single (dwSize = 1) null '0' character and the OVERLAPPED structure event is set.
I am obviously missing something.
Any constructive help as always is appreciated. Suggestions to copy someone else code are not necessary. Been there - done that.
Vaclav
-- Modified Monday, March 1, 2010 11:06 PM
|
|
|
|
|
What is data?
How is it defined? How is a value associated with it?
From what you posted, it seems likely that there is something wrong with your use of (char*) data . Of course, there isn't enough in your post to say for sure.Please do not read this signature.
|
|
|
|
|
Thanks for reply. I must have had something wrong with the setup parameters, I have rebuild my code using defaults and this problem went away. Even if I set the data entry to NULL, the WriteFile still works without his access memory error. It returns zero characters written as expected.
Now I need to find out why the WriteFile fails - return 0, but the last error is not ERROR_IO_PENDING as expected, but no error whatsoever. For now I will work on that.
Thanks again for your helpfull suggestion.
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: Even if I set the data entry to NULL, the WriteFile still works...
But only if dwSize is equal to 0 . Otherwise it would be trying to dereference a NULL pointer."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
David, if you are reffering to the length of the data going to WriteFile I used (for test) a string of 12 characters and set the buffer to NULL.
The WriteFile returned 0, which it should.
What is weird GetLastError gets 998 and the message attached is "operation completed succesfully". But the access memory error I was getting before is gone.
Please do not spend any more time on this, I need to figure this out by myself and it is getting late.
Vaclav
PS I did not check my initial post - we are talking about the same parameter - size / length of the data.
|
|
|
|
|
Pardon me for jumping back in.
Huh? The buffer contains the string, so a string of 12 characters and set the buffer to NULL are contradictory.
For an ASCII build, I would expect something like:
char data[] = "Test";
iResult = WriteFile(m_hCOM, data, strlen(data), &dwWritten, &osWrite);
except that since you are doing this asynchronously, the crude way I just provided a buffer will not work, since its lifetime is almost certainly too short. You have to arrange a buffer ( and out parameters ) that will remain valid "long enough".
When you said I set the data entry to NULL, I understood that as meaning you did this:
iResult = WriteFile(m_hCOM, NULL, 0, &dwWritten, &osWrite); Please do not read this signature.
|
|
|
|
|
Avi,
do not apologize, I think you just give me an idea what is going on.
I know it sound crazy, but during troubleshooting this mess I just changed the data to NULL and left the rest intact - just like this:
lResult = WriteFile(m_hFile, NULL /*&pData*/ , iLen, pdwWritten,lpOverlapped);
I know it is a mess , I just keep jumping from one code to another.
Anyway, I think I need to look at the "persistence" of things, as you pointed out. I did noticed that the pdwWritten does not get immediately filled when the WriteFile returns (with correct data of course). Only after the WaitFor... event is done.
And that is the way it should work.
My priority is now on the missing ERROR_IO_PENDING "error " message.
I do not have correct setup between CreateFile and OVERLLAPED structure and even when WriteFile fails ( with 0 return) I get "Operation completed sucessfully" in GetLastError.
The irony of it is - I should be happy, but I am stubborn and want to see ERROR_IO_PENDING.
Good night
Vaclav
|
|
|
|
|
You may or may not have fixed your problem by now, but...
You use:
&pData
Now, pData sounds like a pointer to data to me... so you probably don't want the address of your pointer?
Iain.I have now moved to Sweden for love (awwww).
|
|
|
|
|
Vaclav_Sal wrote: David, if you are reffering to the length of the data going to WriteFile I used (for test) a string of 12 characters and set the buffer to NULL.
The WriteFile returned 0, which it should.
What is weird GetLastError gets 998...
When I tried your code snippet:
DWORD dwBytesWritten;
HANDLE hFile = CreateFile("c:\\file.dat", GENERIC_WRITE, 0, 0,CREATE_ALWAYS, 0, 0);
if (! WriteFile(hFile, NULL, 12, &dwBytesWritten, NULL))
DWORD dwError = GetLastError();
GetLastError() returned ERROR_INVALID_USER_BUFFER . I would expect this as I told WriteFile() to write 12 bytes but did not provide those 12 bytes."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I've written a MFC application with toolbars.
I've added the text to the toolbar and dynamically sized the toolbar to the length of the label.
I used (CBRS_TOOLTIPS | CBRS_FLYBY| CBRS_SIZE_DYNAMIC)
I set the text with the following code:
if ( !strButtonText.IsEmpty() )
{
SetButtonText( nIndex, strButtonText );
}
Where nIndex is the button's position and strButtonText is the desired text.
I've tried both the above method (commented out) where the messagebox displayed the expected result but the button on the toolbar just appears to have dropped the space i'm assuming this is because CToolBar ignores the return character.
I've also tried to //strTemp += strButtonText.left(10) + "\n" +strButtonText.mid(10, strButtonText.getLength())
With the same result("\n" is ignored).
"\r\n" also has the same result as "\n" so it would appear to not be as easy as a "\n".
So as I'm sure you've guessed by now the question is...Does anyone know a method of wrapping the label text on a CToolBar?
I would greatly appreciate any guidance.
|
|
|
|
|
Hi,
I am using QEMU (cpu emulator) to run ISO(linux) on my windows OS.
I created setup and installed. Question us this when I run from program file, program plays audio, but when I run from desktop shortcut, program does not play audio.
What might be the problem. Please suggest me.
|
|
|
|
|
Please anybody suggest me?
|
|
|
|
|
I think you are asking this at the wrong forum, rather try some QEMU related sites, maybe start at their own[^] site. This forum is for C/C++/MFC related questions.
Just a guess though, the problem might be caused because QEMU looks for some files in the current directory when starting up, which is, if you run it by doubleclicking the exe in its install-folder, the folder that contains the exe, but if you run it thorough a link, the current folder will be the location of the link and so QEMU doesn't find its files. This is -as i said- just a guess, i think if you right click on the link on your desktop and select "properties", you can set the working folder for the executable, try changing this to the folder where the exe is located. Maybe it helps, if not, then look for a QEMU-dedicated forum. Good luck.> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Thanks for reply..
I want to know with respect to a general MFC application..what might be the cause?
|
|
|
|
|
Well, one cause might be what i already mentioned, aside of that it is hard to say anything about it without knowing any details... > The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi,
Is it possible to do AES-128 bit encryption/decryption in Windows XP/2003 using CryptoAPI?
If yes, then how should I create the key for encryption and how do I share the key among other users to decrypt the content?
Are there any digital certificates involved?
I saw the CSP registry entry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype). Why a suffix "(Prototype)"?
What all are the possible methods to create and share the key?
Links to examples and other detailed documents will be useful.
Thanks in advancecheers
Varghese Paul
|
|
|
|
|
Cryptography is far too big a subject ot be covered in a tech forum like this. The answer to your main question may be found here[^]. Follow the links from this page for full description and many samples. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Richard MacCutchan wrote: Cryptography is far too big a subject ot be covered in a tech forum like this.
Hi Richard,
He only asked for samples and links and not ask someone to cover the whole thing here.
I must add that he was my ex-team lead and is an extremely talented developer (it looks like he may not have worked on cryptography though). Just thought I'd let you know.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Rajesh,
OK, comments accepted, although I did post a link that anyone could have found through Google/MSDN. As to his talents, it is impossible from his question (as with most posters) to judge his ablities abilities and/or experience.
[edit]you can judge my keyboard abilities by the number of spelling mistakes[/edit]txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
In MFC-MDI, I create Dailog in MFC-MDI Maiframe, but tell me is error.
In MFC-Dailog, create Dailog is No problem ;
Help Help Help ;
|
|
|
|