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
P

Phil Hamer

@Phil Hamer
About
Posts
51
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Job ad requirements (?)
    P Phil Hamer

    I've only had one job after college (for about 3 years), and I've only ever interviewed for a few entry-level positions. So I don't know much about hiring in the software world. My question that maybe some more experienced people can answer is this: how serious about "requirements" are companies that ask for X years of experience in technology Y. For example, say an ad wants "1+ year of Perl experience." Does that have to be hands-on at work? Or does it count if I know Perl and have used it in my spare time at home? Any insights would be appreciated.

    Work Issues question perl business tutorial career

  • web browser control in a dll
    P Phil Hamer

    I'm using VC6 and creating a dialog in a DLL. I'm trying to add the Web Browser (ActiveX) Control to the dialog. I do this and a CWebBrowser2 class is automatically created for me. I use class wizard to add it as a member variable. But when I execute the code, the dialog will not show up. If I take the control out, it works. And if I try it in a dialog in an EXE, it works. Anyone have any ideas?

    C / C++ / MFC com question

  • about C++
    P Phil Hamer

    It's used in CFrameWnd in PostNcDestroy. CFrameWnds should always be created with new, so it can call "delete this" as the last thing it does before the window is gone.

    C / C++ / MFC c++ oop

  • Trapping KeyBoard events
    P Phil Hamer

    If you're looking for all 3 keys to held down at the same time, just look for one of them (like "E") with PreTranslateMessage, then check keystate of others with GetAsyncKeyState. VK_CONTROL is virtkey for Ctrl, and VK_MENU is virtkey for Alt.

    C / C++ / MFC question

  • Invert Pen/Line?
    P Phil Hamer

    Once you get a pointer or handle to a device context, call SetROP2 and pass in R2_NOT as the drawmode.

    C / C++ / MFC question graphics

  • CloseHandle
    P Phil Hamer

    Yeah, I must not have interpreted it correctly. I don't really understand it, so I won't even try to interpret again. Anyone else?

    C / C++ / MFC question

  • wrapper to a function with an unknown number of variables
    P Phil Hamer

    You would include stdarg.h and use vprintf to do something like this: void foo(const char* format, ...) { va_list args; va_start(args, format); vprintf(format, args); va_end(args); }

    C / C++ / MFC tutorial question

  • Beginner: How to declare pointers ?
    P Phil Hamer

    There is no difference. It's just a matter of style. You can put as little or as much whitespace as you want. The following would all be OK: char*xyz; char *xyz; char* xyz; char * xyz;

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

  • CloseHandle
    P Phil Hamer

    Look at NickRepin's comment near the bottom of this page: http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20170646.html[^] Basically he says CreateFileMapping always returns a handle with a value of 4.

    C / C++ / MFC question

  • passing parameters
    P Phil Hamer

    In searching Google, I actually found code very similar to this except they pass entry.key by value instead of taking address: find_index(entry.key,already_present,index); You probably just made a typo.

    C / C++ / MFC help database cryptography question learning

  • linked list problem
    P Phil Hamer

    The CApproach object returned from ParseApproach is a temporary object. You're passing the address of this temporary to Insert. When the temporary object is destroyed automatically the pointer to it points to garbage. You can either let Insert take a copy of a CApproach object instead of a pointer: int PrintList::Insert(CApproach approach) or you can assign the result of ParseApproach to a local variable, but keep in mind that when that variable goes out of scope, the pointer to it will point to garbage: CApproach result = ParseApproach(codestring); list->Insert(&result); list->print(); You could also pass Insert a pointer to an object allocated on the heap, but you have to remember to delete it when you're done with it.

    C / C++ / MFC help c++ java com data-structures

  • How to fix compiler warning ?
    P Phil Hamer

    I don't understand why, since the expression on the left IS a WORD. And we have no knowledge of this HIWORD macro; it maybe does not cast to a WORD.

    C / C++ / MFC help tutorial question

  • How to fix compiler warning ?
    P Phil Hamer

    cast HIWORD result to WORD: *((WORD *)fixaddr) += (WORD)HIWORD(delta);

    C / C++ / MFC help tutorial question

  • HHeelp
    P Phil Hamer

    I'm not sure, but I think SetDefID(IDCANCEL) would work.

    C / C++ / MFC help

  • HTML syntax highlighting concepts
    P Phil Hamer

    Handling EN_CHANGE message will tell you when text has changed, but I don't know how to get only the text that has changed. You might have to reparse the whole thing.

    C / C++ / MFC c++ html json tutorial question

  • OnEndlabeleditTree ()
    P Phil Hamer

    pTVDispInfo->item.pszText has the text, but if the user canceled the editing then it will be NULL. So you might do something like: LPCTSTR lpszText = pTVDispInfo->item.pszText; if (lpszText != NULL && IsValidText(lpszText)) { *pResult = TRUE; } else { *pResult = FALSE; } where IsValidText is some function you write to check the edited text.

    C / C++ / MFC data-structures question

  • CRichEditCtrl -- current column?
    P Phil Hamer

    I believe something like this would work. If ctrl is your control and lineNumber is the current line number: int GetColumn(int lineNumber) { // start will be char index of cursor long start, end; ctrl.GetSel(start, end); // LineIndex gives char index of beginning of current line return (start - ctrl.LineIndex(lineNumber)); }

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

  • x86 assembly
    P Phil Hamer

    What are some good books for learning x86 assembly language. I don't want a book on general assembly language, or "for dummies" books. I'd like a book that's aimed at intermediate-advanced level, i.e. something that I can keep as a reference, not something I will discard after a few months. Thanks.

    IT & Infrastructure learning lounge

  • Language question: accessing union members
    P Phil Hamer

    Yes, I realize the layout of the union. My question is sort of a tricky one that someone who is very familiar with the C or C++ language may know. Each language has specifications for what is and is not defined behavior. If something is not defined behavior, that means it may actually work sometimes or all the time, but it is still incorrectly coded. I seem to remember that it is illegal to assign to one union member and then read from a different union member. But I'm not sure, hence the question....

    C / C++ / MFC question performance

  • Language question: accessing union members
    P Phil Hamer

    I have a FILETIME struct that I want to perform arithmetic on (subtract a week from it). To do this, I need to convert it to a 64-bit integer, do the arithmetic, then convert back to a FILETIME. I've seen examples that do this with the ULARGE_INTEGER union. Something like this: FILETIME ft; // ...set ft... ULARGE_INTEGER uli; // Copy ft to uli using uli's 2-DWORD struct uli.LowPart = ft.dwLowDateTime; uli.HighPart = ft.dwHighDateTime; // Do arithmetic with uli's __int64 uli.QuadPart -= ... // Convert back to FILETIME ft.dwLowDateTime = uli.LowPart; ft.dwHighDateTime = uli.HighPart; where the QuadPart is overlayed in memory with the LowPart/HighPart (since it's a union). But is this legal... to set one union member and then read a different union member? Yes, I've tried it and it does work, but is it truly correct according to the language?

    C / C++ / MFC question performance
  • Login

  • Don't have an account? Register

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