473,387 Members | 1,628 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem with GetWindowRect returning strange dimensions

I'm using the GetWindowRect in my screen capture utility:

[DllImport("user32.dll")]
private static extern bool GetWindowRect(IntPtr hwnd, ref Rect rectangle);

My Rect Struct:

[StructLayout(LayoutKind.Sequential)]
public struct Rect
{
public int left;
public int top;
public int right;
public int bottom;

public int Width
{
get{return right - left;}
}

public int Height
{
get{return bottom - top;}
}
}

I need to call GetWindowRect to get the dimensions of the window in
question, do other stuff, and eventually I call BitBlt to create the
screenshot.

Having said that, the code works fine. But I've noticed that I was getting
errors getting screen shots of MSDN Library and the VB6 development
environment. I found out that the problem is that the GetWindowRect call is
returning the same value for left and right in the Rect (resulting in 0
width), and the same value for top and bottom (resulting in 0 height) when I
send in the handle to these windows. It's definitely odd because this code
works just fine with other windows...

Any one ever experienced this before?
Nov 15 '05 #1
0 5052

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

Similar topics

10
by: riki | last post by:
Hi, i have a big problem...i'm using one jscript for resizing of all of my pics in popUp...in main html i'm having many little pics and clicking on them they open in popUp and resize to larger...
18
by: Greg G | last post by:
http://mysite.verizon.net/gdguarino/indexnew.htm It's not a high priority site, just some of my photos throughout the years. The address above is an experiment for a new home page. My intended...
1
by: dipak22101980 | last post by:
HI, below is a piece of code. HWND hVWnd; RECT rRect; GetWindowRect(hVWnd,&rRect); diff_val = rRect.bottom-rRect.top;
2
by: awoodgate | last post by:
Hi, I'm trying to read the width of a css absolutely positioned element in javascript. If I use an id selector or a class definition then the width is null, but if I use an inline style then it...
39
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1)...
2
by: wolfing1 | last post by:
I have the following page that is supposed to self-resize to the image's dimensions when opened, but for some reason it works fine with Firefox, but in IE6 it doesn't. I added the alert and it...
2
by: John Brown | last post by:
Hi there, I've created an expandable "PropertyGrid" control that initially looks like this when fully expanded (you'll need a fixed-space font in your news-reader to see it properly aligned): ...
16
by: Jm.GlezdeRueda | last post by:
Hi all, Im trying to read a 24bit bmp with fread, and i have some problems.. I want to read the whole structure in one time, but i dont know why, it only reads the first member well.. I have...
7
by: raknin | last post by:
Hi I have a carousel script. I want to load the carousel with a new set of pictures every time I press a button. The problem that I have that the script append the new pictures to the olds one...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.