我一直在尝试使用Qt和mingw32编写一个应用程序来下载图像并将它们设置为背景壁纸.我已经在线阅读了几篇关于如何在VB和C#中执行此操作的文章,并且在某种程度上如何在c ++中执行此操作.我目前正在调用SystemParametersInfo看似所有正确的参数(没有编译器错误)并且它失败了.没有镲片的大崩溃,只是0返回.GetLastError()同样具有启发性0.
下面是我正在使用的代码(稍微修改一下,因此您不必查看对象内部).
#include <windows.h>
#include <iostream>
#include <QString>
void setWall()
{
QString filepath = "C:\\Documents and Settings\\Owner\\My Documents\\Wallpapers\\wallpaper.png";
char path[150];
strcpy(path, currentFilePath.toStdString().c_str());
char *pathp;
pathp = path;
cout << path;
int result;
result = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, pathp, SPIF_UPDATEINIFILE);
if (result)
{
cout << "Wallpaper set";
}
else
{
cout << "Wallpaper not set";
cout << "SPI returned" << result;
}
}
Run Code Online (Sandbox Code Playgroud) 我已经完成了我的小壁纸应用程序.现在唯一的事情就是我在API级别3上找不到任何偏移方法.无论我使用什么尺寸的图像,它都不在我的测试手机中.它在模拟器上看起来很棒,但对于像后空翻这样的旧手机用户怎么办?有谁知道对此有任何修复?
我正在尝试创建一个批处理文件,该程序将在Windows 7上关闭程序时更改我的背景.我尝试使用它,但它不起作用,即使我注销并重新登录:
@echo off
reg /add HKCU\Control Panel\Desktop\WallPaper /v wallpaper /t REG_SZ /d c:\images\wallpaper.bmp
Run Code Online (Sandbox Code Playgroud) 我有一个应用程序将壁纸应用到主屏幕上,其图像与屏幕尺寸相匹配,但是在我应用它时,壁纸会放大,即使使用的图像与屏幕尺寸完全匹配!它是静态图像,在主屏幕上切换页面时甚至不滚动.奇怪的是,如果我使用内置图库应用图像,壁纸将在没有缩放的情况下正常应用(它会显示"裁剪图像"屏幕,但裁剪区域本身与图像的边缘匹配)
我使用的代码适用于整个手机阵列(星系注释,ace 2,s2等),但不适用于s3; 我想知道是否有什么可以强迫壁纸正确填满屏幕?我用来应用壁纸的当前代码是:
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
wallpaperManager.setWallpaperOffsets(wallpaperViewer.getApplicationWindowToken(), 0, 0);
wallpaperManager.setBitmap(BitmapFactory.decodeFile(file.getPath()));//file is jpg on sd card
Run Code Online (Sandbox Code Playgroud) 有没有人知道用python更改Windows桌面墙纸的方法,以便更改是永久性的?我找到了这段代码
import ctypes
SPI_SETDESKWALLPAPER = 20
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, "myimage.jpg" , 0)
Run Code Online (Sandbox Code Playgroud)
此代码有效,但一旦您注销并再次登录,背景将返回到原始图像.我更喜欢一个不需要任何注册表编辑的解决方案,我想要一些适用于Windows XP和7的东西,如果可能的话.
我正在尝试在我的W10 UWP应用中将远程图像设置为桌面壁纸/手机锁屏:
string name = "test_image.jpg";
Uri uri = new Uri("http://www.ucl.ac.uk/news/news-articles/1213/muscle-fibres-heart.jpg");
// download image from uri into temp storagefile
var file = await StorageFile.CreateStreamedFileFromUriAsync(name, uri, RandomAccessStreamReference.CreateFromUri(uri));
// file is readonly, copy to a new location to remove restrictions
var file2 = await file.CopyAsync(KnownFolders.PicturesLibrary);
// test -- WORKS!
//var file3 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/Design/1.jpg"));
// try set lockscreen/wallpaper
if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) // Phone
success = await UserProfilePersonalizationSettings.Current.TrySetLockScreenImageAsync(file2);
else // PC
success = await UserProfilePersonalizationSettings.Current.TrySetWallpaperImageAsync(file2);
Run Code Online (Sandbox Code Playgroud)
file1不起作用,因为它是只读的,所以我将它复制到一个新的位置(图片库)以删除限制 - > file2.
注意: …
我使用的是Android SDK 1.6.有人能告诉我如何将图像设置为主屏幕中的壁纸.
getApplicationContext().setWallpaper();
Run Code Online (Sandbox Code Playgroud)
似乎不适合我.
我想Android使用LibGDx. 我按照此 github 链接中的说明创建了该项目
但Eclipse显示错误:
“方法createListener()类型MainActivity必须重写或实现的超类型方法”
“方法createConfig()类型MainActivity必须重写或实现的超类型方法”
并提供删除@Override注释。我的错误在哪里?
我的代码:
public class MainActivity extends AndroidLiveWallpaperService {
@Override
public ApplicationListener createListener() {
return new Wallpaper();
}
@Override
public AndroidApplicationConfiguration createConfig () {
return new AndroidApplicationConfiguration();
}
@Override
public void offsetChange (ApplicationListener listener, float xOffset, float yOffset, float xOffsetStep, float yOffsetStep,
int xPixelOffset, int yPixelOffset) {
Gdx.app.log("LiveWallpaper", "offset changed: " + xOffset + ", " …Run Code Online (Sandbox Code Playgroud) 我目前有自定义视图的以下XML代码:
<com.pink.jazz.RootView
android:id="@+id/rootView"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MouseActivity" >
<ImageView
android:id="@+id/mouse_hole"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/mouse_hole"
android:visibility="gone"
/>
</com.pink.jazz.RootView>
Run Code Online (Sandbox Code Playgroud)
在某些设备(例如三星Galaxy Tab 4)上,壁纸图像mouse_hole显示正常,而在其他设备(例如Asus Transformer Infinity TF700T)上根本不显示.的知名度mouse_hole正在变为可见编程当我开始我的比赛.我的自定义视图扩展RelativeLayout.
谁能知道这里有什么问题?
wallpaper ×10
android ×5
background ×1
batch-file ×1
c# ×1
c++ ×1
center ×1
cocoa ×1
ctypes ×1
homescreen ×1
imageview ×1
libgdx ×1
live ×1
macos ×1
python ×1
python-2.7 ×1
qt ×1
screen ×1
winapi ×1
windows ×1
windows-10 ×1
windows-7 ×1