How to change the title/caption of MFC SDI documentless application - visual-studio-2010

I can't find a working solution to change the title of my MFC SDI application. I don't use document/view. I need to change the title according to internal state of the applicaiton.
I've tried CMainFrame::SetWindowText from my main app module in InitInstance - with no luck.
I've tried to change CMainFrame::m_strTitle member variable and call OnUpdateFrameTitle(TRUE) after that - still no luck.
Inside OnTimer procedure - calling AfxGetMainWnd()->SetWindowText(_T("title from OnTimer")); - it does not work either.
What am I missing? That should be a common and simple task, shouldn't it?
EDIT: I'm sorry, it seems SetWindowText is working, just need to properly compile my app.
That's all my fault.

Overwrite CMainFrame::PreCreateWindow.
Clear the style FWS_ADDTOTITLE
cs.style &= ~(LONG)FWS_ADDTOTITLE;
Now it should be possible the window caption in any way you like.
The Default window caption is taken from the string resource with the ID AFX_IDS_APP_TITLE.

Related

Silence Script Error in Web Browser for Android from Delphi XE7 FireMonkey

I am trying to silence the error alert windows in delphi xe7 webbrowser.
Webbroser for Win:
      Webbrowser.Silent = false;
Webbrowser for Android?
.................................
Thanks in advance
On Android, you'd need to write some Java code to include with your project, because you need to assign an instance of a descendant of WebChromeClient that overrides the onJsAlert method, as per this answer:
https://stackoverflow.com/a/37082558/3164070
Then you would need to create an import for that class for Delphi, create an instance of it, and pass it in a call to the setWebChromeClient method on the WebBrowser (JWebBrowser) instance in the TAndroidWebBrowserService class in the FMX.WebBrowser.Android unit i.e. you would need to modify that unit for this to all work.
A more complete answer would probably take a few hours, however this should give you an idea of what you're up against

Extjs 4.2.1 - Draggable/Undraggable windows on the fly

In my application, I have 4 windows on the screen and all the windows are draggable.
My need is that, all the windows should be made draggable/undraggable on a click of a button(toggle).
I set draggable true/false on the fly. But, the property is not updated. I even closed and opened the window once the draggable property is changed. But, ended in vain.
Any help is appreciated.
I think, I need doLayout() kind of thing to update the change.
Try enable and disable methods on window.dd object:
w.dd.disable(); // disables d&d
w.dd.enable(); // enables d&d
Sample: http://jsfiddle.net/cb7rtcya/1/ (It's written in Ext JS 5, but should work also on 4)

How to get an Innosetup installer package to display a non-scaled icon image (>32x32)

I've started using 'large' icons on my desktop. For a while I've also been including images > 32x32 in my Delphi Application. The result is a nice clean image display in all Windows display situtations. I know its rather picky, but i've just noticed that a compiled Innosetup package displays fuzzy - I presume its being scaled - and it occured to me that there must be a way of adding to or changing the default Innosetup image displayed for its EXE. You can see the effect in the image below. I have many icons available to me, so a solution for replacing the default icon would be great.
Ah I found it. To specify a custom icon for a setup application, use the SetupIconFile directive:
[Setup]
SetupIconFile="MyIcon.ico"

Use ApplicationBar Icons from other assemblies?

I have a Page in a Windows Phone class library. This page has an appbar. I would prefer everything this page needs to be included within the class library so the setup list for consumers of this page / assembly is minimal.
However, When I set ApplicationBar icons, they get added to the class library project under the folder 'icons' just like normal, they show up fine in Blend, but at runtime they are no where to be found!
When I put the icons in the Windows Phone Application project all is well. However this is not my desired scenario as it is additional configuration / setup by the application author to use my pages.
I tried using the resource pathing using /{AssemblyName};component/icons/{IconName} but of course the AppBar needs them to be of type "Content" not "Resource". So I am thinking this is impossible but I wanted to know if anybody out there figured out how to do this.
Sorry guys. I just figured it out. I changed the newly added icons from "Resource" to "Content" but I forgot to set "Copy if newer" so they weren't getting outputted to the Bin\Debug\icons folder of the windows Phone Application. something to keep an eye on I guess.

Windows xp Change Wallpaper to Webpage

To do this manual i just pick a html file in the change wallpaper dialog and tada works..
but if i want to do this from code what api calls / reg keys must i change?
Iv tryed this SystemParametersInfo (WinAPI) didnt work and i have found out that "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\Wallpaper" and "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\LastTheme\Wallpaper" are changed to the html page.. but just editing those to from code does not change the wallpaper..
In order to use HTML as wallpaper, ActiveDesktop needs to be enabled first. Assuming that is already the case, then the IActiveDesktop interface has a SetWallpaper() method available. Have a look at MSDN's "Using the Active Desktop Object" article for how to access IActiveDesktop.

Resources