Windows system casting
Alexander Patapoff via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jun 6 12:52:36 PDT 2016
import std.stdio;
import std.string;
import core.sys.windows.windows;
void main() {
string filepath =
"C:\\Users\\awpat\\Pictures\\patterns_00387591.jpg";
auto p = toStringz(filepath);
int result;
result = SystemParametersInfo(cast(uint)SPI_SETDESKWALLPAPER,
cast(uint)0, cast(void*)p ,cast(uint)SPIF_UPDATEINIFILE);
}
I'm trying to change the background of my computer. to do this I
must convert my string to a const char*, then that can implicitly
to a (PVOID). I believe that I am losing all my data in the
casting process, is there a way for me to keep my data? or if I
am casting this improperly can you demonstrate and explain the
proper way to cast to a void pointer (PVOID)?
thanks!!
More information about the Digitalmars-d-learn
mailing list