|
P/Invoke problems are signaled through exceptions, see here[^] for some details.
So you may choose to use some try-catch construct.
|
|
|
|
|
Thank you, as other question does IsWow64Process exsist in 32 bit Windows?
|
|
|
|
|
I don't know.
Read the documentation.
Google.
Try it.
|
|
|
|
|
I have some pictureBox (simple winform) that i change the image every 3 seconds.
When i stop changing the images - and i move the mouse on the picture i get an exception about 'arguments are not valid'.
In debug i see that all the arguments are fine - and the image that appear on the pictureBox is valid.
The Bitmap b is also valid and is not null - and i see in debug the bitmap information.
The exception appear on line 5
1 private Color OnMouseMove_PictureBox( object sender, MouseEventArgs e )
{
2 Color c = null;
3 if( pictureBox.Image != null )
{
4 Bitmap b = ( Bitmap )pictureBox.Image;
5 c = b.GetPixel( e.X, e.Y );
}
return c;
}
|
|
|
|
|
what are the values of e.X and e.Y? These are probably not valid, could you post the entire text of the exception message?
|
|
|
|
|
The value of e.X and e.Y are valid and i see the values on debug.
The entire text on the exception does not give anything => just 'argument are not valid'.
|
|
|
|
|
Is the ArgumentOutOfRangeException thrown?
I can not see the other exception to be thrown.
try adding to prevent e.X and e.Y to be higher than image width and height, or if you do not care use try catch to supress error. I do recomend the first solution
|
|
|
|
|
What might have happened is that the picture box was set to stretch the image to fit it's size.
Then when you tried to get the pixel at e.x, e.y these values might well be larger than the true
picture size. In that case a transformation of picture box x,y to image x,y would need to be done.
Something along the lines of:
x' = e.x * image.width / picturebox.width
y' = e.y * image.height / picturebox.height
|
|
|
|
|
|
Hi,
I am suspecting that my VS2010 is improperly building the .RDLC file to use with SQL Server 2008 R2, as I am getting an error that I can't explain or figure out. The report definition is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition' which cannot be upgraded. If I rename the file to an .RDL it works, however I have to manually add the Data Source, DataSet and the SQL Query. Looking at the .RDLC file it doesn't look right as it has no data connections.
Anyone have an example from VS2008 that works and you can send me via email, or paste into this link? Something simple like printing one field from the Northwind database.
Much appreciated...
Glenn
Sr. Software Specialist
|
|
|
|
|
I'm guessing here as I do not have the definitive answer. I believe the 'C' stands for client, that is the RDL will not be published via reporting services. Therefore in the 'C' version of the RDL it expects the 'C'lient to supply the data, whereas the published format retains the data connections.
Client format is for embedding in your application and your app should supply the dataset/table to service the report.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I want to change the look of Up and Down buttons in NumericUpDown control with some images, I know one way is to override OnPaint event but I could not find any example. Does anyone know good example of this?
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
Hoo Hoo! That's not an easy one. NumericUpDown is a composite control, it contains a text box and a button box - but it doesn't make either public. You can get at the contents (I believe, I've never tried) with reflection, but to be honest, you would be relying on class internals that you have no guarantee will remain the same. I.e. your code may work today, but tomorrow...
A better solution would be to create your own custom control that looks the way you need, including your own up/down logic and text box. Would be more reliable, and probably quicker to develop, too.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Yes, after more investigation, I came into same result. Thanks for reply.
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
Welcome - good luck!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
I want to define the ConcurrentQueue size -
I mean that if the ConcurrentQueue_.count is bigger then X then the last item in the queue need to be out.
Is it possible ?
Thanks.
|
|
|
|
|
hi guys
how to copy control with relative code?
such as a button with click and double click ,mouse move and etc
thanks a lot
|
|
|
|
|
behzadcp wrote: how to copy control with relative code?
Are you asking how to create a custom control based on other controls with the little code as possible?
|
|
|
|
|
I seen a struct on a pInvoke.Net
[StructLayout(LayoutKind.Sequential)]
public struct PROCESSENTRY32
{
public uint dwSize;
public uint cntUsage;
public uint th32ProcessID;
public IntPtr th32DefaultHeapID;
public uint th32ModuleID;
public uint cntThreads;
public uint th32ParentProcessID;
public int pcPriClassBase;
public uint dwFlags;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)] public string szExeFile;
};
PROCESSENTRY32 pe = new PROCESSENTRY32();
pe.dwSize = (uint)Marshal.SizeOf(pe);
I know i have read somewhere here that strut should be intalized inside constructior or it will couse problems. Does that applay to WinAPI too?
Edit: Forgot code tags
|
|
|
|
|
Inside what constructor? The only thing you have to worry about is establishing the size of the struct so that the WinAPI knows how big the object is. The only concern about initializing it is what scope the resulting object has.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
i see, so it doesn't have struct problems like c#
i know for size iz has to be:
public struct Size
{
public Size(int x, int y)
{
X=x;
Y=y;
}
public int X;
public int Y;
}
And it shoudln't be used as:
Size size = new Size(1,1);
size.X = 5;
size.Y = 10;
|
|
|
|
|
Saksida Bojan wrote: strut should be intalized inside constructior
Correct, however every struct has a default parameterless constructor that cannot be overridden. If you are creating your own constructor (with parameters) then you would need to need to initialize every field inside that constructor.
Nothing to do with your question, but *sometimes* when PInvoking you can interchange int /uint . The size of the struct you have declared will be 296 bytes on a 32 bit system and 300 bytes on a 64 bit system. This is well within the range of an int so you can safely declaredwSize as an int (still 4 bytes) and get rid of the cast to uint when calculating the size.
|
|
|
|
|
If you don't explicitly initialize the fields in a struct (such as when using the default ctor) all fields will be initialized to their default value (0 , 0.0 , null , etc)
That's not really a "problem", and it's well-defined behaviour. Even if you have a huge struct like this.
The semantics of the default ctor are described in §11.1.2 of ECMA-334:
11.1.2 Default constructors
All value types implicitly declare a public parameterless instance constructor called the default constructor.
The default constructor returns a zero-initialized instance known as the default value for the value type:
Followed by a table of types and their default values.
What kind of problems do you expect?
edit: pre with lang="none" appears to be broken..?
modified on Saturday, September 18, 2010 12:46 PM
|
|
|
|
|
harold aptroot wrote: lang="none"
Try lang="text"
|
|
|
|
|
Thanks, that did the trick. "none" used to work though, I always used that.
|
|
|
|