Different theme depending on if app is run from Visual Studio or not Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
subi211
Earned a small fee
Earned a small fee
Posts: 11
Joined: Wed Nov 12, 2014 5:55 pm

Different theme depending on if app is run from Visual Studio or not

Post by subi211 »

I've found that when my WX app is launched from Visual Studio is has a different appearance to when it's launched normally:
wx_launched_from_visual_studio_and_explorer.png
wx_launched_from_visual_studio_and_explorer.png (8.07 KiB) Viewed 2283 times
At a first guess, I would presume it's picking up the style from VS when launched from there, but obviously not from Explorer.

The problem is that is makes it a bit awkward to position and size new controls if the style is different, and to be perfectly honest I prefer how VS is making it look anyway. :) So can anyone tell me what's actually causing this, and how I can keep the style cause by VS?

I've found this on Windows 7 and 10, using both VS 2012 and 2015.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: Different theme depending on if app is run from Visual Studio or not

Post by eranon »

It sounds like you don't have manifest matching your executable when you launch it from outside Visual Studio. I don't use VS, so I can't tell you if it manages some default manifest when an app is ran from within it, but what I know is that your finale app needs an embedded manifest (using the mt.exe tool -- https://msdn.microsoft.com/en-us/librar ... s.85).aspx) or a one as file beside your exe (in the same directory).
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
subi211
Earned a small fee
Earned a small fee
Posts: 11
Joined: Wed Nov 12, 2014 5:55 pm

Re: Different theme depending on if app is run from Visual Studio or not

Post by subi211 »

Excellent, that was it. Thanks! :)

We're using JAM as a build process, so the embed obviously wasn't getting done.

For anyone else, this is the required mt call:

Code: Select all

mt -manifest application.exe.manifest -outputresource:application.exe;1
I found simply having the manifest in the same directory as the executable was unreliable, so it's safer to embed.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: Different theme depending on if app is run from Visual Studio or not

Post by eranon »

Cool! Yes, of course, unless special need (eg. if the app manages a set of manifests for itself to obtain different behaviors), the manifest has to be embedded in your finale RELEASE build. On my part, I use a separated manifest for any DEBUG build. This way, I can easily modify it afterward and see the effect on my app... So, just a facility during dev cycle (not for the finale release).

Also, be awware that wxWidgets itself can provide its own manifest if wxUSE_NO_MANIFEST is O... I don't remember the default (1 or 0), but in my apps I'm used to "#define wxUSE_NO_MANIFEST 1" to be sure it will not conflict with my own embedding (and because, I experienced an issue with wxWidgets 3.0 in the past: it provided a manifest saying AMD64 for a 32-bit build; since this date I only go my way at post-build stage).
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Post Reply