|
write the constructor of form1 in that create an object of form2 and call the form2->showdiaLOG
|
|
|
|
|
G'Day Kotesh,
Can you provide sample code on where and how I would achieve this - remember this is all reasonably new to me.
Fritzables.
|
|
|
|
|
this site will help you alot in win32 programing
http://www.flounder.com/download.htm#Complete%20Win32%20CD%20Contents
click Complete Win32 CD Contents
Chinna
|
|
|
|
|
Thanks Chinna,
Much appreciated.
Pete
|
|
|
|
|
I was searching MSDN for a function that will read and output (or store) IE's history cache of visited websites, but couldn't find anything useful. I would greatly appreciate if somebody would point me in the correct direction to do this. Thank you in advance.
|
|
|
|
|
see if this[^] helps
If you think you can than you can, if you think you can't you are right.
|
|
|
|
|
|
Hi All,
I am writing a CD/DVD writing software on WinXP.I want to know what is the use of "cfgmgr32.h" header file?
And another problem is how to create ASPI layer for my software?
Thanks and Regards
Yudhisthira Attry
|
|
|
|
|
yudhisthira wrote: how to create ASPI layer for my software?
There are a number of free ASPI layers you can use. After a quick Googling I found this site:http://www.afterdawn.com/guides/archive/aspisetup.cfm[^]
I'm using Adaptec's ASPI layer in my applications. It works, even in XP, though Adaptec (appearantly) doesn't guarantee it.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
at first, please visit this topic.
http://www.codeproject.com/bitmap/drawing2bitmap.asp
and my question is below.
how to copy the bitmap data to clipboard?
Thank you in advance.
|
|
|
|
|
Check out the SetClipboardData function. To but a bitmap on the clipboard use CF_BITMAP , CF_DIB , CF_DIBV5 or CF_DIBV5 or to put a file use CF_HDROP .
Steve
|
|
|
|
|
Thank you.
yes, i already try this function and COleDataSource::SetClipboard().
but they are not work. and below is my code.
<br />
if ( OpenClipboard() )<br />
{<br />
EmptyClipboard();<br />
SetClipboardData(CF_BITMAP, m_hDrawingSurface);<br />
CloseClipboard();<br />
}
code using ole
<br />
COleDataSource* pDataSource = new COleDataSource;<br />
TRY<br />
{<br />
CSharedFile file;<br />
CArchive ar(&file,CArchive::store);<br />
BITMAPFILEHEADER bmfh; <br />
int nBitsOffset = sizeof(BITMAPFILEHEADER) + m_bmpInfoHeader.biSize; <br />
LONG lImageSize = m_bmpInfoHeader.biSizeImage;<br />
LONG lFileSize = nBitsOffset + lImageSize;<br />
bmfh.bfType = 'B'+('M'<<8); <br />
bmfh.bfOffBits = nBitsOffset; <br />
bmfh.bfSize = lFileSize; <br />
bmfh.bfReserved1 = bmfh.bfReserved2 = 0;<br />
ar.Write(&bmfh, sizeof(BITMAPFILEHEADER));<br />
ar.Write(&m_bmpInfoHeader, sizeof(BITMAPINFOHEADER));<br />
ar.Write(m_pDrawingSurfaceBits, lImageSize);<br />
ar.Close();<br />
<br />
pDataSource->CacheGlobalData(CF_DIB, file.Detach());<br />
pDataSource->SetClipboard();<br />
}<br />
CATCH_ALL(e)<br />
{<br />
delete pDataSource;<br />
THROW_LAST();<br />
}<br />
END_CATCH_ALL<br />
|
|
|
|
|
|
thank you very much, this one is work.
http://www.codeproject.com/clipboard/clipnutshell.asp
|
|
|
|
|
you're welcome I gald you find your answer;)
|
|
|
|
|
Following is the code where it success all the hr to S_OK ,But last two
which is indicated comment return (S_FAIL)failed.
can any body help me?. why is it so?
thanks in advance
<br />
WCHAR *Encoder::GenerateKeyID()<br />
<br />
{<br />
<br />
HRESULT hr;<br />
<br />
IWMWriter *m_pWriter = NULL;<br />
<br />
hr = WMCreateWriter( NULL, &m_pWriter );<br />
<br />
IWMDRMWriter *pDRMWriter = NULL;<br />
<br />
hr = m_pWriter->QueryInterface(IID_IWMDRMWriter,(void **) &pDRMWriter);<br />
<br />
DWORD d_KeyID = NULL;<br />
<br />
hr = pDRMWriter->GenerateKeyID(NULL,&d_KeyID);
<br />
WCHAR *w_KeyID = new WCHAR[d_KeyID];<br />
<br />
<br />
ZeroMemory(w_KeyID,sizeof(WCHAR)* d_KeyID);<br />
<br />
hr = pDRMWriter->GenerateKeyID(w_KeyID,&d_KeyID);
Gives S_FAIL<br />
<br />
return w_KeyID;<br />
<br />
}<br />
amit
|
|
|
|
|
|
i have already set the profile here .
<br />
HRESULT Package::EncodeMediaContent(WCHAR *pszInFile, WCHAR *pszOutFile, HWND hwndParent, string Host,string UserID, string InitPackageRequest,string ScriptFile,INTERNET_PORT Port)<br />
<br />
{<br />
Log log;<br />
HRESULT hr = S_OK;<br />
Encoder *pEncoder;<br />
IWMProfile *pIWMProfile = NULL;<br />
DWORD dwProIndex = 8;<br />
hr = CoInitialize( NULL );<br />
if( FAILED( hr ) )<br />
{<br />
return( hr );<br />
}<br />
HWND hwndCmbProfile = GetDlgItem(hwndParent,IDC_CMB_SYSTEM_PROFILE2);<br />
LRESULT SelectedDRMProfile = SendMessage(hwndCmbProfile,CB_GETCURSEL,0,0);<br />
dwProIndex = (DWORD)SelectedDRMProfile + 1;<br />
hr = Encoder::LoadSystemProfile(dwProIndex,&pIWMProfile);
if(FAILED(hr))<br />
{<br />
log.LogEntry("Package::EncodeMediaContent - Unable to load system profile.");<br />
return hr;<br />
}<br />
pEncoder = new Encoder();<br />
if(pEncoder == NULL)<br />
{<br />
log.LogEntry("Package::EncodeMediaContent - Unable to allocate memory for Encoder object.");<br />
return hr;<br />
}<br />
<br />
WCHAR *w_KeyID = Encoder::GenerateKeyID();<br />
if(wcslen(w_KeyID) > 0)<br />
{<br />
char* tempKeyID = new char[MAX_PATH];<br />
WideCharToMultiByte(CP_ACP,0,w_KeyID,-1,tempKeyID,MAX_PATH,NULL,NULL);<br />
string sKeyID = tempKeyID;<br />
log.LogEntry("Generated KeyID is: " + sKeyID);<br />
<br />
string sConfigureResponse = GenerateConfigurePackageRequest(UserID,Host,ScriptFile,Port,hwndParent,InitPackageRequest,w_KeyID);<br />
if(sConfigureResponse != "")<br />
{<br />
if(sConfigureResponse == "<ConfigPackageResponse>SUCCESS</ConfigPackageResponse>")<br />
{<br />
BOOL fMultipass = 0;<br />
LRESULT iCheck = SendMessage(hwndParent,BM_GETCHECK,0,0);<br />
if(iCheck == 0)<br />
fMultipass = 0;<br />
else<br />
fMultipass = 1;<br />
hr = pEncoder->Compress(pszInFile,pszOutFile,pIWMProfile,fMultipass,FALSE,FALSE,Host,UserID,InitPackageRequest,ScriptFile,Port,hwndParent,w_KeyID);<br />
}<br />
else<br />
hr = S_FALSE;<br />
}<br />
else<br />
{<br />
hr = S_FALSE;<br />
}<br />
}<br />
if(FAILED(hr))<br />
{<br />
log.LogEntry("Package::EncodeMediaContent - Unable to compress the file.");<br />
return hr;<br />
}<br />
return hr;<br />
<br />
}<br />
<br />
<br />
HRESULT Encoder::LoadSystemProfile(DWORD dwProfileIndex, IWMProfile **ppIWMProfile)<br />
{<br />
Log log;<br />
HRESULT hr = S_OK;<br />
IWMProfileManager * pIWMProfileManager = NULL;<br />
IWMProfileManager2 * pIWMProfileManager2 = NULL;<br />
<br />
if( NULL == ppIWMProfile )<br />
{<br />
return( E_POINTER );<br />
}<br />
<br />
do<br />
{<br />
hr = WMCreateProfileManager( &pIWMProfileManager );<br />
if( FAILED( hr ) )<br />
{<br />
break;<br />
}<br />
<br />
hr = pIWMProfileManager->QueryInterface( IID_IWMProfileManager2, <br />
( void ** )&pIWMProfileManager2 );<br />
if( FAILED( hr ) )<br />
{<br />
break;<br />
}<br />
<br />
hr = pIWMProfileManager2->SetSystemProfileVersion( WMT_VER_8_0 );<br />
if( FAILED( hr ) )<br />
{<br />
break;<br />
}<br />
<br />
hr = pIWMProfileManager->LoadSystemProfile( dwProfileIndex,ppIWMProfile );<br />
if( FAILED( hr ) )<br />
{<br />
<br />
log.LogEntry("Unable to load system profile");<br />
break;<br />
}<br />
}<br />
while( FALSE );<br />
<br />
SAFE_RELEASE( pIWMProfileManager2 );<br />
SAFE_RELEASE( pIWMProfileManager );<br />
<br />
return( hr );<br />
}<br />
<br />
amit
|
|
|
|
|
I see it loaded but not set in the writer with SetProfile().
Am I missing it somewhere?
|
|
|
|
|
well actully in the doc i have read the following.
Calling this method removes any previously set header attribute information.
Changes to the profile object made after this method is called do not take effect until SetProfile is called again.
so i think might be used previosly set. is it neccessary to set ? becasuse before it. it works fine then i have little change in the GUI and now its not worked.
i have setprofile in the createwrite function which call from compress function
Please check the function(Compress) with the previos code which call from their.
you might forget the link.
<br />
<br />
HRESULT Encoder::CreateWriter( const WCHAR * pwszOutputFile, IWMProfile * pProfile )<br />
{<br />
Log log;<br />
HRESULT hr = S_OK;<br />
<br />
hr = WMCreateWriter( NULL, &m_pWriter );<br />
if( FAILED( hr ) )<br />
{<br />
log.LogEntry("Encoder::CreateWriter() - Unable to create the writer object.");<br />
return( hr );<br />
}<br />
hr = m_pWriter->QueryInterface( IID_IWMHeaderInfo, (void **)&m_pWriterHeaderInfo );<br />
if( FAILED( hr ) )<br />
{<br />
log.LogEntry("Encoder::CreateWriter() - Unable to get the pointer of IWMHeaderInfo interface.");<br />
return( hr );<br />
}<br />
<br />
hr = m_pWriter->SetProfile( pProfile );<br />
if( FAILED( hr ) )<br />
{<br />
log.LogEntry("Encoder::CreateWriter() - Unable to set the profile for the writer.");<br />
return( hr );<br />
}<br />
<br />
<br />
<br />
hr = m_pWriter->SetOutputFilename( pwszOutputFile );<br />
if( FAILED( hr ) )<br />
{<br />
log.LogEntry("Encoder::CreateWriter() - Unable to set the output file name.");<br />
return( hr );<br />
}<br />
return( hr );<br />
}<br />
//here is the function below
<br />
<br />
<br />
HRESULT Encoder::Compress(WCHAR *pwszInputFile,WCHAR * pwszOutputFile,<br />
IWMProfile * pProifle,<br />
BOOL fMultiPass,<br />
BOOL fMultiChannel,<br />
BOOL fSmartRecompression,string Host,string UserID,string InitPackageRequest,string ScriptFile,INTERNET_PORT Port, HWND hwndParent, WCHAR *w_KeyID )<br />
{<br />
Log log;<br />
HRESULT hr = S_OK;<br />
<br />
m_hEvent = NULL;<br />
m_pReader = NULL;<br />
m_pReaderAdvanced = NULL;<br />
m_pReaderHeaderInfo = NULL;<br />
m_pReaderProfile = NULL;<br />
m_pWriter = NULL;<br />
m_pWriterPreprocess = NULL;<br />
m_pWriterHeaderInfo = NULL;<br />
m_pdwPreprocessPass = NULL;<br />
m_pdwOutputToInput = NULL;<br />
m_pdwOutputToStream = NULL;<br />
<br />
if( NULL == pwszInputFile || NULL == pwszOutputFile || NULL == pProifle )<br />
{<br />
return E_INVALIDARG;<br />
}<br />
do<br />
{<br />
m_hEvent = CreateEvent( NULL, FALSE, FALSE, NULL );<br />
if( NULL == m_hEvent )<br />
{<br />
hr = HRESULT_FROM_WIN32( GetLastError() );<br />
log.LogEntry("Encoder::Compress() - Create Event failed");<br />
break;<br />
}<br />
hr = CreateReader( pwszInputFile );<br />
if( FAILED( hr ) )<br />
{<br />
log.LogEntry("Encoder::Compress() - Could not create the reader for the file.");<br />
break;<br />
}<br />
hr = CreateWriter( pwszOutputFile, pProifle );<br />
if( FAILED( hr ) )<br />
{<br />
log.LogEntry("Encoder::Compress() - Could not create the writer for the file.");<br />
break;<br />
}<br />
<br />
then how shoud i set my profile can u help me ?
and send me the link please.
|
|
|
|
|
Did you see step 3 on the link I appended to my first reply?
Mark
|
|
|
|
|
have you checked my previous comment.in that i have written some thing specific please read it. according your guidline i have add the profile object in the
following function.
i dont understand even who it works when it is NULL,
OR how can i set the value of profile ?
please give me guidline with code.
i am not sure but i have write it and it gives E_INVALIDARG.
<br />
WCHAR *Encoder::GenerateKeyID()<br />
{<br />
<br />
HRESULT hr;<br />
IWMWriter *m_pWriter = NULL;<br />
IWMProfile* pProfile=NULL;<br />
hr = WMCreateWriter( NULL, &m_pWriter );<br />
<br />
IWMDRMWriter *pDRMWriter = NULL;<br />
<br />
hr = m_pWriter->QueryInterface(IID_IWMDRMWriter,(void **) &pDRMWriter);<br />
hr=m_pWriter->SetProfile(pProfile);<br />
DWORD d_KeyID = NULL;<br />
hr = pDRMWriter->GenerateKeyID(NULL,&d_KeyID);<br />
WCHAR *w_KeyID = new WCHAR[d_KeyID];<br />
ZeroMemory(w_KeyID,sizeof(WCHAR)* d_KeyID);<br />
hr = pDRMWriter->GenerateKeyID(w_KeyID,&d_KeyID);<br />
return w_KeyID;<br />
}
i have change my code with the following also but it still give me the E_FAIL.
<br />
<br />
HRESULT Package::EncodeMediaContent(WCHAR *pszInFile, WCHAR *pszOutFile, HWND hwndParent, string Host,string UserID, string InitPackageRequest,string ScriptFile,INTERNET_PORT Port)<br />
{<br />
Log log;<br />
HRESULT hr = S_OK;<br />
Encoder *pEncoder;<br />
IWMProfile *pIWMProfile = NULL;<br />
DWORD dwProIndex = 8;<br />
hr = CoInitialize( NULL );<br />
if( FAILED( hr ) )<br />
{<br />
return( hr );<br />
}<br />
HWND hwndCmbProfile = GetDlgItem(hwndParent,IDC_CMB_SYSTEM_PROFILE2);<br />
LRESULT SelectedDRMProfile = SendMessage(hwndCmbProfile,CB_GETCURSEL,0,0);<br />
dwProIndex = (DWORD)SelectedDRMProfile + 1;<br />
hr = Encoder::LoadSystemProfile(dwProIndex,&pIWMProfile); <br />
if(FAILED(hr))<br />
{<br />
log.LogEntry("Package::EncodeMediaContent - Unable to load system profile.");<br />
return hr;<br />
}<br />
<br />
IWMWriter *m_pWriter = NULL;<br />
hr = WMCreateWriter( NULL, &m_pWriter );<br />
<br />
IWMDRMWriter *pDRMWriter = NULL;<br />
<br />
hr = m_pWriter->QueryInterface(IID_IWMDRMWriter,(void **) &pDRMWriter);<br />
hr= m_pWriter->SetProfile(pIWMProfile);<br />
<br />
<br />
if(FAILED(hr))<br />
{<br />
log.LogEntry("Package::EncodeMediaContent - Unable to set profile.");<br />
return hr;<br />
}<br />
<br />
<br />
pEncoder = new Encoder();<br />
if(pEncoder == NULL)<br />
{<br />
log.LogEntry("Package::EncodeMediaContent - Unable to allocate memory for Encoder object.");<br />
return hr;<br />
}<br />
WCHAR *w_KeyID = Encoder::GenerateKeyID();<br />
if(wcslen(w_KeyID) > 0)<br />
{<br />
char* tempKeyID = new char[MAX_PATH];<br />
WideCharToMultiByte(CP_ACP,0,w_KeyID,-1,tempKeyID,MAX_PATH,NULL,NULL);<br />
string sKeyID = tempKeyID;<br />
log.LogEntry("Generated KeyID is: " + sKeyID);<br />
<br />
<br />
<br />
<br />
<br />
<br />
-- modified at 7:25 Thursday 11th January, 2007
|
|
|
|
|
amitmistry_petlad wrote: have you checked my previous comment
I see all your replies - I had to sleep a bit. It was around midnight here my last posts
The code in the other reply looked ok. You need to create the writer, set its profile, and then
set the DRM key. Maybe call your GenerateKeyID() after creating the writer (from your CreateWriter() function?, after setting the profile). Pass the created writer object to
GenerateKeyID() instead of creating another writer object there.
Mark
|
|
|
|
|
Dear Mark ,
thanks for replay me actually been waiting for your replay then i left the office
ok fine ,but have you checked my code and understood function flow properly or i should give you the flow of my functions.
bcoz its real needed otherwise might be wrong somewhere.
please checked compare an clear the flow.
try to set the profile two way one is inside the generatekeyID()
and second is before the function called.
EncodeMediaContent()
{
LoadSystemProfile();
//here set prfile //write now this is active
generatekeyID();//also inside this function also setprofile inactive
GenerateConfigurePackageRequest();// the last param use the generated key
if the response return success from the server
compress() //call and inside this CreateWrite call and the protect file call
}
please checked all this
the one and most important question is on which base the key generated on the client machine.
means how this GenerateKeyID() genreate this w_KeyID=L"mXMzxuQy8PEkwSgv2gcfEA=="; //demo value
type of value.
yet i am unable to generated w_KeyID.
please help me !!
amit
|
|
|
|
|
the one and most important question is on which base the key generated on the client machine.
means how this GenerateKeyID() genreate this w_KeyID=L"mXMzxuQy8PEkwSgv2gcfEA=="; //demo value
type of value.
Please can you explain me in depth.
sorry for distrubing you mid night!!!
amit
|
|
|
|
|