Hello Guys,
I want to change my today wallpaper. This should happen out of a programm.
Therefore I've written a C++ Programm;
Code:
#include "stdafx.h"
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETDESKWALLPAPER, 1);
return 0;
}
I change the Wallpaper by a script. This works. When I open the today stettings I see that my background Image is selected. Afterwards I run this programm. But it doesen't update my Today image.
I hope that someone can help me.
best regards
Robert
Does noone know a solution?
I am successfully changing wallpaper by just copying a new image over the image file in the windows folder and issuing:
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
I found code on the internet that is doing the same thing I'm doing in another language. See http://roam.svn.sourceforge.net/viewvc/roam/Trunk/Source/Roam.UI/Utils/DesktopUtils.cs?revision=73&view=markup and look at the "SetWallpaper" routine. You'll see that the OS wants to use "\Windows\stwater_240_320.jpg" (portrait) and "\Windows\stwater_320_240.jpg" (landscape).
In the code referenced above it just copies a new image(s) over the stwater images and then issues a WM_WININICHANGE message.
As I said, I am doing this now and I see the today screen immediately update. This message forces the wallpaper to load and all the today items to update as well.
I do not even use the
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETDESKWALLPAPER, 1);
When I ope the Today Settings, I see that my wallpaper is selected but it isn't updated. I don't to rename my image because it should work for all images.
To change the wallpaper I change the value "Wall" in HKCU\Software\Microsoft\Today in the registry to:"My Documents\Files\Hh_fw_background.png"
But it won't be updated.
Updating the today elements with SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0) works.
usbprog said:
When I ope the Today Settings, I see that my wallpaper is selected but it isn't updated. I don't to rename my image because it should work for all images.
To change the wallpaper I change the value "Wall" in HKCU\Software\Microsoft\Today in the registry to:"My Documents\Files\Hh_fw_background.png"
...
Click to expand...
Click to collapse
I don't think so. When you set a wallpaper in settings or in Pictures/Video, it copies your original image to the 2 images referenced in my previous post. AFAIK everytime you issue a WM_WININICHANGE message, the OS loads the images in the windows folder for the wallpaper. If you don't change those images your wallpaper will never change.
Related
I received a CAB file from my friend, and when I tried to install it, I found that it has a popup message from my friend telling me a joke...
how he do that?
and how can I change that message?
Still No Comment...!
Please Help!
I asume you know how to make a cab to start with????
As you know there are exported functions in the dll that the cab uses (you make the dll). For example this is the normal look of whats exportd. Bellow is whats in the def file.
--------------------------------------------------------------------------
; TestSetup.def : Declares the module parameters for the DLL.
LIBRARY "TESTSETUP"
;DESCRIPTION 'TESTSETUP Windows CE Dynamic Link Library'
EXPORTS
Install_Init
Install_Exit
Uninstall_Init
Uninstall_Exit
now in the code for one of those you just make a dialog like normal.
The code below is cut out of one of my working cabs. Because its in Install_Init it is the first thing to happen. Changing the method to Install_Exit would give the message after the instalation.
#include "stdafx.h"
#include "TestSetup.h"
#include "ce_setup.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "MyAboutDialog.h"
BOOL CALLBACK gAboutDialogProc(HWND h_dlg, UINT my_message, WPARAM wpAram, LPARAM lpAram);
static CMyAboutDialog* myAbout= new CMyAboutDialog();
BOOL CALLBACK gAboutDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return myAbout->AboutProc(hWnd,uMsg,wParam,lParam);
}
/////////////////////////////////////////////////////////////////////////////
// CTestSetupApp
BEGIN_MESSAGE_MAP(CTestSetupApp, CWinApp)
//{{AFX_MSG_MAP(CTestSetupApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestSetupApp construction
CTestSetupApp::CTestSetupApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CTestSetupApp object
CTestSetupApp theApp;
/////////////////////////////////////////////////////////////////////
codeINSTALL_INIT
Install_Init( HWND hwndParent,
BOOL fFirstCall,
BOOL fPreviouslyInstalled,
LPCTSTR pszInstallDir )
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DialogBox:AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDD_AboutDIALOG),
hwndParent,
(DLGPROC)gAboutDialogProc);
return codeINSTALL_INIT_CONTINUE;
}
//------------------------------------------------------------------
Of course the detail of the dialog is in the MyAboutDialog. You just make your own to do what you want.
You can do just about anything from the code you put in the cab's dll, but a lot of the instalation should be left up to cabwiz to generate. What ever you do put in the dll will permanently reside in the windows folder until the user removes the program, so don't make it too big.
Thanks Dear OdeeanRDeathshead...
your reply is more than an informative article.
however, I hope if you can answer my second part of the question...
how can I remove the message from a CAB file that i have?
I you want to remove the message on an existing cab then that is more complicated. If you know everything that the cab dose when it gets tapped (eg registry changes etc) then you could gather all the file that the cab installs and use them to re-write them into a new cab that has no messages. This is more trouble than its worth. Unless your friend is willing to give you detailed info on what his cab dose you would be bound to miss something.
Also many messages are as a result of the os, and these vary depending on the version of os. You can't stop some of those (on every platform).
Most people would not want their instalation packages tampered with.
Try to extract the .cab file with Win CE Cab manager. Remove the Setup.dll, hopefully it does not do anything else then showing the joke Then build your own version of it.
for any complex instalation I doubt that doing that would leave you with a working instalation. Still its worth a go if it saves time. What I would like to know (not having vis studio 2005 yet) is why dose the wm2005 device always ask where you want to put the software even when you have turned this feature off? When one's coding gets a bit lazy it can all fall appart when put in a location other than that you expect.
OdeeanRDeathshead, I assume you are referring to whether to install to main memory or to SD question (this dialog pups up on WM5 device with SD inserted or built in storage).
To avoid it remove the InstDir string from your inf file (or change the string name to something else). This will force the software installation to the directory you specify in the cab.
I did not want to hard code the directory, so I used
InstallDir="%CE2%"
That should get the location of the windows folder for the install. Are you saying that if I just put
InstallDir="\windows\"
it will force it there. Dose this mean that there is a new table of Windows CE Directory Identifiers or that installs just always ask if you use them?
No, what I meant was you don’t want a string call 'InstallDir' in your inf file.
The 'InstallDir' is just a string definition you may or may not use later in the inf (like #define in C).
What determines where the files are installed is what's in the [DestinationDirs] section.
For example:
Files.Windows = 0,%CE2%
You should delete the line InstallDir = completely from your inf file, or if this string appears else where (except [CEStrings] section) just change it to something like MyDir= (be sure to change it every ware it appears in the file)
I'm hoping someone can help me build a small exe that will change a single registry value.
Device: Touch Pro running custom 6.5.3 ROM built from SDK
Problem: on my Touch Pro, when I run the 'Align Screen' routine, the following registry entry is created...
[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\KEYBD]
"FirstCalibration"=dword:00000001
For some reason this is conflicting with the default Windows Unlock routine and causes a 2 to 3 second delay when turning on the device.
http://forum.xda-developers.com/showthread.php?t=587931
Deleting or changing the key to dword:00000000 prevents the issue. This is easily fixed manually.
Reason: I am building a WM 6.5.3 ROM ported from the 6.5.3 SDK released by MS last month (99% complete). I am doing it in a way that uses little to no 3rd party software, just a few basic drivers. I would like to avoid using MortScript or FdcSoft TaskMgr. I find that stylus accuracy is poor if I skip the Screen Align during Welcome/First boot. Since the registry is changed after the initial first boot, it is not possible to make the change part of my ROM.
My options are to have the user make the change manually themselves, have them run a cab to make the change or create a small exe that runs during start up that sets the key to 0. I think option 3 is best (I'm open to other ideas).
Anyway, I have eVC++ 4 + PPC2003 SDK installed (I don't have access to VS2005 or 2008).
I also modified a snipet of code that I found which should make the change for me....
Code:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
namespace RegistryAccess
{
class Program
{
static void Main(string[] args)
{
RegistryKey baseKey = Registry.LocalMachine;
RegistryKey hardwareKey = baseKey.OpenSubKey("HARDWARE", true);
RegistryKey devicemapKey = hardwareKey.OpenSubKey("DEVICEMAP", true);
RegistryKey keybdKey = devicemapKey.OpenSubKey("KEYBD", true);
keybdKey.SetValue("FirstCalibration", 0);
}
}
}
I'm stuck compiling/building the above code into a executable. Any help would be appreciated. =)
I did a search for the RegistryKey class and it looks like it is part of .NET, which I can't do with eVC++.
I did find the following page which has several samples of code for accessing the registry using eVC++. Using voregistry seems like a good idea.
http://windowsmobiledn.com/working-with-registry-on-pocket-pc/
I tried to use the voregistry code in a new project, but when I build it I get an error due to CString being undeclared. I'm guessing I need to include a library that includes the CString class, but I'm not sure what to include.
Well I'm more a newbie that an expert, but
Won't a .cab solve it ?
you can put reg change in .cab
So you will just have to install it each time it is necessary... instead of runnig an .exe
This should do the trick....
In eVC create an app as a simple CE application.
Code:
#include "stdafx.h"
#include "Winreg.h"
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
DWORD Value=0;
HKEY RegKey;
RegOpenKeyEx(HKEY_LOCAL_MACHINE,TEXT("\\HARDWARE\\DEVICEMAP\\KEYBD"),0,0,&RegKey);
RegSetValueEx(RegKey,TEXT("FirstCalibration"),NULL,REG_DWORD, (unsigned char *) &Value ,sizeof Value);
RegCloseKey(RegKey);
return 0;
}
Works perfectly stephj, thank you so very much.
darksasas said:
Well I'm more a newbie that an expert, but
Won't a .cab solve it ?
you can put reg change in .cab
So you will just have to install it each time it is necessary... instead of runnig an .exe
Click to expand...
Click to collapse
True, this change could be made by cab. Actually, there are many ways to make the change manually or automatically (use MortScript to execute change, import reg using TaskMgr, use AutoRun to execute provxml, etc etc). In this case, I wanted to implement a fix that would require no intervention by the user of my ROM and didn't use any 3rd party software.
I may not use it in my final version, but now I have the option if I so choose. Thank you again stephj.
Mabey it's an idea to make your ROM UC Capable?
[App] ROM Flashing Junkies: User Customization is here!
http://forum.xda-developers.com/showthread.php?t=366337
Within this thread there is an application called SDConfig.txt creator which was created by DoeDoe's. Currently it is replaced by;
[Release] UC ROM SDConfig.txt Builder (reborn) [Prikolchik Ed.]
http://forum.xda-developers.com/showthread.php?t=390846
and ofcourse;
SDConfig Builder Mobile by l3v5y
http://forum.xda-developers.com/showthread.php?p=2114491
It's just an idea
Senax
Senax said:
[App] ROM Flashing Junkies: User Customization is here!
http://forum.xda-developers.com/showthread.php?t=366337
Within this thread there is an application called SDConfig.txt creator which was created by DoeDoe's. Currently it is replaced by;
[Release] UC ROM SDConfig.txt Builder (reborn) [Prikolchik Ed.]
http://forum.xda-developers.com/showthread.php?t=390846
and ofcourse;
SDConfig Builder Mobile by l3v5y
http://forum.xda-developers.com/showthread.php?p=2114491
It's just an idea
Senax
Click to expand...
Click to collapse
That would work as well, but again with 3rd party software.
Hey guys
I declared an image in the layout.xml file and now I want it do disappear with a command from the java file.
Any ideas how I could do this?
thx and greez visosilver
You need to give the ImageView an id and then simply reference it from inside the code with something like this:
Code:
ImageView iv = (ImageView) findViewById(id); // id is the id of the image you want to remove
iv.setVisibility(8);
thx a lot dude, thats working!
greez visosilver
I was task to allocate only 1GB of space to store my videos in a particular file directory where it is going to auto-delete the oldest video file in that directory once its about to reach/hit 1GB?
And i eventually found these code but i was left with a problem on how to incorporate these example 1/2 codes into my current existing mainActivity.java file because of the differences in names like "dirlist,tempFile" compared with other examples 1/2 given to perform the task of size checking and deleting.
Sorry i'm kinna new in android/java therefore i don't really know what "fields" to change to suit my current coding needs? Can someone help on how am i going to complie these set of codes into a single set of code which perform the above mention functions??
My Current existing mainActivity.java
Code:
File dirlist = new File(Environment.getExternalStorageDirectory() + "/VideoList");
if(!(dirlist.exists()))
dirlist.mkdir();
File TempFile = new File(Environment.getExternalStorageDirectory()
+ "/VideoList", dateFormat.format(date) + fileFormat);
mediaRecorder.setOutputFile(TempFile.getPath());
(Example 1) code for summing up directory file size in a given folder..
Code:
private static long dirSize(File dir) {
long result = 0;
Stack<File> dirlist= new Stack<File>();
dirlist.clear();
dirlist.push(dir);
while(!dirlist.isEmpty())
{
File dirCurrent = dirlist.pop();
File[] fileList = dirCurrent.listFiles();
for (int i = 0; i < fileList.length; i++) {
if(fileList[i].isDirectory())
dirlist.push(fileList[i]);
else
result += fileList[i].length();
}
}
return result;
}
(Example 2) set of code for getting all the files in an array, and sorts them depending on their modified/created date. Then the first file in your array is your oldest file and delete it.
Code:
// no idea what are the parameters i should enter
// here for my case in mainActivity??
File directory = new File((**String for absolute path to directory**);
File[] files = directory.listFiles();
Arrays.sort(files, new Comparator<File>() {
@Override
public int compare(File f1, File f2)
{
return Long.valueOf(f1.lastModified()).compareTo(f2.lastModified());
}});
file[0].delete();
imso said:
And i eventually found these code but i was left with a problem on how to incorporate these example 1/2 codes into my current existing mainActivity.java file because of the differences in names like "dirlist,tempFile" compared with other examples 1/2 given to perform the task of size checking and deleting.
Click to expand...
Click to collapse
if its a matter of variable names and discrepancies from the sample code to your code then i would recommend an ide with really good refactoring built in. it will let you in a couple clicks rename all the new vars to vars that are already in your code. i use IntelliJ (i know alot of people use Eclipse, but i cant stand it. IntelliJ is really way better to code on)
beyond that id have to sit down and look at what this code is doing to try and help. ill give it a look over but its hard to know whats going on when you havent written the code.
How to create a watchface for Quick Circle
General info
The app that is responsible for the watchface is LGAlarmClock.apk from /system/priv-apps .
This guide will learn you how to create an xposed module to switch those files.
Requirements
To know how to compile source to apk
Android Stuio / gradle project / To know how to reference a jar on a regular project on eclipse
Tutorial:
Create the new watchfaces.
Since we doesn't edit the functionallity of the clock, your image should be compatible with the layout of the original watchface.
The original watchfaces are stored on raw-xxxhdpi folder on the apk. You can decompoile the apk by yourself, or take a look at this.
save the edited image in the same name as the original
Create new android project in your IDE.
add the edited file to raw-xxxhdpi folder inside res folder.
Download the xposed-bridge jar from here.
Reference the jar to your project. In a gradle project you need to add to the dependencies:
Code:
provided files('path to jar')
Note: you don't need to add to jar to the classpath, only reference since it already exists on the firmware.
Create a module class that implements IXposedHookZygoteInit and IXposedHookInitPackageResources. It should look like:
Java:
package com.yoavst.quickcirclemod;
import android.content.res.XModuleResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
public class Module implements IXposedHookZygoteInit, IXposedHookInitPackageResources {
// Required for resources
private static String MODULE_PATH = null;
[user=439709]@override[/user]
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
[user=439709]@override[/user]
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resParam) throws Throwable {
// Only if it is the clock package, continue.
if (!resParam.packageName.equals("com.lge.clock")) return;
// Here we will put or modifications.
}
}
Now you need to replace the resources. for example, let's say you edited those files: b2_quickcircle_digital_bg and b2_quickcircle_analog_style01_hour.
Java:
[user=439709]@override[/user]
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resParam) throws Throwable {
// Only if it is the clock package, continue.
if (!resParam.packageName.equals("com.lge.clock")) return;
// Create a reference to our resources
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resParam.res);
// Replace the raw resources with hour resources
resParam.res.setReplacement("com.lge.clock", "raw", "b2_quickcircle_analog_style01_hour", modRes.fwd(R.raw.b2_quickcircle_analog_style01_hour));
resParam.res.setReplacement("com.lge.clock", "raw", "b2_quickcircle_digital_bg", modRes.fwd(R.raw.b2_quickcircle_digital_bg));
}
add an assets folder (in gradle, it is under the "main" folder). add an xposed_init file, this file contain the full classname for your module class. in the example it is: com.yoavst.quickcirclemod.Module
Compile it and see it works (need to be applied in xposed and reboot)
You can check for the source here - https://github.com/yoavst/rolexquickcircle
Awesome thanks!
Nobody is going to take advantage with that?
Gabbyh28 said:
Nobody is going to take advantage with that?
Click to expand...
Click to collapse
http://forum.xda-developers.com/lg-g3/themes-apps/xposed-rolex-watchface-quick-circle-t2862715
Here are the 3 available watchfaces for now (the last one which is a paid one, have more then 1 watchface)