|
iLL eFFect wrote: in this case i can only launch mp3s... or sond files. but wat incase winamp is not insatlled. or the u want to launch .doc... then wat?
wat i see as a solution is to look in registry as to wat is the default applcation is for the type of file and then launch that application(that too after searching for its path in registry) with the file name as parameter.
HKEY_CLASSES_ROOT\mp3file\shell\open\command
here you get the application associated with your MP3 File so simply search for other file types for launching the files.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
iLL eFFect wrote: somehow VS gives me error if i "open" is not associated with (LPCWSTR)
The second parameter is the operation if it is NULL then
For systems prior to Microsoft® Windows® 2000, the default verb is used if it is valid and available in the registry. If not, the "open" verb is used.
For Windows 2000 and later systems, the default verb is used if available. If not, the "open" verb is used. If neither verb is available, the system uses the first verb listed in the registry.
-referenced from MSDN.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
iLL eFFect wrote: 1. somehow VS gives me error if i "open" is not associated with (LPCWSTR)
Perhaps if you indicated what the error was, we could be of more help.
iLL eFFect wrote: 2. c:\\airplane.jpg this image did not launch
Why would you expect it to if you got a compiler error?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
iLL eFFect wrote: hanks for all your comments i tried to run the undermentioned code.
::ShellExecute(NULL, (LPCWSTR)"open", (LPCWSTR)"iexplore.exe", NULL, NULL, SW_SHOWNORMAL);
it didnt work as i thought it would. secondly, it seems that it is meant for html file. whereas i am trying to do it for mp3s
please help
::ShellExecute(NULL, "open", (LPCWSTR)"//Your exe here//", // your MP3 path here///, NULL, SW_SHOWNORMAL);
"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
Support CRY- Child Relief and You
|
|
|
|
|
|
for the second time, read this[^] post in a previous thread of yours...
notice that i don't directly open the exe but the file to be opened in its default application.
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
iLL eFFect wrote: it didnt work as i thought it would.
What didn't work? What did it return?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
let me explain with an example:
BYTE* pbyte1 = new BYTE();
delete [] pbyte1;
The second line is suppsed to be just :
delete pbyte1;
So herez my question:
is there anything wrong with using the '[]' alongside teh delete operator even though the dynamically created variable is not of array type?
|
|
|
|
|
by using delete[] you are able to delete the memory occupied by the complete array.
in addition you can also assign a NULL to pByte1 . Clear to prevent using invalid memory reference.
Its the best way.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 7:14 Tuesday 13th June, 2006
|
|
|
|
|
delete [] calls the constructer for each object of the array.
here you have created only one object of the BYTE.
so prefer second one.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
When you use [] you are deleting the array.
and using the just delete pbyte you are deleting the pointer
and dont forget to set the pinter to NULL
Cheers
"Peace of mind through Technology"
-- modified at 7:14 Tuesday 13th June, 2006
|
|
|
|
|
namaskaaram wrote: BYTE* pbyte1 = new BYTE();
delete [] pbyte1;
IMHO, i better use Auto_ptr to deal with these problem!
"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
Support CRY- Child Relief and You
|
|
|
|
|
thanx everybody for that quick reply!...
but the question i have asked still remains unanswered!
is there any problem(like mem leak, or unexpected error)when i use 'delete []' for an object that is not created as array?????
|
|
|
|
|
See my post for the thread.
delete x ; //works for a single object
delete[] x; // deletes the complete array
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
dude!!!!!
u havent read my question! ;o)
i havent asked which to use.
My question is :whether there is a prob when 'delete []' is used to non-array type objects??
please do read the question !!!!
|
|
|
|
|
namaskaaram wrote: My question is :whether there is a prob when 'delete []' is used to non-array type objects??
Do you got any problem while using delete [] ??? if so what is the problem??
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
well just want to know if its handled by the delete operator !!!..
just inquisitive!
|
|
|
|
|
a class’ destructor, doesn’t know what the array’s size is;
(Initially delete had two arguments also.)
it only knew that its sole argument is a pointer to an array. Furthermore, a programmer might mistakenly pass the wrong size of the array to delete[]. C++ creators realized this and decided to eliminate the size argument. However, they have kept the distinction between delete and delete[].
So when you use delete[] to delete the single object using delete[] p only one object gets destroyed so no problems with that else if p is an array the whole array gets destroyed.
Does this answer your question now?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
finally! ...hehe..just kidding!
nice answer bro!....
cheerz!
|
|
|
|
|
Quick answer: yes you'll have problems. new and new[] are not doing the same thing and if you mismatch that with delete and delete[], you'll be in troubles.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
r u sure cedric?..coz i have got a contradictory answer from an above post! ...hmm...
actually i did debug!....didnt find any probz1...but i just aint quite sure if itz ok or not!....
hmmm..
-- modified at 7:43 Tuesday 13th June, 2006
|
|
|
|
|
hi Cedric,
Can you just brief me on what problem would be there if I use delete[] to delete a single object?
I just read that using the delete[] method is the best way to delete an object as it deletes the memory associated with the array or the object completely
Thanks anyways I got the answer in Viorel's post
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 7:50 Tuesday 13th June, 2006
|
|
|
|
|
Because delete[] expects the number of items in your array to be just before the address of the first element. This value is not present when you use new. Thus, you will have some problems because you first try to read the number of items where you shouldn't.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
_AnShUmAn_ wrote: delete x ; //works for a single object
delete[] x; // deletes the complete array
He's already indicated he knows the difference. Read his original question again.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
and you guess what,
you didn't follow what the rest of the posts were for ?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|