473,803 Members | 3,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SystemParameter sInfo

Hi,

I'm trying to use SystemParameter sInfo to get the desktop work area:

Private Declare Function SystemParameter sInfo Lib "user32" Alias
"SystemParamete rsInfoA" (ByVal uAction As Integer, ByVal uParam As Integer,
ByRef lpvParam As Integer, ByVal fuWinIni As Integer) As Integer

Dim rc As Rectangle

SystemParameter sInfo(SPI_GETWO RKAREA, 0, VarPtr(rc), 0)

but it returns the parameters in the "wrong" order, eg:

{System.Drawing .Rectangle}
Bottom: 1280
Empty: {System.Drawing .Rectangle}
Height: 0
IsEmpty: False
Left: 0
Location: {System.Drawing .Point}
Right: 994
Size: {System.Drawing .Size}
Top: 1280
Width: 994
X: 0
Y: 1280

where bottom should be 994 and right should be 1280. (I'm using the VarPtr
function that is around on the net, GCHandle etc).

If I redeclare SystemParameter sInfo as:

Private Declare Function SystemParameter sInfo Lib "user32" Alias
"SystemParamete rsInfoA" (ByVal uAction As Integer, ByVal uParam As Integer,
ByRef lpvParam As Rectangle, ByVal fuWinIni As Integer) As Integer

and say

SystemParameter sInfo(SPI_GETWO RKAREA, 0, rc, 0)

then the rc structure is populated correctly:

{System.Drawing .Rectangle}
Bottom: 994
Empty: {System.Drawing .Rectangle}
Height: 994
IsEmpty: False
Left: 0
Location: {System.Drawing .Point}
Right: 1280
Size: {System.Drawing .Size}
Top: 0
Width: 1280
X: 0
Y: 0

Two questions:

1) Why is there a difference between the two methods? I want to use the
first method if possible.
2) Is the second method a valid way of doing things, ie is it ok to have
multiple declarations?

Thanks.

David.
Nov 21 '05 #1
1 5211
Hi,

maybe the screen class can help you

for example: MsgBox(Screen.P rimaryScreen.Wo rkingArea().ToS tring)

hth Grtz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"David" <da*********@bt internet.com> schreef in bericht
news:d6******** **@nwrdmz02.dmz .ncs.ea.ibs-infra.bt.com...
Hi,

I'm trying to use SystemParameter sInfo to get the desktop work area:

Private Declare Function SystemParameter sInfo Lib "user32" Alias
"SystemParamete rsInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByRef lpvParam As Integer, ByVal fuWinIni As Integer) As Integer

Dim rc As Rectangle

SystemParameter sInfo(SPI_GETWO RKAREA, 0, VarPtr(rc), 0)

but it returns the parameters in the "wrong" order, eg:

{System.Drawing .Rectangle}
Bottom: 1280
Empty: {System.Drawing .Rectangle}
Height: 0
IsEmpty: False
Left: 0
Location: {System.Drawing .Point}
Right: 994
Size: {System.Drawing .Size}
Top: 1280
Width: 994
X: 0
Y: 1280

where bottom should be 994 and right should be 1280. (I'm using the VarPtr
function that is around on the net, GCHandle etc).

If I redeclare SystemParameter sInfo as:

Private Declare Function SystemParameter sInfo Lib "user32" Alias
"SystemParamete rsInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByRef lpvParam As Rectangle, ByVal fuWinIni As Integer) As Integer

and say

SystemParameter sInfo(SPI_GETWO RKAREA, 0, rc, 0)

then the rc structure is populated correctly:

{System.Drawing .Rectangle}
Bottom: 994
Empty: {System.Drawing .Rectangle}
Height: 994
IsEmpty: False
Left: 0
Location: {System.Drawing .Point}
Right: 1280
Size: {System.Drawing .Size}
Top: 0
Width: 1280
X: 0
Y: 0

Two questions:

1) Why is there a difference between the two methods? I want to use the
first method if possible.
2) Is the second method a valid way of doing things, ie is it ok to have
multiple declarations?

Thanks.

David.

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
485
by: Mike S. | last post by:
I'm using a SystemParametersInfo call to attempt to manage the screen saver. All I want to do is modify the ScreenSaveActive bit in the registry and have the OS recognize it (and occasionally set it back to -0-). Theoretically this should be easy to accomplish through the call shown below. If I trace the call with SysInternals (si)Registry Monitor I can see the call being made. Unfortunately in the si QueryValue for the key...
2
6043
by: philippe.joliet | last post by:
Hello, I'm currently try to use the SystemParametersInfo function in a c# environnement but I have a problem to use it with the action SPI_SETWORKAREA I've got this definition private static extern int SystemParametersInfo(int uAction, int
0
1572
by: kids_pro | last post by:
Hi there, What is the correct wayt o import this function from Win32 API? public static extern long SystemParametersInfo( ???? ) Regards
2
1818
by: Dwight Trumbower | last post by:
I need to disable the screen saver, due to an Excel "bug". I thought I had the following code working, but now all I get is code 127. I've searched the net and I don't see anything wrong with the following. public static extern int SystemParametersInfo(int uiAction, int uiParam, string pvParam, int fuWinIni);
1
1807
by: Mohammad-Reza | last post by:
In SystemParametersInfo API, type of its pvParam is PVOID. I want to know what type I must use to both set and get of this api works properly.
2
8522
by: GTi | last post by:
I need the csharp (C#) function for this API function: SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); Or must I pInvoke this (also)? My biggest problem with C# is to find the C# function for API functions? Is there any help for this available anywhere?
1
1820
by: kenwhale | last post by:
hi, all. In my computer(windows2000 professional), I found this code doesn't work! SystemParametersInfo(0x2000/*SPI_GETFOREGROUNDLOCKTIMEOUT*/,0,&dwTimeOut,0)) ; The value of dwTimeOut always equals to Zero.But the same code in VC++ 6.0 works well! Why ?? What things I should do for query the right value in
3
8846
by: Shamil Salakhetdinov | last post by:
Hi All, I did try by myself and I did search on google but I can't find any info on how to use SystemParametersInfo Win32API in VB.NET Any useful samples, hints, tips & tricks will be greatly appreciated! TIA, Shamil --
1
2750
by: BigWilli | last post by:
Hello, I want to change the keyboard language. Does anyone have an example code in VB6 for that? I know already from MSDN that it should be possible with the SystemParametersInfo and the SPI_SETDEFAULTINPUTLANG and you have to use the HKL. But I really do not understand how to do that. I would be very grateful for help! BigWilli
0
9566
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10555
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9127
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2974
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.