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
L

Luther Baker

@Luther Baker
About
Posts
54
Topics
18
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • PatBlt, PATINVER and HOT/HOVER display
    L Luther Baker

    I write controls and GUIs and PatBlt and PATINVERT has proved very fast and valuable when it comes to 'selecting' or hilighting something as the mouse buzzes by. In many MS products - when a mouse buzzes by the toolbar for instance, the 'hot' or highlight approach does something like 'highlight the background of the icon in blue with a blue border' but generally leaves the icon alone. I'm sure this could be implemented long hand using double buffering or simply repainting BG and then the ICON to the screen - but is there a tricky or clever way to do this - like using a MASK or something that would allow me to simply alter the background back and forth - and not need to redraw the icon (unless of course, the icon also changes to imply 'hot' or hover. Another situation might be a customer list box of some sort ... when the user highlights an item, the BG of that item changes - but the TEXT and possible ICON do not. Again, I know this can be implemented by painting everything for that item ... and made flicker free by using double buffereing ... but I'd like to investigate a more 'clever' approach - like creating a transparency by anding and oring bits and masks in just the right order. ICON Text A ICON Text B |---------------------| | ICON Text C | |---------------------| ICON Text D and that highlight could quickly follow the mouse. The technique should be valid over anything ... just as PatBlt(...PATINVERT) works so well. Unfortunately, PATINVERT inverts everything ... I need to avoid the INNERDS. Maybe start by leaving certain COLORS alone? on a PATINVERT type operation ... ? Would it be worthwhile to look into HRGNs? Many thanks in advance. -Luther

    C / C++ / MFC sales question learning

  • TreeView_CreateDragImage
    L Luther Baker

    I am implementing a Drag and Drop operation on a TreeView. I've supplied a bitmap to my tree and it draws wonderfully. Now, when the user begins dragging - I call TreeView_CreateDragImage ... and for the most part, it works except that the dragging image (a folder) overlaps the textual part of the drag so that when you are draggin and move the mouse around, you can't see the first few characters of the TreeView node's text in the dragging image. I can't see how to affect this. Are my bitmaps too large? I initially supplied a bitmap strip 128x16 and told the TreeView the images were 16x16. I've move the hotspot around in TreeView_BeginDrag ... For the most part, CreateDragImage is a black box - it just creates the draggable image. I've no idea how to affect the placement of the text relative to the image. Any suggestions would be appreciated. Thanks in advance, -Luther

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

  • License Keys
    L Luther Baker

    If the user finds the file - and deletes it, the software will no longer work. And unless the user can reverse engineer the function that created the key in the first place, the user cannot create a new file and extend the license. In the world of ssh and encryption, security by obscurity is generally considered a bad or weak thing. That is one of the reasons why DES, 3DES, AES, etc are public algorithms. Security by hiding things is not quite as secure as using "hard to decode" techniques. It seems that a file created using this premise could very well be public. I think you have a good point from a practical standpoint though. It may be so timeconsuming and impractical to search the entire Registry for an obscure key ... that no normal user would do it ... If memory serves me correct, http://www.ssh.com/products/tectia/client/non-commercial.html distributes a license file and http://www.vandyke.com/ actually gives the user a KEY to enter into the software manually. There's no hiding much of anything here. Given the abovee points, can you elaborate and the danger you think exists in using a license file? Thanks much, -Luther

    C / C++ / MFC adobe database sysadmin windows-admin security

  • VC++ and Java
    L Luther Baker

    You might try invoking a JVM from your VC++ application - and then communicate with it via your favorite distributed protocol. Remember, Java libs/apps run in virtual machines ... whilst VC++ compiles natively. -Luther

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

  • License Keys
    L Luther Baker

    Thats a pretty good idea. No matter how many times the user installs or wipes the computer and tries to reinstall, the license expires on the expiration date as defined when the license was created. Could almost get away with a simple file then. I guess this approach is only as strong as the strength of the Reversible Function ... Thanks for the suggestion. -Luther

    C / C++ / MFC adobe database sysadmin windows-admin security

  • License Keys
    L Luther Baker

    Sorry if I wasn't clear. I want to understand/write/test/build/architect this functionality. Not purchase it.

    C / C++ / MFC adobe database sysadmin windows-admin security

  • License Keys
    L Luther Baker

    Ah -- one more ... I have Pro Tools and their higher end software requires a dongle (USB key). Mark of the Unicorn used to include a floppy disk - which would include exactly one install. If you moved your software or wanted to reinstall, you had to UNAUTHORIZE your hard drive back to the floppy, reinstall, and then AUTHORIZE the hard drive. I assume that floppy was a "special" floppy in that, you couldn't just make copies of it and create your own unlimited AUTHORIZATIONS ... but I never knew what they did to AUTHORIZE the hard disk. Can you write to a SECRET section? Or again, is this all "security by obscurity" and they simply hid some mark someone on the disk. How could they guarantee that no one would write over it? Many thanks for any suggestions -- last part of an prototype project - and I'm not sure how whether to secure it with a home grown approach? or if there were some accepted industry practices. Thanks Again, -Luther

    C / C++ / MFC adobe database sysadmin windows-admin security

  • License Keys
    L Luther Baker

    I'd like to include some sort of license key (30 day free, etc) with my software. Firstly: for example, if I download Adobe Illustrator and use it for 30 days - it is smart enough to to know that if I uninstall and reinstall - it still won't work. Maybe it's using the registry and storing an obscure key somewhere? I'm interested to know is there a defined (API) way to do this? Or is it mostly "security by obscurity." I know nothing is perfect ... there are plenty of "FIXES" for my favorite first person shooters, but if you're trying to limit trial durations or license software for any fixed period of time, is there a fairly "strong" technique to do this? Finally, if I want to limit an installation to one machine ... I guess I can have the user register online (ala MS) after which I'd probably implement some type of handshake - and then query for something like the Network Card id ... like GUIDs are generated. But, is that "correct?" Do motherboards have serial #s yet? Or, is there a different approach that would suit me better. Looking online, I'm not sure what topics to Google ... suggestions would be most appreciated. Many thanks, -Luther

    C / C++ / MFC adobe database sysadmin windows-admin security

  • WM_CHAR and eating keystrokes
    L Luther Baker

    This is EXACTLY what I was looking for Thanks PJ! BOOL DialogName::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message==WM_KEYDOWN) { if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE) pMsg->wParam=NULL ; } return CDialog::PreTranslateMessage(pMsg); }

    C / C++ / MFC question tutorial

  • WM_CHAR and eating keystrokes
    L Luther Baker

    Ahh ... nice suggestion! I am not using WTL per se, but my own OO framework. I mimic several parts of the WTL including THUNKING the wndproc - but I've not worried about the PreTranslateMessage mechanism ... till now. So, conceptually, I don't want to translate WM_KEYDOWN to the WM_CHAR if it is a tab character ... I will read up - but I am guessing that PreTranslateMessage leads to TranslateMessage unless you return 0 or something like that ... I wonder if I can also change the keydown here as well ... At any rate, I think your point is ... I need to intercept the message before calling TranslateMessage - and the WTL lib provides an easy way to do this on a per HWND basis. Seems like alot of overhead ... does the MFC or WTL message loop call PreTranslateMessage for EVERY window class object? Thanks, -Luther

    C / C++ / MFC question tutorial

  • WM_CHAR and eating keystrokes
    L Luther Baker

    I have an EDIT box and I'd like to silently trap and eat certain characters. I can catch WM_CHAR, check for the key, and return 0. I guess I'm asking if this is the right thing to do? I'd prefer to catch WM_KEYDOWN, and somehow return something that says "don't bother translating this key. Do not translate. Do not send out WM_CHAR ..." But to no avail. ------ Here is another example. I want to convert every character typed to +2. So, if the user enters "abc" I want to print "cde" to the window. "ejv" == "glx". Following the above approach, if I capture and eat the "a" character in WM_CHAR, and then resend "c" ... naively, I'd capture the "c" and cancel it ... and send "e" ... etc etc. and I've got a crazy endless loop. Some languages have event handlers that include the character code by reference -- and if you change the character code - whatever you changed it to is what is passed to the underlying window. Is there a low level facility to do that in win32? Can I capture WM_KEYDOWN and change the key so that WM_CHAR is correct. Or, do I just need to manage some tricky key issues (if user didn't send this key, process it, else, cancel it and resend the new key). Should I bother with with the TranslateMessage function? I'm just sure this is a common enough idiom that someone else has asked this and has an elegant solution ... any pointers would be great! ---- One more example - I'm implementing vi or emacs ... and I've got a slew of keyboard commands. There are just times when converting keys to WM_CHAR is a waste of CPU. If I'm in vi's navigation mode - I really don't need to send any characters to the window. I guess I can keep canceling them in WM_CHAR -- but it seems there should be a more elegant way to do so ... I'm not a big fan of global hooks - but maybe they are warranted in this case? Thanks in advance for any suggestions, -Luther

    C / C++ / MFC question tutorial

  • WS_TABSTOP and EDIT controls
    L Luther Baker

    I'm not sure how that helps me? If I am in a TEXT EDIT box - and I press the "TAB" key, the MessageBell goes off and the "TAB" key is sent to the TEXT EDIT box. If I manually catch the "TAB" key in a WM_CHAR message and manually call GetNextDlgTabItem and then SetFocus(nextItem) ... I get the behavior I want. The ordering is fine. When I manually tab, I tab to the correct TEXT EDIT box. The problem is not the ordering or where I am going. The problem is catching the "TAB" key before it is sent to the EDIT TEXT box. That is what IsDialogMessage handles for me. I'm just looking for some common idiom to handle this - since IsDialogMessage needs the HWND to check and IsDialogMessage must exist with the main message loop - 100,000 miles (so to speak) away from the rest of my code. Does that help clarify anything? Thanks, -Luther

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

  • WS_TABSTOP and EDIT controls
    L Luther Baker

    I am building a window in code (not via RC or dialog templates) and attaching EDIT controls to it. Upon completion, there may be 10 windows with 25 EDIT controls each. Within each window (one displayed at a given time) I'd like to TAB between the EDIT controls. Unfortunately, the only examples I can find on the net (http://blogs.msdn.com/oldnewthing/archive/2003/10/21/55384.aspx) want me to change my message loop to something like this: if (IsDialogMessage(hwnd, &msg)) { /* Already handled by dialog manager */ } else { TranslateMessage(&msg); DispatchMessage(&msg); } My message loop is in a completely different C++ file/class. For this to work as described, I'd need to pass the application (or make it global) to every single EDIT control - or at least, find away to keep updating the "hwnd" used in the IsDialogMessage method above every time focus changed since that method works on a specific EDIT control at a time ... Is that really necessary? I've built the EDIT controls with WS_TABSTOP style, and naturally, they are eating the TAB key. I can manually catch and GetNextDlgTabItem myself, but I wasn't sure if that was normal. Is there a cleaner way I've overlooked? Many thanks, -Luther

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

  • HINSTANCE requirement
    L Luther Baker

    Many Thanks David. I have a built a very similar framework - but with templates. Mainly to get as far away from virtual tables as possible. Sometimes subclassing, sometimes superclassing ... but templates add a nice twist. I've come across one or two articles on Thunking (a lengthy one here on codeproject) but it didn't seem to work perfectly in .NET. I'm not an ASSEMBLER, and I was probably doing something incorrectly, but setting the callback function to the thunk wasn't properly executing and the application would freeze. I'm not especially fond of the GetWindowLongPtr method, but at least it works. I'm concerned that an application with windows containing several children - each one using GetWindowLongPtr approach is not going to scale well. Of course that's relative - but c windows apps will always have that speed advantage. It'll probabaly work out just fine ... just trying to explore for a clean, fast solution. Hoping the lack of HINSTANCE in the WNDCLASSEX doesn't come back to bite me. Thanks again, -Luther

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

  • HINSTANCE requirement
    L Luther Baker

    As an exercise, I am wrapping some of the lower level win32 structures and methods into a C++ object library. I'd like to avoid forcing the user to do things like "register" classes. I think this is error prone to have the user make 'one' time calls, so I am trying to take advantage of C++ static properties. Currently, I declare an class (static) ATOM and initialize it with a function that is local to the cpp file. My question revolves around the HINSTANCE member of the WNDCLASSEX struct. It clear that for win2k+, the hinstance parameter is ignored in the CreateWindowEx function - but what about for the population of WNDCLASSEX and subsequent RegisterClassEx calls? It seems to work in my demo application (using WNDCLASSEX.hInstance = NULL that is). I have also had luck using the return value of GetModuleHandle. Any suggestiong? I'd like to know whats going on under the hood. Will these methods work in simple cases and not more complex? I've even done this in a small DLL and seemed to have no problems using absolutely no HINSTANCE in the WNDCLASSEX .... When one registers a class, is it registered systemwide? so that any HINSTANCE could instantiate it? The documentation says the WNDPROC must exist in the HINSTANCE. When I don't provide a hinstance, maybe it assumes the hinstance the call is being made from and so far, my WNDPROC always exists there? This all comes back to the question, should I force the user to provide a HINSTANCE and consequently, Register classes explicitly. Any direction would be appreciated. Thanks in advance, -Luther

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

  • MouseEnter Control
    L Luther Baker

    The flag method works cleanly - I typically try to avoid saving and polling state like that ... but practically speaking, I assume it makes sense in this stateful, event driven world. I also appreciate your comment regarding overrides vs handlers. It wasn't concretely clear to me when to use which. I see that for every child control I add to a parent, I could add a handler. Self-documenting and a bit easier to organize. Whereas, the control's own painting naturally belongs in the override. Thanks! -Luther

    C# question graphics

  • MouseEnter Control
    L Luther Baker

    I'm building a custom control and I want it to change borders when a MouseEnter events happens. a) Can I simply paint the border in the MouseEvent method? OR b) Must I set a flag and call Invalidate(), and wire OnPaint to draw the new/old border appropriately? If a) is ok, then how do I get a graphics instance in the MouseEnter event. Or, is b) the preferred method to do this? Thanks, -Luther

    C# question graphics

  • C# Forms/Controls
    L Luther Baker

    The first method works, and provides my insets. But regarding option #2, the point of the border was to "pad" the form. I do in fact, get the border to draw, but the child controls still Dock against the edges of the form, overlapping even the border I am drawing. Should I somehow affect the Form.ClientRectangle {get;} before forwarding to base.OnPaint () so that the border I've drawn is not overlapped by child controls? Or shall I work it out by attaching child controls to a singular, centered child Panel again? Also - what is the Form.ClipRectangle represent? The area that needs repainting? In my little app, its always 0,0,0,0. Shouldn't it be equal to the Form.ClientRectangle? It is 0,0,0,0 every time OnPaint gets called. Even when the app is completely hidden by other windows - and then pulled to the front. Regardless, thats just neat stuff. Thanks, -Luther

    C# csharp help question

  • C# SystemFonts
    L Luther Baker

    Thanks.

    C# csharp question

  • C# Forms/Controls
    L Luther Baker

    wow.

    C# csharp help question
  • Login

  • Don't have an account? Register

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