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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
R

Rafael Fernandez Lopez

@Rafael Fernandez Lopez
About
Posts
98
Topics
31
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • dependant #warning
    R Rafael Fernandez Lopez

    You're just right. In that case the #warning message wouldn't be showed, and my class would't be able to provide a true deep copy, but in that case, and only in that case, the problem (the main trouble) would be that the developer that wrote it was wrong, because didn't think about implementing Clone() method to provide a deep copy. We sometimes just have to trust in developers that are gonna use our classes, so we cannot do more than we are doing right now. Far away, you're right, my warning would not appear when compiling. Thank you for your comments Josh. ;)


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C# data-structures performance help question

  • dependant #warning
    R Rafael Fernandez Lopez

    Well, a clean output for clean designs. If your design (in this case, MY DESIGN) has troubles (if the class is not ICloneable), and the object that you think that is for sure can be modified by side-effects (if I wasn't able to call Clone(), then I copied the memory address), there must be a WARNING to let the programmer know that he has to be *VERY CAREFUL* with the original object, or make that class ICloneable, so warning message *WILL DISSAPEAR*. Well, if he does well, there will be 0 errors, 0 warnings. ;) Cheers !!


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C# data-structures performance help question

  • dependant #warning
    R Rafael Fernandez Lopez

    Hi, I've got a generic class (Binary Tree) public class ABB : ICloneable where T : IComparable/*, ICloneable*/ { . . . } I adapted it so items that are not ICloneable can be introduced into the tree, but if they are not ICloneable and they are not like (int, float...), because is another class that is not ICloneable, I'd like to print a: #warning If the object is modified after introducing it into the tree, the object that the tree has saved will be changed too (if T is not a primitive type). If you wan't to solve this, make the class T implement ICloneable methods, and a copy of the original object will be saved into the tree, instead of copying its memory address (as is happening right now). But this warning only MUST BE SHOWED if the class T that has been instantiated like: ABB object = new ABB(); Well, it would be showed with old types too (int, float...) but there's no problem since it is a copy of the original type what is introduced onto the tree (as the warning says). As this: ABB object = new ABB(); Well, int is not ICloneable, but there's no problem with it. THANK YOU.

    C# data-structures performance help question

  • Painting bad issues (GDI)
    R Rafael Fernandez Lopez

    Well if you're curious, here you are: ImagenTransparente.cpp // ImagenTransparente.cpp: archivo de implementación // #include "stdafx.h" #include "Transparencia.h" #include "ImagenTransparente.h" #include ".\imagentransparente.h" // ImagenTransparente IMPLEMENT_DYNAMIC(ImagenTransparente, CStatic) ImagenTransparente::ImagenTransparente(int nID, BYTE transparencia /* = 0x7f (50%) */) { bm.LoadBitmap(nID); bm.GetBitmap(&BitMap); m_nWidth = BitMap.bmWidth; m_nHeight = BitMap.bmHeight; bf.AlphaFormat = 0; bf.BlendFlags = 0; bf.BlendOp = AC_SRC_OVER; bf.SourceConstantAlpha = transparencia; this->nID = nID; } ImagenTransparente::~ImagenTransparente() { } BEGIN_MESSAGE_MAP(ImagenTransparente, CStatic) ON_WM_CREATE() ON_WM_PAINT() ON_WM_ERASEBKGND() ON_WM_MOVE() END_MESSAGE_MAP() // Controladores de mensajes de ImagenTransparente int ImagenTransparente::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CStatic::OnCreate(lpCreateStruct) == -1) return -1; CRect rect; GetWindowRect(&rect); GetParent()->ScreenToClient(&rect); miPosicion.left = rect.left; miPosicion.right = rect.right; miPosicion.top = rect.top; miPosicion.bottom = rect.bottom; this->izquierda = rect.left; this->arriba = rect.top; CClientDC dc(this); CDC MemDC; MemDC.CreateCompatibleDC(&dc); CBitmap MemBmp; MemBmp.CreateCompatibleBitmap(&dc, m_nWidth, m_nHeight); CBitmap *pOldMemBmp = MemDC.SelectObject(&MemBmp); CDC MemDC2; MemDC2.CreateCompatibleDC(&dc); CBitmap *pOldbmp = MemDC2.SelectObject(&bm); MemDC.BitBlt(0, 0, m_nWidth, m_nHeight, &MemDC2, 0, 0, SRCCOPY); MemDC2.SelectObject(pOldbmp); dc.AlphaBlend(0, 0, m_nWidth, m_nHeight, &MemDC, 0, 0, m_nWidth, m_nHeight, bf); MemDC.SelectObject(pOldMemBmp); return 0; } void ImagenTransparente::OnPaint() { CPaintDC dc(this); // device context for painting CDC MemDC; MemDC.CreateCompatibleDC(&dc); CBitmap MemBmp; MemBmp.CreateCompatibleBitmap(&dc, m_nWidth, m_nHeight); CBitmap *pOldMemBmp = MemDC.SelectObject(&MemBmp); CDC MemDC2; MemDC2.CreateCompatibleDC(&dc); CBitmap *pOldbmp = MemDC2.SelectObject(&bm); MemDC.BitBlt(0, 0, m_nWidth, m_nHeight, &MemDC2, 0, 0, SRCCOPY); MemDC2.SelectObject(pOldbmp); //dc.BitBlt(0, 0, m_nWidth, m_nHeight, &MemDC, 0, 0, SRCCOPY); dc.AlphaBlend(0, 0, m_nWidth, m_nHeight, &MemDC, 0, 0, m_nWidth, m_nHeight, bf); MemDC.SelectObject(pOldMemBmp); } BOOL ImagenTransparente::OnEraseBkgnd(CDC* p

    C / C++ / MFC csharp visual-studio com graphics help

  • Painting bad issues (GDI)
    R Rafael Fernandez Lopez

    Hi, If you can download the project, and help me in some way... is only a class and its goal es mainly: * To have an image at the back (alphablended with AlphaBlend function), and if the window receive ScrollWindow() messages, to don't move. It work all right, but if I've some controls on it, they will be drawn on the alphablended image, so if you move the window, later it will be visible. Just open the zip, compile it (I've Visual Studio .NET 2003), and press "ACCEPT" to load the alphablended image, and you must press "CANCEL" several times to make the window scroll. I'm new to GDI, and maybe there are lots of things very bad. I will appreciate a lot your comments, to learn more. Here you can download the file !! THANK YOU VERY MUCH !!!


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC csharp visual-studio com graphics help

  • Placing transparent bitmaps into dialogs
    R Rafael Fernandez Lopez

    Hi, I want to put a semi-transparent bitmap into my dialog, and I've the following code: BLENDFUNCTION bf; bf.AlphaFormat = 0; bf.BlendFlags = 0; bf.BlendOp = AC_SRC_OVER; bf.SourceConstantAlpha = 0x7f; CRect rect; GetDlgItem(IDC_PRUEBA_TRANS)->GetWindowRect(&rect); CClientDC dc(this); CDC dcMem; dcMem.CreateCompatibleDC(&dc); AlphaBlend(GetDlgItem(IDC_PRUEBA_TRANS)->GetDC()->GetSafeHdc(), 0, 0, rect.Width(), rect.Height(), dc, 0, 0, rect.Width(), rect.Height(), bf); This code purpose was to test if AlphaBlend is working all-right with my dialog, and it seem that it does. Now my problem is: I've bitmaps as "BITMAPS" in my resource file. IDC_PRUEBA_TRANS is a CStatic Ctrl with Bitmap enabled and a Bitmap loaded through designer (not code). If I do such: AlphaBlend(dc, 0, 0, rect.Width(), rect.Height(), dcMem, 0, 0, rect.Width(), rect.Height(), bf); The transparent bitmap will be drawn on the opaque one, so the transparency will not be visible (for that reason, I tried to put a form shot into IDC_PRUEBA_TRANS, to test it). So I'd like to know how can I get a CDC from a CBitmap or whatever way of do this thing... Thank you, Rafael Fernández López.


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC com graphics help question learning

  • HOW TO DETECT MEMORY LEAKS
    R Rafael Fernandez Lopez

    Hi, I am using Visual Studio .NET 2003. I'd like to know if there is some way to run a memory leak checker (like CodeGuard in Borland C++). Thank you, Rafael Fernández López.


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC csharp c++ delphi visual-studio com

  • About barcodes and displays
    R Rafael Fernandez Lopez

    Hi !! I'm developing an app for a computer store. It can draw some barcodes (thanks to the manual on this site) and now what I want is to know how to send to the display that shows the article and price when the barcode reader reads article's barcode. Display must be at COM1. Thanks !!


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC com tutorial

  • Loving Linux
    R Rafael Fernandez Lopez

    What do you think about Linux? Do you use Linux for programming? Have you ever heard about Mono project? .NET strategy is working now under Linux. What do you think about that? Thanks. :)


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC csharp com linux question discussion

  • Linux Programming
    R Rafael Fernandez Lopez

    It was only an example, that function sets the cursor to the column and file wherever you want to go. But I would like to know how can I call the documentation about programming... I tried "man gcc" and it told me lots of things but there's anything about all the allowed functions and so on. I'm programming under downloaded Linux Mandrake 10.0. Thanks in advance !!


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC c++ com linux help

  • ComboBox (and/or ListBox) shared in two dialogs (MFC)
    R Rafael Fernandez Lopez

    I'd use a public CStringArray object. It would save all the entries in the CDialog1 and you should write something like this for the CDialog2::OnInitDialog(): (Imagine that your CStringArray object has been called "my_array") for (int i=0; i

    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC c++ tutorial question announcement learning

  • Linux Programming
    R Rafael Fernandez Lopez

    Hi !! I'm programming under Linux and compiling with GCC (C and C++ code). Where can I find manuals for all the functions and libraries that I can use ?? I've tried to use the gotoxy(int, int) function but there's not "conio.h" and if I include it, it begins to send error messages. I need a manual (if its downloadable much better) where I can find all the functions and libraries. Thanks in advance !!


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC c++ com linux help

  • Font color in Dialogs
    R Rafael Fernandez Lopez

    Hi !! I'm programming in MFC. I want a CStatic label control to have font color at red. I don't know how to do it, because I'm using this code: CFont* my_font = new CFont; my_font->CreateFont(here all the parameters that I need...); but I can't see anything for the color... What can I do ?? I think that I've to do something with CDC or something... but please, if you could show an example... Thanks in advance !! ;)


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

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

  • Incredible functions... may exist ?
    R Rafael Fernandez Lopez

    Yes it was said to pass a reference. I mean, to modify a public CStringArray object from a function. That's a good idea !! Thanx for everything !!


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC com question

  • Incredible functions... may exist ?
    R Rafael Fernandez Lopez

    well, and declare my_array as public ?


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC com question

  • Incredible functions... may exist ?
    R Rafael Fernandez Lopez

    Could you show me an example please ?? I'm really thanked... ;)


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC com question

  • Conversion from integer to string
    R Rafael Fernandez Lopez

    CString my_string; int my_int = 54; my_string.Format("The value is: %d", my_int);


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC help tutorial

  • Incredible functions... may exist ?
    R Rafael Fernandez Lopez

    We can create functions that return values like : CString my_function() { CString my_string="whatever"; return my_string; } BUT I NEED A FUNCTION THAT MAY BE ABLE TO RETURN A CStringArray OBJECT OR SOMETHING SIMILAR WITH SOME DATA !! I mean, something like this: CStringArray my_function() { CStringArray my_array; my_array.Add("VALUE1"); my_array.Add("VALUE2"); return my_array; } THANKX !!!!


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC com question

  • why compile no error,but when running note"unable to open input file"
    R Rafael Fernandez Lopez

    Compiler doesn't looks for your files... that is not a compiler error !!!. is not a sintaxis error... because is a string... You know what I mean ?? ;)


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC help

  • CopyFile help!
    R Rafael Fernandez Lopez

    I'm not sure if an app that is running can be copied itself or even can be copied by other process...


    Written by: Rafael Fernández López.

    Visit: http://www.maestroprogramador.com

    C / C++ / MFC help
  • Login

  • Don't have an account? Register

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