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
S

S van Leent

@S van Leent
About
Posts
100
Topics
36
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Help with OnPaint
    S S van Leent

    Currently, I have this code in my on paint event in a view. CPaintDC dc(this); CPoint originalSize = matrix.GetSize(); int y, x; for (y = 0; y < size.y; y++) { for (x = 0; x < size.x; x++) { dc.SetPixelV(CPoint(x,y), obj.GetColorRef(CPoint(x, y))); } } As you can understand, this is pretty slow with soewhat bigger pictures where for example, tje size is over 1000 x 1000 pixels. A solution, as far as I know, is to use a memory DC. However, I am doing something wrong. I want to create the memory DC with the following CPaintDC dc(this); CDC pdc; dc.CreateCompatibleDC(&pdc); CPoint originalSize = matrix.GetSize(); int y, x; for (y = 0; y < size.y; y++) { for (x = 0; x < size.x; x++) { pdc.SetPixelV(CPoint(x,y), obj.GetColorRef(CPoint(x, y))); } } dc.BitBlt(0, 0, size.x, size.y, ...) However, the first time only a black block was drawn then, when resizing things go wrong (the app crashes), where a colored block should be drawn. What am I doing wrong, and if I am doing it wrong, how should I do it? LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC performance help tutorial question

  • technique for assure, that a function is overwritten in c++??
    S S van Leent

    Maybe some light. Any function has its start address. So you can check whether the start address of the function in the derived class is the same as the address of the function in the super class itself. If so, you could fault on runtime. It has some difficulties, and some knowledge of vtables seem to be handy here, but I think it is in the direction you should be thinking. LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC c++ question

  • CPaintDC develish slow
    S S van Leent

    Hi all, I am currently doing a project where I need to be able to have a imaging framework. Although the framework itself runs pretty smooth, the CPaintDC of MFC kills me. The SetPixelV is extremely slow, so I want to use another way of doing this. I know it is possible to create a CDC in memory, but how can I put a bitmap created from this CDC put on the surface a CWnd subclassed control? Any suggestions? LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC question c++ graphics performance

  • Missing Drive
    S S van Leent

    Better to much solutions as no solution :) LPCTSTR Dutch = TEXT("Double Dutch :-)");

    System Admin com tools tutorial question

  • Missing Drive
    S S van Leent

    Is it formatted as FAT32 or NTFS, or is it formatted as another file system? LPCTSTR Dutch = TEXT("Double Dutch :-)");

    System Admin com tools tutorial question

  • Bold and Color TEXT in MessageBox?
    S S van Leent

    Probably you need the windows API called MessageBoxEx LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C# question

  • TabControl still not good
    S S van Leent

    I know, but it seems so simple to fix :( LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C# csharp help question announcement

  • TabControl still not good
    S S van Leent

    I can't believe it. In the newest version of .NET, the tabcontrol still looks awefull, why don't they fix it at the MS House, it shouldn't be that much pane, or is it? LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C# csharp help question announcement

  • Scrollbar control problems
    S S van Leent

    I've made a horizontal scrollbar control using CreateWindowEx, and on the WM_HSCROLL event in the parent window I do this: if (flag == SB_LEFT) { curPos -= 1; } else if (flag == SB_RIGHT) { curPos += 1; } else if (flag == SB_LINELEFT || flag == SB_PAGELEFT) { curPos -= 1; } else if (flag == SB_LINERIGHT || flag == SB_PAGERIGHT) { curPos += 1; } else if (flag == SB_THUMBTRACK || flag == SB_THUMBPOSITION) { curPos = position; } Then using SetScrollPos(hWndScroll, SB_CTL, curPos, TRUE) I try to let the scrollbar be updated, but it doesn't seem to work. any ideas? LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC question

  • Overruling WH_CBT hook behaviour
    S S van Leent

    If I create a window, and I use the normal SetWindowsHook procedure like this: SetWindowsHookEx(WH_CBT, (HOOKPROC)CBTProc, hInstance, NULL); It does work on self defined windowclasses but it doesn't seem to work with normal controls, like buttons and so on. How can I overrule this? If not possible, can I make a button using a selfdefined windowclass which calls the button procedure on it's turn? LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC question

  • Resourceless Dialogbox
    S S van Leent

    Thanks, though I'm using CreateDialogIndirectParam and DialogBoxIndirectParam right now LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC help question

  • Resourceless Dialogbox
    S S van Leent

    Well then, is there a way to at least create a dialogbox without a resource? LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC help question

  • Resourceless Dialogbox
    S S van Leent

    Help wanted! I need to create a resourceless dialog box. I want it to use a WndProc instead if a DlgProc, and I want to use CreateWindow instead of CreateDialog or variants. Is there a standard window class which I can use to accomplish this task? I was thinking of:

    CreateWindow(TEXT("DIALOG"), TEXT("HELLO"), WS_VISIBLE, ...)
    ^^^^^^
    The window class

    Thanks in advance LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC help question

  • CBTProc not working
    S S van Leent

    Well, when I wrote the thing and uploaded it, in a minute I knew the solution, It works great. The function looks like:

    static LRESULT CALLBACK CBTProc(int nCode,
    								WPARAM wParam,
    								LPARAM lParam)
    {
    	if (nCode == HCBT\_CREATEWND)
    	{
    		LONG counter = 0;
    		HWND hWnd = reinterpret\_cast(wParam);
    		LPCBT\_CREATEWND lpcw = (LPCBT\_CREATEWND)lParam;
    		LONG lpCreateParams = (LONG)lpcw->lpcs->lpCreateParams;
    
    		// This makes it possible to use "API-style" windows too, where
    		// the lpCreateParams does not point to a class
    
    		if (lpCreateParams != 0 && lpcw->lpcs->hInstance == \_\_hInstance\_\_)
    		{
    			for (iIterator = arrUnboxedClasses.begin(); iIterator != arrUnboxedClasses.end(); iIterator++, counter++)
    			{
    				if (arrUnboxedClasses.at(counter) == lpCreateParams)
    				{
    					::SetWindowLong(hWnd, GWL\_USERDATA, lpCreateParams);
    					goto end;
    				}
    			}
    			
    		}
    	}
    
    	end:
    
    	return CallNextHookEx(\_\_hWndsHook\_\_, nCode, wParam, lParam);
    }
    

    I still think that another application may not crash because I install a hook, this is not a really good design, I think. LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC debugging tutorial

  • Cost of a function call
    S S van Leent

    Joe Woodbury wrote: In general, unless you really understand the CPU architecture, you should just write clean C/C++ code and let the compiler do it's thing. I agree with that, also, I think Inlining is sometimes a lazy way of writing a macro, which is (the macro) sometimes much better. LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC c++ question sysadmin business performance

  • Movies: X-Men 2
    S S van Leent

    It's Simple, Famke Janssen is in it, and because I'm coming from the Netherlands (just as she does), I need to see it. Well I do like the rest too you know. LPCTSTR Dutch = TEXT("Double Dutch :-)");

    The Lounge adobe question

  • Need a simple "console-style" output window in MFC
    S S van Leent

    A textbox could do the trick, by doing something like

    txtBox->SetWindowText(txtBox->GetWindowText() + CString(_T("Some text")))

    LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC c++ help question

  • Cost of a function call
    S S van Leent

    Well, I know someone who makes a 3D-graphics engine, it really does matter pushing things on the stack or not. So I think a compiler should just inline when you want it to inline. Which doesn't gain much over complex calculations, but simple calculations, at the other hand, do matter. LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC c++ question sysadmin business performance

  • Is ++i statement in the for loop better than i++?
    S S van Leent

    OK, but if you don't use optimization (it can be useful for something), it does matter LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC performance question

  • CBTProc not working
    S S van Leent

    I'm experimenting with hooking, but when I do the following:

    hWndsHook = SetWindowsHookEx(WH_CBT, (HOOKPROC)CBTProc, NULL, NULL);

    I expect it to run:

    LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)
    {
    if (nCode == HCBT_CREATEWND)
    {
    HWND hWnd = reinterpret_cast<HWND>(wParam);
    LPCBT_CREATEWND lpcw = (LPCBT_CREATEWND)lParam;
    LONG lpCreateParams = (LONG)lpcw->lpcs->lpCreateParams;
    ::SetWindowLong(hWnd, GWL_USERDATA, lpCreateParams);
    }

    return CallNextHookEx(hWndsHook, nCode, wParam, lParam);
    

    }

    But it doesn't. There are no compile warnings or whatsoever. I tried to debug it, but when marking it with a breakpoint (at CallNextHookEx) for example, it doesn't break, and it sure doesn't do what I want it to do. And I really am creating windows with CreateWindow, which does do what it needs to do (The MessageLoops work). LPCTSTR Dutch = TEXT("Double Dutch :-)");

    C / C++ / MFC debugging 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