Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

Remi Morin

@Remi Morin
About
Posts
51
Topics
21
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Create a CBitmap object, draw in it, save in (.bmp file)
    R Remi Morin

    in my Document class the function serialize... I wan,t to save my data as a monochrome bitmap so I do

    void CWoopDoc::Serialize(CArchive& ar)
    {
    if (ar.IsStoring())
    {
    //I need a bitmap object
    CBitmap BitMapTemp;
    //a device context to draw on it
    CDC CBitmapDC;
    CBitmap* OldBitMap;

      //initialisation of the dc
      CBitmapDC.CreateCompatibleDC(NULL);
    

    //here I'm not sure of that... I guess

      //I create an array of bytes for the bitmap
      void \* bitmapbitstemp = malloc( Size\_X\*Size\_Y / sizeof(BYTE));
      
      //here I create the bitmap
      BitMapTemp.CreateBitmap(Size\_X,Size\_Y,1,1,bitmapbitstemp);
    
    	//I send my bitmap to the DC and save the old one
      OldBitMap = CBitmapDC.SelectObject(&BitMapTemp);
     
     //(... I draw in it)
     
      //now I wan't to save it
      
      //I need a bitmapInfoHeader and A bitMap File Header
      BITMAPFILEHEADER BmpFileH;
      BITMAPINFOHEADER bmpInfoH;
      BITMAP bm;
      BitMapTemp.GetBitmap(&bm);     //<--here I'm unable the get the bitmap bits, but the creation return true!!!
      BmpFileH.biBitCount = bm.bmBitsPixel;
      BmpFileH.biCompression = BI\_RGB;
      BmpFileH.biHeight = bm.bmHeight;
      BmpFileH.biPlanes = bm.bmPlanes;
      BmpFileH.biWidth = bm.bmWidth;
      BmpFileH.biSizeImage = BI\_RGB;
      BmpFileH.biClrUsed = 0;
      BmpFileH.biClrImportant = 2;
      BmpFileH.biXPelsPerMeter = 0;
      BmpFileH.biYPelsPerMeter = 0;
      BmpFileH.biSize = sizeof(BmpFileH);
    
      bmpInfoH.bfOffBits = sizeof(bmpInfoH)+sizeof(BmpFileH);
      bmpInfoH.bfSize = bm.bmWidthBytes;
      bmpInfoH.bfType = ('M' << 8 | 'B');
      bmpInfoH.bfReserved1 = 0;
      bmpInfoH.bfReserved2 = 0;
      
      ar.Write(&BmpFileH,sizeof(BmpFileH));
      ar.Write(&bmpInfoH,sizeof(bmpInfoH));
      //here I need to write the byte them self... but bm.bmBits are always NULL
      ar.Write(bm.bmBits,bm.bmWidthBytes);  
      
      //destroying...
      CBitmapDC.SelectObject(OldBitMap);
    
      delete bitmapbitstemp;
    

    }
    else
    {
    // TODO: add loading code here
    }
    }

    BitMapTemp.Serialize(ar); //do not work... any help will be fine... Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC com graphics data-structures help

  • Dynamic Multidimensional Array or Alternatives
    R Remi Morin

    I've try it but I have a problem with this line in debug mode int* p = (int*)::operator new(x * y * z * sizeof(int)); I'm unable to compile. this error raised E:\woop\woopDoc.cpp(827) : error C2665: 'new' : none of the 4 overloads can convert parameter 1 from type 'char [20]' In release mode it's ok it work very fine Why it dos'nt work in Debug? Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC data-structures tutorial question

  • How can I get a Date easily from users?
    R Remi Morin

    Thanks!!! It was what I'm looking for!! sorry to ask for so "beginner info" but usualsy I don't program VB. :rose: :) :) :) ;) :) :) :rose: :rose: Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    Visual Basic question com

  • How can I get a Date easily from users?
    R Remi Morin

    I'm looking from a simple Date/Time picker control, I'm unable to find it... Something like a Text box, formatted, where you can only add a valid date. Any idéa? Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    Visual Basic question com

  • CDC... I wan't the client area HOW TO
    R Remi Morin

    I have a problem to read the client area and then create my clipping region. I was doing MyDc->GetWindow()->GetClientRect(&MyRect); but when I'm printing... this function do not work... so How can I get all the client area of the Dc... any help Thanks Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC help com tutorial question

  • Static control question....
    R Remi Morin

    just two word... cut and paste 1000 times: 1000 times: I don't must write two variables in the same class with the same name. I don't must write two variables in the same class with the same name. I don't must write two variables in the same class with the same name. I don't must write two variables in the same class with the same name. ... Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC question csharp visual-studio help

  • Windows, wndproc, mouse
    R Remi Morin

    Inside you'r CView you're using a kindof a control? a CWnd derived class. This CWnd derived class Trap the mouse capture so, the event is catch by this and not by you'r cView. So you must do somthing Inside this CWnd control to handle this event and from there call you'r function anything DisplayPopupMenu(void) { } this will be call from you'r CView class AND from you'r control who diplay the animation. hope this will help Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC help

  • Dynamic Multidimensional Array or Alternatives
    R Remi Morin

    oups Dynamic Multidimensional Array are very easy to create... but harder to use. look at the creation of a 2d Array int x = 100; int y = 200; int *MyArray; MyArray = new int[x][y]; and to acces (here initialisation) you must do: int i,j; for(i=0;i

    C / C++ / MFC data-structures tutorial question

  • -- Tomasz Sowinski -- (or anyone)
    R Remi Morin

    CDialogOneDlg dlg;
    dlg.btn.SetWindowText("TEST");

    there you create a new CDialogOneDlg. You must get a pointer to you'r previous CDialogOneDlg, (CDialogOneDlg* dlg) and for this you will have to do something like

    CDialogOneDlg* p_dlg;
    p_dlg = (CDialogOneDlg*)this->GetParent();
    p_dlg->btn.SetWindowText("TEST");

    Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC help question

  • modify Icon of the MDI application
    R Remi Morin

    thanks, yes, it was just that :) ;) Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC c++ com question

  • modify Icon of the MDI application
    R Remi Morin

    I've modified the "IDR_MAINFRAME" and the "IDR_MYAPPTYPE" Icon but the modification are not show at run-time... I always see the MFC Icon dans the default Document one. Why? Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC c++ com question

  • overload operator... a begginner info
    R Remi Morin

    in msdn... I've found that I can overload many operator, += << etc. and I cannot overload . :: ?: but no example, for a struct, a class, they said that we can define them as global but when I tried to do it with the = operator.. it didn't work (I've uderstand that I need "this->data"). So, what I want it's the philosophy, my overloaded operator work but I don't think it's the way to do that...

    struct AStruct
    {
    double data[100];
    AStruct &AStruct::operator= (AStruct paramA);
    };

    It's a very beginner info I know but "overloading operator" I'm Ok, but do it well... it's may be an other thing Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC com question

  • overload operator... a begginner info
    R Remi Morin

    struct a
    {
    double Val1;
    double Val2;
    double Val3;
    }

    how do I overload the operator (+,-,*,/) and (+=,-=,*=,/=,=) I know that I will be something like

    a a::operator + (a paramA1,a paramA2)
    {
    paramA1.Val1 += paramA2.Val1;
    paramA1.Val1 += paramA2.Val1;
    paramA1.Val1 += paramA2.Val1;
    return paramA1;
    }

    but for the X= (+=,-=...) I want it clean... and I was'nt able to find the ABC of overloading operator's the rules and the basis. thanks Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC com question

  • 2-d Graphics
    R Remi Morin

    Hi, for the flickering problem you may use a memory device, a bitmap in memory that you attach to a CDC, then from thisd CDC you copy over the CDC* pDC. else you can, before drawing access to the "screen bitmap" and use it... but I've never do It. There are good tutorial in the Graphics section who may contain theses information Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC graphics help delphi question

  • ON_UPDATE_COMMAND_UI problem...
    R Remi Morin

    I used the ON_UPDATE_COMMAND_UI message in a DialogBar to display button, this fonction do nothing. It is only usefull to avoid my DialogBar to grayed my button so the message map look like this

    BEGIN_MESSAGE_MAP(CVBurnBar, CDialogBar)
    //{{AFX_MSG_MAP(CVBurnBar)
    //...other message handler
    ON_UPDATE_COMMAND_UI(IDC_Up_Normalize_AxisY, OnUpdateButton)
    ON_UPDATE_COMMAND_UI(IDC_Bottom_Normalize_AxisY, OnUpdateButton)
    ON_UPDATE_COMMAND_UI(IDC_Bottom_Adjust_Y, OnUpdateButton)
    ON_UPDATE_COMMAND_UI(IDC_Up_Adjust_Y, OnUpdateButton)
    //}}AFX_MSG_MAP
    ON_MESSAGE(WM_INITDIALOG,OnInitDialog)
    END_MESSAGE_MAP()

    and the function

    void CVBurnBar::OnUpdateButton(CCmdUI* /* pCmdUI*/)
    {}

    but theses message handler are called very often... what can I do to avoid this function to be call so often? Is there an other way to display button NOT GRAYED in a dialog bar whitout using the ON_UPDATE_COMMAND_UI. when I do MyButton.EnableWindow(true) if the ON_UPDATE_COMMAND_UI is not define for this button it is automatically grayed after 1/10 of a second... What I wan't is to display and grayed my button when I want... any idea? Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC com help question

  • CButton in a CDialogBar are disabled
    R Remi Morin

    Whit the resource editor I've created a DialogBar whit button, combo box, check box... When I wan't to enable/disable them I use the member variable I've create just for them and call theControlVariable.EnableWindow(TRUE); and it's work very fine... except for push button who become enable and immediatly after disabled... why? thanks Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    C / C++ / MFC com question learning

  • CWnd inside a COleControl does'nt work
    R Remi Morin

    Hi, I have a custom control who have child windows (CWnd) I Know it is possible because we can insert a CButton in a control, CButton is him-self a drived-class from CWnd, For CButton we have to override the OnDraw function, because this fucntion will be called (instead of the OnPaint commonly used) but this function does'nt exist in a CWnd and DrawItem dosn't seem to work... ActiveX are hard to do, lot of things to thing and to know, the exception is a rules and what you used to do don't work anymore. thanks for you'r help Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    COM com help

  • Is VC/C++ dead???
    R Remi Morin

    I was'nt able to think that "could be what kills Microsoft". Micorsoft weight on the "computer's world" is like the moon on earth. the tide and eclipse are his own. Microsoft are a powerfull king on this world an the only thing who can kill them is that we no more believe in them. If we make the choice to never used "bug free" tools then we will be able to kill then. For now then only "force the market" by the "always better and more new last update/product" Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    IT & Infrastructure csharp c++ visual-studio question learning

  • How can I see the DLLs charged in my computer
    R Remi Morin

    I wan't to find and kill a Dll loaded in my computer I've try to unload if whit regsvr32.dll /u MyDll.dll but it didn't work because Regsvr32 was unable to find the entry point. what tool can I used for this Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    IT & Infrastructure com question

  • How to create an ActiveX in a CView (MFC) help or URL or Books wanted
    R Remi Morin

    Hi to Myself, it look like anybody is able to answer me so I will (because I've find) so To create a ActiveX in a CView (just to create it to make it work properly... maybe later) First add a CWnd member in you'r class

    class MyView : public CView
    {
    //...
    CWnd m_ActiveXControl;
    //...
    //override create
    virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD
    //...
    //override On_Size
    //{{AFX_MSG(CTestViewAsAContainerView)
    afx_msg void OnSize(UINT nType, int cx, int cy);
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };

    then in the create function you must create you'r activeX control. The CWnd is the wrapper for you'r active X so you do that way :

    BOOL CTestViewAsAContainerView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
    {
    // TODO: Add your specialized code here and/or call the base class
    BOOL Ok;
    //to be sure it clip children, I didn't try without
    dwStyle |= WS_CLIPCHILDREN;
    //create the windows
    Ok = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
    //then create the control
    Ok &= m_ControlWrapper.CreateControl("MYACTIVEX.MyActiveXCtrl.1", //this string is the identifiant string that you find in the registry
    "",
    WS_VISIBLE,
    CRect(0,0,100,100), //the size of this rect don't bother, the On_Size function will size it properly
    this,
    5000, //change this for a ressource ID
    NULL,
    FALSE,
    NULL);

    return Ok;
    

    }

    then the on_size to size if

    void CTestViewAsAContainerView::OnSize(UINT nType, int cx, int cy)
    {
    CRect r;
    CView::OnSize(nType, cx, cy);
    GetClientRect(&r);
    //this function is call before the document is attach to the view, in that case
    //the size of the view is 0 so we must'not call the moveWindow function because
    //we have create this control with WS_VISIBLE (it's why we have create it with a
    //dummy rect)
    if(!r.IsRectEmpty())
    {
    m_ControlWrapper.MoveWindow(&r);
    }
    }

    so that it's thanks to myself hehehehe, Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    COM com c++ algorithms help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups