Thanks Nicholas,
I've explored this way and I've written this method:
public void SetWorkArea(Rec tangle scrLimit)
{
GUIRECT rect;
IntPtr p;
rect.left=scrLi mit.Left;
rect.top=scrLim it.Top;
rect.right=scrL imit.Right;
rect.bottom=scr Limit.Bottom;
p = Marshal.AllocHG lobal(Marshal.S izeOf(rect));
Marshal.Structu reToPtr(rect,p, false);
int i=SystemParamet ersInfo(SPI_SET WORKAREA,0,p,0) ;
int ret=Marshal.Get LastWin32Error( );
}
private struct GUIRECT
{
public long left;
public long top;
public long right;
public long bottom;
}
and the ret integer as a value of 87 (incorrect parameter)
Something I was wondering is the SPI_SETWORKAREA command is a "write"
command and the third parameter is only read or I miss something?
I'm not very familiar with Marshaling, and I hope once more that you
can help me. I known that I'm perhaps abusing but I'm wasting time on
this little detail of my application, I'm getting nervous
Thanks a lot
Philippe
"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote in message news:<Oa******* *******@TK2MSFT NGP12.phx.gbl>. ..
Philippe,
The SystemParameter sInfo API call takes a pointer where the data
returned is to be written to. Because of this, you should declare the
parameter as an IntPtr and then marshal the information yourself based on
what the return value is.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com
<ph************ *@valain.com> wrote in message
news:99******** *************** ***@posting.goo gle.com... Hello,
I'm currently try to use the SystemParameter sInfo function in a c#
environnement but I have a problem to use it with the action
SPI_SETWORKAREA
I've got this definition
[DllImport("user 32.dll")]
private static extern int SystemParameter sInfo(int uAction, int
uParam, string pvParam, int fuWinIni);
in the SDK it is shown that I must pass to pvParam a pointer to a RECT
structure and not a string.
How do I do that?
I tried to define a struct equivalent to the RECT structure but it
does not seems to work :(
If you 've got an idee? it will be helpfull
In advance, thanks