|
If you are opening Text File why Not go for CStdioFile and CFile class.. Thats work well with The Text or binay file!...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Anonymous wrote: Is it coz the pointer goes to end of the file???
No
The reason is ReadFile doesnot allocate memory for szBuffer .
Use this code
DWORD buff;
TCHAR szBuffer[SOME_SIZE] ;
HANDLE hr = CreateFile(L"c:\\a.txt",FILE_READ_DATA,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
ReadFile(hr,szBuffer,SOME_SIZE,&buff,NULL);
-- modified at 9:15 Friday 21st October, 2005
|
|
|
|
|
prasad_som wrote: ReadFile(hr,&szBuffer,SIZE,&buff,NULL);
Check the second and third parameters. They should be:
ReadFile(hr, szBuffer, sizeof(szBuffer), &buff, NULL);
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Check the second and third parameters
yes, thanks David.Its corrected now.
|
|
|
|
|
Hello guys,
I have a MFC dialog based application , where I want to play *.avi files.
Suppose I have a button "Load video" and after clicking it and choosing the specified *.avi file , I want to be able to play(pause,stop) the video in my dialog.
Any suggestions on how to do it?
PS. I had problems with CAnimateCtrl , When I tried to Open the file :
if(!m_animate.Open("c:\\file.avi"))
MessageBox("Could not open video");
I got the latter MessageBox. Though file.avi existed on C: disk.
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
-- modified at 7:44 Friday 21st October, 2005
|
|
|
|
|
Just a check.
Does file runs in media player?
Do you have necessary rights on file?
|
|
|
|
|
prasad_som wrote:
Does file runs in media player?
yes it does.
But is not there another way to play *.avi files without using CAnimateCtrl
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
why dont u try using windows media player activex control
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
I do not have any experience with using ActiveX controls.
Could you give me little tips on how to do this, I am using Visual Studio.Net 2003.
Thanks in advance
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
in the dialog editor view, right click on the tool bar panel, choose add/remove items. on the next dialog, choose com components tab and tick windows media player in the list. click ok and then u can use it like any other control.
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
thanks for help , but on little thing more.
i have done everything but when I write m_player.openPlayer("c:\\file.avi"); New instance of MediaPlayer is opened and the file is played there.
But I need the video to be played inside my dialog so I thought this should do the job :
m_player.launchURL("c:\\file.avi");
But I get a error MessageBox with empty text
Do you have any idea what is wrong??
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
-- modified at 8:59 Friday 21st October, 2005
|
|
|
|
|
Giorgi Moniava wrote: Do you have any idea what is wrong??
Yes, you need to use the setURL() method.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
CAnimateCtrl::Open() simply sends a ACM_OPEN message to the control. Per MSDN, that message will fail if the .avi file contains any audio. Do you think this is the case?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote:
CAnimateCtrl::Open() simply sends a ACM_OPEN message to the control. Per MSDN, that message will fail if the .avi file contains any audio. Do you think this is the case?
Yes David now I took a better look in MSDN and found :
"Open does not support sound in an AVI clip; you can open only silent AVI clips"
And my video of course contains audio.
Then can you help me with opening and playing *.avi - s with audio?
Thanks in advance
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
I think you might have to consider using one of the ActiveX controls (e.g., Windows Media Player from wmp.dll, Microsoft Multimedia Control from mci32.ocx).
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Yes I tried but I get strange errors.
Look at my posts with "The NULL DEVELOPER".
Maybe you know whats the problem,
thanks
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
HI,
wat is the method to insert into a coloumn of a listcontrol is it a must to uses Insertitem(,,,) for that row inorder to use the insertion into the repective coloumn header .
Thanx
FarPointer
|
|
|
|
|
Use CListCtrl::SetItemText(..)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
i am writing one multithreading application using MFC library . i am not able to test my applcation. can you tell me how i test multithreading application of MFC.or any tool for testing?
|
|
|
|
|
you mean multi threaded, or many exes that are talking together ?
if multithreaded, just run your program, set breakpoints, see what happens...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I want to test multithreaded in serial comunication .how to test serial comm.application
|
|
|
|
|
may be this is my last question for my minithesis, before i graduate (i hope)
function A runing when a press button "start", how i can stop function A when it still running by press button "stop"
|
|
|
|
|
you will have to deport the actions performed by function A into a worker thread so that the GUI is not frozen, and you will so be able to press a STOP button to end the treatments...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
And to complete the response of toxcct: your function need also to be 'finishable'. That is, a kind of loop you can ask to terminate. Something like this:
while (bContinue)<br />
{<br />
};
Then, you can stop your function by setting bContinue to false. But be carefull when doing that, you'll have to secure the access to those 'shared' variable inside critical sections (take a look at MSDN for more details).
Of course, there is still the solution to kill your worker thread but that's not really an elegant solution
|
|
|
|
|