How can I know which themepack is applied on my system? - c++

Normally when we double click on a themepack file it is applied on our system and a corresponding folder with the same name as the themepack is saved in
C:\Users\<username>\AppData\Local\Microsoft\Windows\Themes
Now if I have multiple themepack files and I have applied each of them at least once, then all the themepacks will have a corresponding folder in the Themes folder. Now I want to know which particular theme is applied on my machine, programmatically.
(When we use a themepack file Custom.theme file is not updated)

I'm pretty sure there's no API that can retrieve that information. Which makes sense, it isn't really relevant. An application never needs to know the name of the theme pack that the user selected.
What you can get using an API, and what is useful, is the name and properties of the theme that the user has enabled. For example, calling the GetCurrentThemeName() function and/or the GetThemeDocumentationProperty() function.aspx) with SZ_THDOCPROP_DISPLAYNAME will tell you whether the user has enabled the Aero theme or not. Or if they're using a custom theme that is not Aero. Just to be sure, though, I tested it, and neither of those functions returns the name of my currently selected theme pack.
However, you can read the registry to obtain the information you desire. Find it in the following location:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\CurrentTheme
That value will contain a string corresponding to the full path to the currently selected theme pack, e.g.:
C:\Users\billg\AppData\Local\Microsoft\Windows\Themes\Pink Polka Dots.theme
If you want, you can strip out the path spec and extension, using just the file name as the name of the theme pack, e.g. Pink Polka Dots.
But that isn't a complete solution because it doesn't take localization into account. Especially with system-provided theme packs, the file name is going to be in English, but the name of the theme pack is going to be localized in the UI. The user sees something different when they pick themes.

Related

How to skip choosing folder in microsoft pdf printer?

I use MFC and understand how to skip configuration menu (set pInfo->m_bDirect to false). But I want to set the folder and filename programmatically, without a special dialog. If it is impossible, can you advise me about a PDF printer with this functionality (may be changing configuration file for this goal)?
One question at a time, has limitations so here goes.
Q.) I want set folder and filename programmatically without special dialog.
A.) If you look at the output port of a recent windows installation of Microsoft Print To PDF
You may note it is set to PORTPROMPT: and that is exactly what causes the request for a filename.
You might note lower down, I have several ports set to a filename, and the fourth one down is called "My Print to PDF"
So very last century methodology; when I print with a *duplicate printer but give it a different name I can use different page ratios etc., without altering the built in standard one. The output for a file will naturally be built:-
Exactly in one repeatable location, that I can file monitor and rename it, based on the source calling the print sequence, such that if it is my current default printer I can right click files to print to a known \folder\file.pdf
Your next question will be how to change the target location and that is done behind the scenes when using apps such as WordPad Command Line printing where we can specify the port name on the command line.
Some users will use a Port Redirection Monitor (Do NOT use RedMon as unsupported in Win 10, consider Multi Port Redirector)
Other Users will interact with the duplicate named printer directly via PrintUI where you can alter output port, rotation or paper format etc.
And for your usage you could try one of these for hints, with your newly defined PDF printer:-
Microsoft Web Browser ActiveX control - printing to a specified (non default) printer
Programmatically set filename and path in Microsoft Print to PDF printer

NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription ignored

Xcode 8.2 beta 8C30a, Swift 3, iPhone 5s.
I'm writing a weather app that wants to use the iPhone's location. To get authorisation I have set (all of) the following my Info.plist:
<key>NSLocationAlwaysUsageDescription</key>
<string>Your current location is used to provide you with a local weather forecast.</string>
<key>NSLocationUsageDescription</key>
<string>Your current location is used to provide you with a local weather forecast.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your current location is used to provide you with a local weather forecast.</string>
Nevertheless, when I call LocationManager.requestWhenInUseAuthorization() then I get the following error:
This app has attempted to access privacy-sensitive data without a usage description.
The app's Info.plist must contain an NSLocationWhenInUseUsageDescription key
with a string value explaining to the user how the app uses this data
The key is there but not being seen. There is no entry for the app in the phone's settings menu (nor under privacy). Doubtless, I'm missing something simple. Any ideas?
I just encountered the same problem with one particular App, and I have several Apps with the same structure which are working just fine when I request authorization for Location Services.
In all cases, I have localized the Application, so I have several Info.plist files in my XCode project (e.g. one for the Base language which is English, another for French, etc).
I always manually edit my Info.plist files (viewing them "as Source Code") and add the NSLocationWhenInUseUsageDescription fields).
But in this specific App's case, I noticed that XCode was NOT showing the NSLocationWhenInUsageDescription field when I selected the App Target in the Project's list of Targets and then clicked on the "Info" tab. This is odd, because when I check the "Info" tab in my other XCode projects, edits made to the Info.plist file for the Base language appear here. So I manually added a NSLocationWhenInUseUsageDescription field to this "Info" UI and suddenly my new App was working correctly, requesting the user's permission to access Location Services when in use.
I'd recommend checking that all the fields you have added to your Info.plist file are reflected in the Target/Info screen. If they are not, you may have a similar problem, in which case the same fix may work for you.
I am guessing the root cause of the problem is a bug in the localization process. I recall that after selecting the Info.plist file as one of my localized files, I got an error from XCode at build time, complaining that it was missing an Info.plist file (it had moved Info.plist from the base.lproj folder to en.lproj when it "localized" the file). I reinstated the file that XCode had moved from the base.lproj folder to the en.lproj folder, and that seemed to make XCode happy again. But I think somehow it lost the ability to refresh itself, so subsequent additions to the Info.plist file(s) aren't being applied everywhere they need to be).

