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
C

chaau

@chaau
About
Posts
26
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • An algorithm question
    C chaau

    Is it a LIFO pattern? In this case std::stack[^] is your answer

    C / C++ / MFC hardware algorithms tutorial question

  • Can someone (briefly) explain ON_UPDATE_COMMAND_UI?
    C chaau

    If the logic that decides if the buttons should be enabled or disabled is too complicated it is advised (do not ask me to find who advised it, I just remember it somehow) that you do not use this method. You could always use CToolBarCtrl::EnableButton() for this and control it from within other parts of the program

    C / C++ / MFC design question

  • VC++ Crashing?
    C chaau

    Try to run in Windows 2000 compatibility mode. First thing that comes to mind

    ATL / WTL / STL c++ debugging help question

  • How to conditional call a library
    C chaau

    As an alternative, you could use delay load dll. In this case you do not need to change the code you have already written (related to statically linking to the library), all you need to do is just do not call chunk of codes related to magnification at all. Saves you a lot of annoying LoadLibrary/GetProcAddress calls. However, it looks like you have already implemented it. So, just learn about this, so that you could use in future

    C / C++ / MFC question tutorial

  • CView::OnDraw - related question
    C chaau

    To force the window to redraw (any window, not only view) you need to call CWnd::Invalidate()[^] method. Calling it will trigger all the drawing routines

    C / C++ / MFC question c++

  • How to Restart My Mfc Application
    C chaau

    I think Restart Manager[^] is your answer. If you are building it with the latest MFC (the one with a feature pack), then it is built into the MFC Application Wizard[^]

    C / C++ / MFC c++ tutorial

  • C++: CreateProcess() launching child applications with UAC dialog for once
    C chaau

    I think it is nothing to do with how you call CreateProcess. If your main application Setup.exe is launched in elevated mode, all processes lunched by this application will be launched in elevated mode. In order to have an elevated prompt for your Setup.exe, you need to create manifest. This simple manifest will trigger the UAC prompt for your application:

    C / C++ / MFC workspace c++ html design oop

  • DialogBox fail in XP
    C chaau

    Try to set MinimumRequiredVersion to 5.00

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

  • DialogBox fail in XP
    C chaau

    It is most likely the manifest. When I converted my projects to VS2010, it changed all my manifests to use urn:schemas-microsoft-com:asm.v2 in this line:

    Awesome

    Also, please check if you still using the manifest loaded via RT_MANIFEST resource. You need to delete this from resource and use the project settings. VS2010 has a habit of assigning RT_MANIFEST to 2, making the program unusable under XP. And of cause you need to check this linker option: MinimumRequiredVersion. It should be 5.00.

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

  • Why new Image failed?
    C chaau

    replace the first line with this:

    Image* m_pImage = NULL;

    Otherwise, m_pImage is not NULL, and you are trying to delete uninitialised pointer, leadding to memory corruption

    C / C++ / MFC c++ winforms graphics debugging question

  • Why the CTreeCtrl disable[solved]
    C chaau

    At least show us the code you use to create the Tree Control

    C / C++ / MFC

  • CHtmlView
    C chaau

    Call Navigate2("about.blank", 0, "_self") before GetHtmlDocument()

    C / C++ / MFC help tutorial question

  • How to Resize Dialogbar?
    C chaau

    Perhaps you could check this article[^]

    C / C++ / MFC help tutorial question

  • Drawing speed
    C chaau

    You need to create DIB (I think you have already already created it based on the code), then you need to copy the bitmap bits to the DIB's buffer using this code:

    HBITMAP	hOldBitmap = NULL;
    
    if (m\_hBitmap == NULL)
    {
    	m\_hBitmap = CreateDIBSection(hDC, (BITMAPINFO\*)m\_hDib, DIB\_RGB\_COLORS, &m\_lpBits, NULL, 0);
    	if (m\_hBitmap == NULL)	return;
    	if (m\_lpBits == NULL)
    	{
    		::DeleteObject(m\_hBitmap);
    		m\_hBitmap = NULL;
    		return;
    	} // if
    } // if
    
    memcpy(m\_lpBits, ((LPBYTE)m\_hDib + \*(LPDWORD)m\_hDib + GetPaletteSize()), m\_bi.biSizeImage);
    
    if (m\_hMemDC == NULL)
    {
    	m\_hMemDC = CreateCompatibleDC(hDC);
    	if (m\_hMemDC == NULL)	return;
    } // if
    
    hOldBitmap = (HBITMAP)SelectObject(m\_hMemDC, m\_hBitmap);
    
    BitBlt(hDC, dwX, dwY, m\_bi.biWidth, m\_bi.biHeight, m\_hMemDC, 0, 0, SRCCOPY);
    SelectObject(m\_hMemDC, hOldBitmap);
    

    The main part here is the memcpy. I have copied it from my program. If you can't understand what the "m_" variables are, let me know and I will explain

    C / C++ / MFC graphics performance question html com

  • CFileDialog is not refreshing
    C chaau

    I think in this case you should pass NULL. Please note that you need to pass only extension, e.g. for Excel files you would pass _T("xls"). For all files, pass NULL in place of szMask

    C / C++ / MFC help announcement com

  • CFileDialog is not refreshing
    C chaau

    What value are you passing in szMask?

    C / C++ / MFC help announcement com

  • Drawing speed
    C chaau

    The problem is with this line:

    pDoc->GetDib()->Draw(&MemDC, CPoint(0,0), sizeLog);

    You need to replace it with another BitBlt that will copy stuff to MemDC

    C / C++ / MFC graphics performance question html com

  • how do i copy a CImage DIB to clipboard
    C chaau

    It fails because the memory allocated by GlobalAlloc is not enough. See, how you use sizeof(BITMAPINFO) + w * h * 3 value to allocate memory, and then you are trying to calculate the m_dwSizeImage value, which is much greater then requested. You have got two options: Either move this chunk of code after you have calculated the image size, so that your code becomes:

    DWORD dwBytes = ((DWORD) w \* Bpp) / 32;
    
    if(((DWORD) w \* Bpp) % 32) {
       dwBytes++;
    }
    dwBytes \*= 4;
    
    unsigned long m\_dwSizeImage = dwBytes \* h; // no compression
    
    void\* pBits = tmpImage.GetBits();
    HANDLE hData = ::GlobalAlloc (GMEM\_MOVEABLE, sizeof(BITMAPINFO) + m\_dwSizeImage);
    LPVOID pData = (LPVOID) ::GlobalLock (hData);
    LPBYTE p\_imagebits;
    p\_imagebits  = (LPBYTE)pData + sizeof(BITMAPINFO);
    
    
    memcpy(pData,&bmInfo,sizeof(BITMAPINFO));
    memcpy (p\_imagebits, pBits, m\_dwSizeImage);
    

    Or, just use a solution[^] from Codeguru BTW, it looks like you have calculated the m_dwImageSize incorrectly anyway

    ATL / WTL / STL question help

  • Linker Error
    C chaau

    You need to add a cpp file or a lib file to your project depending on what you've got. If you have FileParser.cpp file (most likely this is the case) do the following: In the Solution Explorer right click on the project and Select Add->Existing Item. Locate your FileParser.cpp and select it. If you are given a lib file together with the FileParser.h you need to add it via the Project properties. In the Solution Explorer right click on your project and select Properties. Go to Linker options -> Input. In the Additional dependencies field type the name of your lib file, e.g. FileParser.lib.

    C / C++ / MFC c++ debugging help tutorial question

  • file is getting deleted
    C chaau

    Make sure you call ::CloseHandle(temp_file) after you have done working with it

    C / C++ / MFC
  • Login

  • Don't have an account? Register

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