|
Thanks.
its a great job.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi,
I need to play swf file in VC++ application using flash ocx.
One condition is that, swf file should not be played if the user open the file in normal flash player. So something should be done at the flash side (I am not so clear about how to do that right now). But it should be played only from my application (A kind of protection from playing and so spreading the files discreetly).
(I am thinking about some method to pass some values to swf script. And there, if the passed value is checked and if it is OK then only allow to play the swf.)
I wish to get ideas from you. Probably some of you had gone through such a requirement...
Thank you.
|
|
|
|
|
|
Thank you...
But it is just about telling how to load the file. I can load the file by inserting the flash ocx in to my (MFC) application. There is no problem at all.
I actually need to make the swf file played only by my application. I know both the application side and the flash side need something to be done for that. So I wish to get ideas regarding this.
I am also googling for some solutions... but not got yet... so continuing the search...
|
|
|
|
|
NS17 wrote: One condition is that, swf file should not be played if the user open the file in normal flash player. So something should be done at the flash side (I am not so clear about how to do that right now). But it should be played only from my application (A kind of protection from playing and so spreading the files discreetly).
1) One method is to corrupt the file, which you know how to reverse back. All the SWF files formats start with "CWS". So modify your flash file by changing it to something like this - "CWT" or something like that. When you play the file, check whether the file starts with "CWT" and in that case reverse it to "CWS" and play. Once played, corrupt it again.
2) Another method is to encrypt the entire file and for playing in you application decrypt it back.
NS17 wrote: I need to play swf file in VC++ application using flash ocx.
Well, if you need to know how to play swf in VC++ application, then check out this tutorial - How to display Flash animation in Visual C++ MFC application[^]
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Jijo raj wrote: 1) One method is to corrupt the file, which you know how to reverse back. All the SWF files formats start with "CWS". So modify your flash file by changing it to something like this - "CWT" or something like that. When you play the file, check whether the file starts with "CWT" and in that case reverse it to "CWS" and play. Once played, corrupt it again.
2) Another method is to encrypt the entire file and for playing in you application decrypt it back.
This is a good idea...
But please don't feel bad, I would like to take this as a last resort... Because if I get some other direct method, I will follow it...
Jijo raj wrote: Well, if you need to know how to play swf in VC++ application, then check out this tutorial - How to display Flash animation in Visual C++ MFC application[^]
Actually I know how to play the swf in VC++. But have no better experience...
Thank you very much for sharing your thoughts...
|
|
|
|
|
NS17 wrote: But please don't feel bad, I would like to take this as a last resort... Wink Because if I get some other direct method, I will follow it...
No Problem mate. And I sincerely wish for someone to come with better idea!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Probably I may use your idea... no better method than this got yet...
BTW, could you tell me the basics of the way to decrypt (no need to describe about decryption methods) a file in memory than creating an actual file. I need it because if I create the temporary file in the disk, then possibility is there to get that file to the user as it is... (then he/she can play it directly)
|
|
|
|
|
NS17 wrote: I need it because if I create the temporary file in the disk, then possibility is there to get that file to the user as it is... (then he/she can play it directly)
Well, Just create the temporary file and open with flags OF_SHARE_DENY_READ and OF_SHARE_DENY_WRITE . So that no one else can read or write to your temp file. So that it will be safe from the bad guys. Once you finished, Just delete it.
Well, I'm not sure whether Memory Mapped Files[^] can help you. Well, have a look at it too.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
But I think i need to close the file for giving it to the flash ocx for playing... am i right? Because it is accepting the swf as a file.
|
|
|
|
|
Oooop! That's right. And now i got a grant Idea!!! Got for Active Data Streams[^]. Create the temp file as an ADS to some existing file. So that it will be perfectly hidden. Then, pass the filename of stream to flash OCX. I hope it should work. Just try it.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
That's good... I will have a try... Thanks a lot...
But I wish to keep this thread open to get more ideas...
|
|
|
|
|
Hi Experts,
I m working on String..
and I wanted to copy a substring from a main string
e.g:;-- String1 :- "Visual c++ is Great..";
subStr = "c++";
how can I get this???
I have used strstr() function to get substring..
but it returns first occurance and full sunstring follwing that,,
plz help me..
I need it dedly..
I used another method to get it..
but its lengthy...
thanx in advance...
Victory,...
|
|
|
|
|
If you are using CString , then use CString::Mid()[^].
CString csString = _T("Visual C++ is Great!!!");
CString csSubStr = csString.Mid( 0, 10 );
If you are using std::string then, you can use string::substr[^].
std::string sString = _T("Visual C++ is Great!!!");
std::string sSubStr = sString.substr( 0, 10 );
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Member 3220373 wrote: and I wanted to copy a substring from a main string
e.g:;-- String1 :- "Visual c++ is Great..";
subStr = "c++";
how can I get this???
I have used strstr() function to get substring..
but it returns first occurance and full sunstring follwing that,,
plz help me..
I need it dedly..
I used another method to get it..
but its lengthy...
Using CString ...
First use CString::Find and then CString::Mid to extract substring.
Using std::string
First use std::string::find and then std::string::substr .
|
|
|
|
|
Thanx for ur reply..
I forget to tell u that..
I m not using MFC classes or function.s;;;
Its just Win32 console application.....
can i use CString in console application????
plz reply..
|
|
|
|
|
Member 3220373 wrote: Its just Win32 console application.....
can i use CString in console application????
Quite easy to use MFC in console application. First link to MFC libraries and then call AfxWinInit and a global CWinApp instance, sample code...
CWinApp app;
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
cerr << "Fatal Error: MFC initialization failed" << endl;
return 1;
}
And if you are going to use MFC just for this purpose, I would discourage you from doing so, instead use std::string .
|
|
|
|
|
Thanxxxxxxxxxxxxxxxxxxxxxx...a lot.....
it works....
|
|
|
|
|
Member 3220373 wrote: Thanxxxxxxxxxxxxxxxxxxxxxx...a lot.....
Welcome!
|
|
|
|
|
Member 3220373 wrote: Its just Win32 console application.....
Then you can use strncpy() or memcpy() .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hello All,
I am working on project in VC++ which uses ado library objects to access SQL Server database and insert data into it.I am using Recordset objects.When I try to get the name of field of recordset which is of table it crashes on the following line:
_bstr_t name=field->GetName();
This crashes due to _bstr_t data type when viewed in call stack.
How to solve this problem is this a memory leak in _bstr_t???
Plz help me out.....
Thanks
|
|
|
|
|
amrit1123 wrote: _bstr_t name=field->GetName();
What does GetName() return, is it a valid string?
|
|
|
|
|
Yes ,GetName()of field object returns a valid string i.e name of column.The function has a return type of _bstr_t and i stored thefeturned string into _bstr_t type variable.e.g.
_bstr_t name=field->getName();
But the program crashes and unable to store the returned string into name variable.Plz help me out ...
Thanks
|
|
|
|
|
Yes the GetName() returns some valid string but it failed to store the returned _bstr_t string into name varaible which is also of _bstr_t type which i got while debugging the GetName() function call.
The Program shows problem while allocating memory for _bstr_t type is there any memory leak in using _bstr_t type.As i know _bstr_t does memory management by itself and we dont have to free any memory allocated.So I am unable to understand the reason why it crashes when the function return type and the variable in which it is being stored are of _bstr_t type and function is returning a valid not null string..
Can u help me out because my application is crashing coz of this.......
Waiting for ur reply
|
|
|
|
|
Hello,
Previously my code was in Visual C++ 6.0, where ON_MESSAGE was running fine, with me religiously fulfilling all its requirements, i.e. return type was LRESULT, parameters to my function were WPARAM and LPARAM. But the same code, when I converted to VS 2005, the program only compiles and the DLL gets created, but ON_MESSAGE macro seem to be failing? My user defined message does not get called at all. Is a change needed in how I write ON_MESSAGE macro? Please suggest the remedy.
thanks in advance.
Software Developer
Sanjay Khapre
|
|
|
|