how to access image property list and manipulate in MITK

I am developing a plugin for MITK, which is a tookit for medical imaging. I want to access the full path of image that is loaded in the data manager.
There are properties of images like name, opacity, path etc.
I searched MITK documentation but I could not find any proper information related to that.
Can you please help me?
If you want to see the 'path' in the UI, you can use the Properties plugin, available in the MITK Workbench and in your own app if you decided to include it.
If you want to access the content of the 'path' property in the code, then you need a mitk::DataNode in the current scope, because properties are usually related to node.
std::string path;
node->GetStringProperty("path", path);
Note that this won't give you the full path though. For some reason, MITK decided to remove the extension in this property, thus giving something like D://Data/brain instead of the D://Data/brain.nii.gz that I wanted.
AFAIK, there's currently no 100% safe way to get the real full path in MITK, but one could easily search on the file system using path + ".*" and hoping that it returns only one result :)
The property is not on the DataNode but in the BaseData in it. There is a 'path' property there. You can see its value when right-click the image and selecting 'details'

Mura 6.1 Include cfm page error

I am using this code for display my page in page content in MURA 6.1
<div>[mura]$.dspInclude('display_objects/custom/main.cfm')[/mura]</div>
But it gives me the error below:
Note: If you wish to use an absolute template path (for example,
template="/mypath/index.cfm") with CFINCLUDE, you must create a
mapping for the path using the ColdFusion Administrator. Or, you can
use per-application settings to specify mappings specific to this
application by specifying a mappings struct to THIS.mappings in
Application.cfc. Using relative paths (for example,
template="index.cfm" or template="../index.cfm") does not require the
creation of any special mappings. It is therefore recommended that you
use relative paths with CFINCLUDE whenever possible. Could not find
the included template
/muraWRM/default/includes/display_objects/custom/main.cfm.
The physical path is
[siteid]/default\includes\themes\rescue\display_objects
Thanks in advance
This should work
<div>[mura]$.dspInclude('themes/rescue/display_objects/custom/main.cfm')[/mura]</div>
Your include is being called from the includes folder, so you need to include the themes folder and the rescue folder to get to the right path.
For consistency across themes, you might want to use Mura's setting for the theme name, but I would have to look that up.
If you are ok hard coding it, this should work just fine.

Magento - locate specific core files

I am familiar with theming and using template hints in the Magento back office to locate .phtml files.
What I am not really familiar with are the core files such as app/code/core/Mage/Catalog/Model
What I need to do is override a core file like I would a core phtml file by copying it to 'my theme'.
I basically want to amend some labels which appear on the order summary page of the Magento checkout process - domain.com/checkout/cart/
I followed the trail to the phtml files using template hints. Within the app/design/frontend/default/mytheme/template/checkout/cart I found the code
renderTotals(); ?>
Now I managed, by accident, to stumble upon two of the files I wanted to change:
/httpdocs/app/code/local/Mage/Sales/Model/Quote/Address/Total/Grand.php
/httpdocs/app/code/local/Mage/Sales/Model/Quote/Address/Total/Shipping.php
I made local copies of these files (http://www.magentocommerce.com/wiki/how_to/how_to_create_a_local_copy_of_app_code_core_mage) to override the default labels, like I would if I was overriding a template file.
My question is, how can you locate core files which pertain to the 'stuff' you want to change, located in function calls such as renderTotals(); ?> in the phtml files?
Not being able to pinpoint stuff like I can with template hints is slowing me down, and I am struggling to find a solution as I am not up on all the vocab surrounding Magento yet.
Hope this makes sense and thanks in advance!
From the same settings page where you turn on Template Path Hints, also turn on the "Add Block Names to Hints" setting. This will show you PHP class names such as: Mage_Sales_Model_Quote_Address_Total_Grand to which you can deduce the folder path (underscores represent a subfolder, and the last piece represents the file name).
If you're getting a block such as Mage_Sales_Model_Quote_Address_Total_Default then sometimes it just takes a little common sense to see that it's pulling in other files from the same folder (such as Grand.php and Shipping.php). But there are generally only a couple files in the same folder, so this is pretty easy to see.
As Sid Vel said, a good Search Project functionality is helpful. But if you find yourself looking at Abstract.php of some class, often you need to look in a subfolder in that directory with the proper name to find the concrete implementations. But still, it gets you very close to where you need to be.
I always use Dreamweaver's site / directory search function. It will scan through all the files in the Core folder and tell you where the function is from. In your case, I would search for "renderTotals". You need to enable PHTML editing in Dreamweaver.
Most IDE's will allow this kind of search option. In Aptana you can Ctrl + Click on the function to open the file it is coming from. Magento takes ages to index itself on Aptana, due to its sheer size.