Edit: More Information
I've narrowed it down to certain applications on certain computers. I am trying to launch chrome in a full screen mode on a certain monitor. This works perfectly on most systems I have tested however we have run into a set of computers running Windows 7 Pro 32bit which are being moved and resized correctly, but their border and buttons are still intact.
I realize that chrome windows all spawn under a single chrome process and that their lifecycle is volatile, but we have been able to work around this using a separate data directory which keeps each chrome instance launched that way in it's own parent process. Chrome seems to be the only application we have problems launching full screen and only on one set of computers. When running calc.exe for instance it maximizes and removes the borders without any problems on all systems we have tested. I have confirmed that the version of chrome running on each system is the same. I would really appreciate it if anyone had more insight into either this problem, or ways of further troubleshooting the issue.
I'm trying to run an application in a full screen mode using SetWindowLong and it's worked great up until the latest computer I tried it on. I am basically using the code referenced in this question: Removing window border?
This works fine on both of my laptops (Windows 7 Ultimate) and a couple work boxes that I have tested it on (Windows 7 POS Embedded) but it's not working on another computer at work (Windows 7 Professional). The SetWindowLong call is returning the expected value which indicates to me that it should be working, and the call to SetWindowPos works fine as it's resizing the window correctly, but the border and buttons are still there! It's functioning as if there was no call to SetWindowLong at all. I would greatly appreciate some help as I'm out of ideas at this point.
Edit: Here is the code in all it's 1AM red eyed glory. Pretty much a direct copy of the linked question.
int lStyle = GetWindowLong(process.MainWindowHandle, GWL_STYLE);
lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU);
_logger.Debug(String.Format("Style: {0}", lStyle)); // 369295360
var swlResult = SetWindowLong(process.MainWindowHandle, GWL_STYLE, lStyle);
_logger.Debug(String.Format("SetWindowLong: {0}", swlResult)); // 382664704
int lExStyle = GetWindowLong(process.MainWindowHandle, GWL_EXSTYLE);
lExStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
SetWindowLong(process.MainWindowHandle, GWL_EXSTYLE, lExStyle);
Screen screen = GetDisplay(display);
return SetWindowPos(
process.MainWindowHandle,
HWND_TOPMOST,
screen.WorkingArea.Left,
screen.WorkingArea.Top,
screen.WorkingArea.Width,
screen.WorkingArea.Height,
SetWindowPosFlags.SWP_FRAMECHANGED);
Found the problem. We are using LogMeIn for remote computer management, and it seems like their video mirror driver is causing problems on certain machines. Uninstalling their mirror driver, and restarting causes everything to work as expected.
It is also the case that this fails with out-of-date copies of XP (even SP3, and perhaps others). I have confirmed on over a dozen workstations that installing recommended updates resolves this issue. There were an average of updates needed on each, so it's hard to say which one did the trick, but apparently one of them did. Yet another reason to keep updates enabled.
Is the Windows 7 Professional system 64 bit? According to the documentation for SetWindowLong
This function has been superseded by the SetWindowLongPtr function. To write code that is compatible with both 32-bit and 64-bit versions of Windows, use the SetWindowLongPtr function.
Try modifying your code to call the SetWindowLongPtr function on 64 bit systems and see what happens.
Related
I am developing a WPF application that displays a directX scene.
The code that generates the directX scene is not mine and I have no access to it. (Its not a public code I can references you guys to)
Everything was working fine until I had to format my PC and installed Windows 10. (Before that I had Windows 7)
Now I can't see the DirectX scene and the RenderCapability.Tier on WPF returns 0.
The code works on other computers (Windows 7 and Windows 10) so I'm guessing its something to do with my computer but nothing changed hardware-wise..
I tried reinstalling DirectX and I tried reinstalling the display driver (tried several different drivers) but nothing works I still get RenderCapability.Tier = 0.
The code that displays the DirectX scene is mostly taken from this link:
https://www.codeproject.com/Articles/28526/Introduction-to-D3DImage
I couldn't find any help around the internet that actually solved my problem.
Any help would be appreciated.
Thanks!
Run dxdiag.exe, Display tab, ensure it prints "D3D acceleration: enabled" and "No problems found".
Also the linked sample has a bug, on some systems you must use a query to wait for completion of rendering before passing the texture to WPF. Otherwise WPF may show incomplete renderings, or none at all. If you render with DX9, see this, you need D3DQUERYTYPE_EVENT query, issue D3DISSUE_END after you've done rendering, then sleep until GetData returns S_OK.
As of last week, users have started getting a script error saying "The Google Maps API does not support this browser" when trying to map directions using the Google Maps API from within an embedded WebBrowser control in our application. I have run into issues like this before, but was able to work around them using IE browser emulation. However, it is now erroring no matter which version of IE I have installed, which version I emulate (including IE11), or whether emulation is turned off completely. Prior to last week, this was working correctly, so I'm assuming Google changed something on their side.
Here is an example URL that gets this error: https://www.google.com/maps/dir/?api=1&origin=123+Main+Street,+Dobbs+Ferry,+NY&destination=123+Main+St,+White+Plains,+NY&travelmode=driving
Does anyone know of any fixes or workarounds other than replacing the terrible WinForms WebBrowser control entirely?
I figured out what was wrong after reading this article. When turning on browser emulation, I was enabling it in ...SOFTWARE\WOW6432Node\Microsoft\Internet Explorer... in the registry instead of ...SOFTWARE\Microsoft\Internet Explorer... because I was running on a 64 bit OS. However, you are only supposed to use the WOW6432Node path if you are running a 32 bit application on a 64 bit OS. I changed it to use the other path for a 64 bit application on a 64 bit OS and it now works. Thanks for the help!
While running performance tests my application suddenly started giving blue screen shortly after the UI was loaded.
In the code im receiving the following error:
{"Error HRESULT E_FAIL has been returned from a call to a COM component."}
"The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action.\r\n"
After looking around on google i wasn't able to find anything usefull. The main answers given didn't work such as installing driver updates or reinstalling the application. Keep in mind this is an app in development and it was working fine earlier this day. Between two test launches this happened.
EDIT
After testing the application on a tablet it turns out the development pc is the only machine with the UI loading bug. Going to look into it some more and ill let you guys know if i find a solution.
Edit 2
So after testing the app on the tablet and finding that it works fine there we decided to test the app on a 2nd development pc. Needless to say the same thing happened... in other words its a rendering issue that happens on windows 8.1 PC's but not on a tablet.
Facts as of now:
- Code worked yesterday, no longer works now
- Works on tablet but not on PC
- Nothing changed in the code since it worked
- Seems to happen in the rendering stages
- Bug happens when loading more than 23 items in a listview, app restores itself then
- Any more than 23 items and it stays bugged (dark blue screen but still responds to clicks)
I started facing the weird problem recently on my new laptop.
I installed a fresh copy of Windows 8.1 and then Visual Studio Ultimate 2013.
It worked fine for the first few hours, but the next time I opened it, it did not show the UI elements in the XAML Designer view. There's no error, the XAML code is perfectly alright and then on hovering over the supposed-to-be-visible elements, their outline is visible as well as selectable.
Surprisingly this is the case only with all new Windows Store Projects I open or create. The Windows Phone App Designer View works perfectly fine.
I reinstalled Visual Studio a couple of times and at last even formatted the OS and reinstalled it, but the problem still persists.
#JTIM: Sure!!
Posted by Varun Mashru on 5/23/2014 at 3:54 AM on Visual Studio Feedback Forum
Surprisingly and fortunately, I found the solution just two days ago.
It bit of a bummer but that's what it is.
Its nothing to do with the VS setup or the OS.
The first thing to notice here is that it happens with notebooks only.
The REASON??
Because notebooks do not have completely dedicated GPUs. These GPUs
act as secondary processors for the onboard graphics solution which is
directly connected to the display. Hence they fire up only when
needed.
My notebook Dell Inspiron 15 3537 -- Core i5 4200U (Intel HD Graphics
4400 onboard) + AMD Radeon HD 8670M has got a switchable graphics
solution. Hence the software chooses as to which GPU does the
weight-lifting.
The power settings when cranked up to the max indicate that the AMD
GPU must be the one that should take the lead.
And in the case of VS it does not happen properly (Don't know why??).
Maybe the UI components cant decide that which GPU processor to choose
or whatever.
So the simple workaround I found was to bring the graphics settings
down by just a notch. Which is selecting the 'Optimize Performance'
option in the Switchable Graphics instead of 'Maximize Performance'
field in the power plans.
And voila, It works perfectly fine!!!!
Share this with everyone who has freaked out for months on this
issue!! :)
I'm using the code below to take a screenshot of all the active displays combined.
Rectangle totalSize = Rectangle.Empty;
foreach (Screen s in Screen.AllScreens)
totalSize = Rectangle.Union(totalSize, s.Bounds);
Bitmap screenShotBMP = new Bitmap(
totalSize.Width, totalSize.Height,
PixelFormat.Format32bppArgb);
Graphics screenShotGraphics = Graphics.FromImage(
screenShotBMP);
screenShotGraphics.CopyFromScreen(
totalSize.Location.X,
totalSize.Location.Y,
0, 0, totalSize.Size,
CopyPixelOperation.SourceCopy);
I've tested this on two different machines so far, and when World of Warcraft is running full-screen one machine takes a picture of the WoW screen and the other one takes a picture of the desktop. I wouldn't have been surprised if this code never worked to take a screenshot of WoW, because (I assume) it uses DirectX to write directly to the video card. However, since it does work in one case, I'd like to know if there's something I can change in the code and/or the machine configuration to make it work in all cases. (For WoW, at least. I realize there are probably many other games that won't work.) It doesn't seem to be a framework version issue, as I have compiled my code against different versions and the behavior doesn't change.
Machine #1, which takes the WoW picture, is running 64-bit Win7 Professional and has .NET Framework versions 2.0 thru 4.0 installed.
Machine #2, which takes the desktop picture, is running 32-bit Win7 Home Premium SP1 with .NET Framework versions 1.0 thru 4.0 installed.
Edited to add: Another data point is that if I switch Machine #2 from a Win7 Aero desktop theme to the "classic" theme, I start getting WoW pictures instead of desktop pictures.
I added a call to:
DwmEnableComposition(DWM_EC_DISABLECOMPOSITION);
as per the answer to Enabling/Disabling Aero from a Windows Service, and that fixes the problem. I don't really understand why, however.