Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Discussions

LeoDavidson LeoDavidson
  • "Any CPU" - Is it evil?

    Sven Groot said:
    LeoDavidson said:
    *snip*

    You could also have a main 64 bit .Net process, and a 32 bit .Net process doing the interop, and then have the two communicate via .Net Remoting or WCF. It's pretty easy to set up.

    .Net Remoting definitely makes more sense than COM for .Net projects. I forgot all about it, even though I've used it. It's great and, like you say, really easy to use.

     

  • "Any CPU" - Is it evil?

    lensman said:
    LeoDavidson said:
    *snip*

    What do you mean by "proxy"?  If I have a seperate process load the 32 bit dll, do I not still have the same problem?  How do I communicate with the 32 bit process from 64 bit process?

     

    COM can make calls to objects hosted in other processes (i.e. out-of-process objects). When doing so it doesn't matter if either/both processes are 32/64 bit or not; COM handles the details for you.

     

    You could also use other IPC mechanisms like pipes, shared memory, etc. but the beauty of the COM method is that you get all the marshalling code for free and if you're already using COM then you don't have to change much.

     

    COM isn't always the best way to do it, of course, but it often is.

     

  • "Any CPU" - Is it evil?

    I would prefer to put all my legacy 32 bit code into a DLL however that quickly renders it useless as 64 bit clients appear to have no means of communicating with 32 bit code.

    You can do it, you just need a 32-bit process to load the 32-bit DLLs on your behalf and then act as a proxy between your main 64-bit process and the DLLs.

     

    Obviously, how well this works depends on what the DLLs do. If the DLLs require that lots of pointers and complex data structures be passed in and out of them then you have to write a lot of marshalling glue. If not, though, it's very easy.

     

    In C++ code, I've used COM to get all the marshalling I need for free. COM knows how to call across the 32/64-bit boundary between processes, converting arguments appropriately. (You're already unable to share pointers across processes so the 32/64-bit issue doesn't change things there.)  I'm not sure what the best approach for .Net code is, though.

     

  • Windows 7 Backup error 0x80070005

    Is the external hard drive formatted as NTFS? Was it formatted on another machine?

     

    It could be that you need to fix-up the file/folder permissions on the external drive so that your account is allowed to write to it.

     

  • Windows 7: Epic Failure

    littleguru said:
    SandyPecker said:
    *snip*

    *putting on my private person hat*

     

    Custom hardware? What does that mean? Did you literally build the hardware? If that is correct then it is your duty to write proper drivers and make sure that the hardware works.

     

    Or does "custom hardware" mean that you bought hardware and assembled the PC on your own? If that is correct and you get the described experience that might more likely mean that you bought some hardware that doesn't work well together. Or some of the parts that you bought are faulty.

     

    I bought a set of hardware components recently too. And assembled them as my living room PC. Everything is brand new. Installed Windows 7. Had it go to Windows Update and install all the drivers. Everything works great. Solid and fast performance.

     

    Windows should probably have something that says: Uppps... your hardware has issues. Please replace component X.

    To add to that, there have been problems with certain combinations of hardware/software/OS/drivers/whatever forever. People see one Vista (or whatever) machine with the problem and someone jump to the conclusion that it's the OS when the same sort of problem could happen on any OS, including Winodws XP, Linux, OS X...

     

  • Turning off FUS in Windows 7

    This guide for Vista looks like it should still work:

     

    http://www.winhelponline.com/articles/128/1/How-to-disable-Fast-User-Switching-in-Windows-Vista.html

     

    The options are still there in Windows 7. (I haven't actually tried them, and I'm not on a domain, but they are still in the same place except that Local Computer Policy has been renamed to Computer Configuration in the tree on the left of gpedit.msc.)

     

  • Way to detect DWM open/close window animations?

    I gave up on the alternative method in the end. Ran into too many problems with controls drawing directly into the window, or directly manipulating the window (e.g. shifting parts of it around in when scrolling), over the top of what I was doing. That's what makes the DWM thumbnail method so great: It takes the rendering output or the windows and does things to it without affecting it at all. (It also lets me easily create effects on areas of the top-level window which can cross over child windows.)

     

    So I went back to plan A. Almost ditched the idea completely but it looked so nice (to me Smiley) that I kept at it a bit more, and I think I now have it working really well, albeit with some kludges. Long term testing will determine whether the feature sticks or is canned.

     

    While playing with this stuff I discovered that Windows 7's DWM process will crash (and sometimes reset the desktop back to classic rendering) if the user invokes Aero Peek while a DWM thumbnail is being moved around in another window as Peek fades things out to sheets of glass. Sad

     

    Workaround is to set the new DWM window flag on the window the thumbnail is rendered into, telling DWM to ignore that window for Aero Peek. (Drawback is that it then stays visible while the other windows are faded to glass, but in my case that's fine as it's only visible for half a second anyway.)

     

    I also noticed that my overlay window is considered part of the main window when minimising/restoring the window, and within Flip 3D. So it's only considered a separate window during the window-open animation, which seems weird. It's like the pop-up is only "attached" to its parent after that window-open animation has completed. (I checked that I'm not opening my pop-up before the parent window has been made visible, and I'm not.)

     

  • Way to detect DWM open/close window animations?

    AndyC said:
    LeoDavidson said:
    *snip*

    As you say, it's a bit of a hack and you aren't really using DWM thumbnails in a way anyone ever intended them to work, which is probably why it doesn't. I suspect the best you'll get is to disable DWM animations for your window, although I have a suspicion that something like Flip3D may make your UI break also.

    Flip3D is fine, FWIW. You can opt windows out of it so the overlay window would be hidden whenever it's active (including when it's animating things into position).

     

    Think I'll explore an alternative way to do the effect now. Have an idea that might give a good result but won't be hardware accelerated and will only work with windows that allow painting to a specific device-context. If that works well enough then it'll save a lot of hassle.

     

  • Way to detect DWM open/close window animations?

    CannotResolveSymbol said:
    LeoDavidson said:
    *snip*

    Wait, what?  I'm not sure I follow you here...  are you using this window as an overlay to add visual effects to your application or are you using this window to draw a custom preview thumbnail?

     

    At any rate, anything you do on this is a hack.  You're only going to get so far before you need to move to a proper animation framework (through WPF, through the Windows 7-specific Animation Manager, or through a third-party framework).  Might as well do it right from the start than have to come back in a year and rewrite everything when you need to do something that's beyond what your hack-around can do.

    It is a bit of a hack, but one which works well (so far, at least) apart from this one issue.

     

    Spending the next few years re-writing the entire app to get a bit of eye candy isn't an option, as nice as that idea may sound in an ideal world with infinite time & resources and access to the source code of all OS and 3rd party components. (This effect has to work, for example, on hosted ActiveX controls.) If re-writing the whole app is the only option then I'll simply do without the effect.

     

    However, if there is some way to detect when DWM has finished animating my window then I believe I can make everything work perfectly.

  • Way to detect DWM open/close window animations?

    CannotResolveSymbol said:
    figuerres said:
    *snip*

    You don't need to "make it act like a docking panel" (or provide any behavior at all, really), just setting the parent of your effects window to your main window should be sufficient to make it behave as though its part of the main window from the DWM's perspective (along with the obvious change to use coordinates relative to the window).

     

    Downside:  if your child window has a title bar, it will most likely no longer be drawn by the DWM.  Also, you can get some weirdness WRT keyboard focus when doing this; if your effects window is just a transient thing, this shouldn't be an issue (and it won't be any more of an issue than when you were using a separate window).

    The effects window can't be a proper child (WS_CHILD) of the main window since DWM thumbnails can only be drawn into top-level windows.

     

    (Drawing the thumbnail directly into the main window won't work as the thumbnail is of the main window and DWM checks for such loops.)

     

    When I create the effects window as a popup (WS_POPUP) I am specifying the main window as the parent in the CreateWindowEx call, but that doesn't seem to help. It opens in-place instantly instead of being animated like the main window is.

     

    If I call SetParent on the effects window right after creating it, specifying the main window as its parent, then that breaks the DWM thumbnail.