Click here to Skip to main content
16,007,472 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CToolBar question... Pin
Jamie Hale22-Feb-02 5:20
Jamie Hale22-Feb-02 5:20 
GeneralRe: CToolBar question... Pin
Jon Hulatt22-Feb-02 6:05
Jon Hulatt22-Feb-02 6:05 
GeneralCListBox colors Pin
Stevieslu22-Feb-02 5:17
Stevieslu22-Feb-02 5:17 
GeneralRe: CListBox colors Pin
Paul M Watt22-Feb-02 5:23
mentorPaul M Watt22-Feb-02 5:23 
GeneralRe: CListBox colors Pin
Mazdak22-Feb-02 5:21
Mazdak22-Feb-02 5:21 
GeneralPROP_ENTRY ( ATL) ( agaaaain :-) ) Pin
Braulio Dez22-Feb-02 4:30
Braulio Dez22-Feb-02 4:30 
GeneralRe: PROP_ENTRY ( ATL) ( agaaaain :-) ) Pin
Joao Vaz22-Feb-02 5:14
Joao Vaz22-Feb-02 5:14 
GeneralRe: PROP_ENTRY ( ATL) ( agaaaain :-) ) Pin
Braulio Dez22-Feb-02 5:30
Braulio Dez22-Feb-02 5:30 
Hi Joao !

Thanks, for the tip, but for the DISPID_PICTURE, I need to set a property with a dispatch pointer isn´t it ?, mmm... the problem that I have is that the pointer that contains the metafile can be NULL Frown | :-( , sorry but I don´t understand too much the prop_entry for saving com objects.

I have tried a dirty way:

In my .H file I have:
CComQIPtr<ipicture> _Pict; // Better to use smart pointers, just forget about AddRef, Release, QInterface...

TO LOAD
HRESULT IPersistStreamInit_Load(LPSTREAM pStm, ATL_PROPMAP_ENTRY* pMap)
{
   // ------------- TRYING TO LOAD THE IPICTURE
   CComPtr<IPictureDisp> pic;
   LARGE_INTEGER l;
   l.QuadPart  =0;
   pStm->Seek(l, STREAM_SEEK_SET, NULL);


   OleLoadPicture(pStm, l.LowPart, FALSE, IID_IPictureDisp, (void **) &pic);
   if(pic) {
      _Pict = pic;
   }
   // -------------


   HRESULT hr = MyAtlIPersistStreamInit_Load(pStm, pMap, this,
                   (IUnknown*)(IDispatch*)this);
   if (SUCCEEDED(hr))
      m_bRequiresSave = FALSE;
   return hr;
}


TO SAVE:
HRESULT IPersistStreamInit_Save(LPSTREAM pStm, BOOL fClearDirty,
        ATL_PROPMAP_ENTRY* pMap)
{
   // ------------- TRYING TO SAVE THE IPICTURE
   if(_Pict) {
      CComQIPtr<IPersistStream> p = _Pict;

      p->Save(pStm, FALSE);
   }
   // -------------


   return MyAtlIPersistStreamInit_Save(pStm, fClearDirty, pMap, this,
                   (IUnknown*)(IDispatch*)this);
}


It seems to work, but I´m not sure if it´s a time bomb Smile | :) , what do you think about it ?, Thanks a lot Joao, Bye !
Braulio
GeneralRe: PROP_ENTRY ( ATL) ( agaaaain :-) ) Pin
Joao Vaz22-Feb-02 5:56
Joao Vaz22-Feb-02 5:56 
GeneralRe: PROP_ENTRY ( ATL) ( agaaaain :-) ) Pin
Braulio Dez22-Feb-02 6:05
Braulio Dez22-Feb-02 6:05 
GeneralRe: PROP_ENTRY ( ATL) ( agaaaain :-) ) Pin
Joao Vaz22-Feb-02 6:25
Joao Vaz22-Feb-02 6:25 
QuestionWhich is The Best Way To Do It ??? Pin
Jon Hulatt22-Feb-02 4:30
Jon Hulatt22-Feb-02 4:30 
AnswerRe: Which is The Best Way To Do It ??? Pin
Braulio Dez22-Feb-02 4:32
Braulio Dez22-Feb-02 4:32 
AnswerRe: Which is The Best Way To Do It ??? Pin
Mazdak22-Feb-02 4:39
Mazdak22-Feb-02 4:39 
AnswerRe: Which is The Best Way To Do It ??? Pin
Not Active22-Feb-02 4:41
mentorNot Active22-Feb-02 4:41 
AnswerRe: Which is The Best Way To Do It ??? Pin
Joaquín M López Muñoz22-Feb-02 4:43
Joaquín M López Muñoz22-Feb-02 4:43 
GeneralRe: Which is The Best Way To Do It ??? Pin
Jon Hulatt22-Feb-02 4:48
Jon Hulatt22-Feb-02 4:48 
GeneralRe: Which is The Best Way To Do It ??? Pin
Nish Nishant22-Feb-02 5:21
sitebuilderNish Nishant22-Feb-02 5:21 
GeneralRe: Which is The Best Way To Do It ??? Pin
Jon Hulatt22-Feb-02 6:00
Jon Hulatt22-Feb-02 6:00 
GeneralRe: Which is The Best Way To Do It ??? Pin
Tim Smith22-Feb-02 6:21
Tim Smith22-Feb-02 6:21 
GeneralRe: Which is The Best Way To Do It ??? Pin
Paul M Watt22-Feb-02 6:24
mentorPaul M Watt22-Feb-02 6:24 
GeneralRe: Which is The Best Way To Do It ??? Pin
Paul M Watt22-Feb-02 6:27
mentorPaul M Watt22-Feb-02 6:27 
GeneralRe: Which is The Best Way To Do It ??? Pin
Ravi Bhavnani22-Feb-02 6:42
professionalRavi Bhavnani22-Feb-02 6:42 
AnswerRe: Which is The Best Way To Do It ??? Pin
Stephen C. Steel22-Feb-02 10:11
Stephen C. Steel22-Feb-02 10:11 
GeneralVC++ .NET Release Debug Question... Pin
JoeSox22-Feb-02 3:40
JoeSox22-Feb-02 3:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.