|
Now I'm working on a project written by C#, we have an ActiveX compment include in our UI for get and display data from a fingerprint device.
The Activex gives data in "VARIANT" type, by default it will be mapped to "object" type in C#, and now I want to store it into database, and restore it and pass it back to the ActiveX compment to use.
Currently I'm using the simple way of serialize support of .NET platform, but I'm not sure whether it works since I have no test data yet. (the device was broken and sent for repair). In fact I don't think .NET is so smart.
Anyway, if it does work, how can I get my purpose? All I want is to convert the data into something can be stored into database(sqlserver) and restore it from database.
Clark Nu
|
|
|
|
|
I thought there was a "variant" (or is it binary?) type in (I presume you're using SQL) the database. If you just persist the object from C# into the database and reload it it'll come back as an object. The object can then be sent to the ActiveX.
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
hi all,
i'm trying to create a windows service that takes a snap-shots every single time unit..
Is there any Class or Method in C# to take a snap-shots from the desktop or the monitor??
Thanks
TaRiQ
|
|
|
|
|
Hello,
You have to use "gdi32.dll" methods.
using System.Runtime.InteropServices;
[DllImport("gdi32.dll", SetLastError=true)]
private static extern int BitBlt(IntPtr hdcDest, int nXDest, int nYDest,
int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc,
int dwRop);
[DllImport("gdi32.dll", SetLastError=true)]
private static extern IntPtr CreateDC(string lpszDriver, string lpszDevice,
string lpszOutput, IntPtr lpInitData);
private static int SRCCOPY = 0x00CC0020;
public static Bitmap Screenshot()
{
Graphics formGraphics = YoureForm.CreateGraphics();
Bitmap bitmap = new Bitmap(YoureForm.ClientRectangle.Width, YoureForm.ClientRectangle.Height, formGraphics);
Graphics bitmapGraphics = Graphics.FromImage(bitmap);
IntPtr formDC = formGraphics.GetHdc();
IntPtr bitmapDC = bitmapGraphics.GetHdc();
if (BitBlt(bitmapDC, 0, 0, YoureForm.ClientRectangle.Width,
YoureForm.ClientRectangle.Height, formDC, 0, 0, SRCCOPY) == 0)
{
formGraphics.ReleaseHdc(formDC);
bitmapGraphics.ReleaseHdc(bitmapDC);
throw new Exception("API-Error" + Marshal.GetLastWin32Error() +
" BitBlt");
}
formGraphics.ReleaseHdc(formDC);
bitmapGraphics.ReleaseHdc(bitmapDC);
return bitmap;
}
Hope that helps!
All the best,
Martin
|
|
|
|
|
Instead of API, you can use Graphics.CopyFromScreen() method.
Regards
|
|
|
|
|
Hello,
Nader Elshehabi wrote: you can use Graphics.CopyFromScreen() method.
Not with .Net1.1
|
|
|
|
|
Come on man! DotNet 3.0 is on the market. You should upgrade!!
If you use C# Express edition -which I believe got DotNet 1.1 only-, you can still use features from DotNet 2.0 using a trick I made sometime ago. Simply:
1- Install DotNet 2.0 on your machine and include it in the minimum requirement in your doumentation.
2- Add a reference in your project. Select browse
3- Browse to the DotNet 2.0 folder -I believe it was under "Windows\System32" folder-, and explicitly reference the Assembly you want. In our example it should be "System.Drawing.Dll" file.
Regards
|
|
|
|
|
Nader Elshehabi wrote: Come on man! DotNet 3.0 is on the market. You should upgrade!!
Are you telling this to your customers?
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
I thought Martin was one of our boys!
Regards
|
|
|
|
|
Yeah, but the fact that there is .NET Framework 3.0 doesn't mean that all .NET 1.x project will suddenly move to new platform - ultimately, this decision is up to customer (guess who pays you...) and try to explain them you must move project to newest version of .NET in order to take snap-shot. Good luck with that.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
|
Nader Elshehabi wrote: Easy with the flames partner!!
What flames? I was merely stating a fact.
Nader Elshehabi wrote: I always release my software to that platform, and non of my customers ever complained. You don't upgrade to take a snap shot. I upgrade because I should upgrade.
I understand you, but you are forgetting that Martin is probably NOT creating new software in .NET 1.x, but rather modifying/fixing/adding functionality to some older application written in .NET1.x. If that's large codebase, all tested and proved to work in production environment, why would you migrate it to .NET 2.0? Don't fix it when it's not broken. Do you think that when .NET came C++ applications should've been rewritten into .NET just because it's there and it's cooler? That's just insane. OK, I hear ya. .NET 2.0 is backward compatible. But not 100%. And installing anythin new on server (let alone .NET framwork) is always security risk. Plus all that time spent cost money as well.
My point is that benefits of newer version of .NET are obvious when creating NEW software (or rewrite, major upgrade), but that doesn't mean that all code written in previous version suddenly disappeared.
Nader Elshehabi wrote: With all do respect to you -seriously again-... Move forward.
FYI I am developing web applications in ASP.NET 2.0
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
C# Express supports .NET 2.0 only. There is no way to make it use another runtime by choosing specific .dlls.
Note that .NET 3.0 uses the same runtime as .NET 2.0, so you can use .NET 3.0 libraries with C# Express.
|
|
|
|
|
Daniel Grunwald wrote: C# Express supports .NET 2.0 only
Never worked with it! It was just a guess. If so then why Martin was worried about .Net 1.1??
Regards
|
|
|
|
|
If I would program just for fun, I would upgrade every single day!
But as somebody said before, there are allways customers involved!
So I have to stay with .Net1.1 as long as the new generation of our product is coming. (Problem is that generation 1 isn't ready yet)
All the best,
Martin
|
|
|
|
|
You give your customer the minimum requirements. Otherwise games would have suck with DirectX 7 or 8, or even earlier. Video cards would have frozen in the earlier technologies, etc...
Got my point?? If you still prefer API, go ahead. But don't blame me if you fall behind your schedule.
Regards
|
|
|
|
|
Don't be so fast my friend!
You are living in a complete different programers would.
I'm doing a applicationen, which is running on a machine oure company builds.
These machines are then send all around the globe.
These machines are serviced by lokal service man.
Do you get my point now?
Makeing every update would be a logistical suicide!
All the best,
Martin
|
|
|
|
|
I have a DataColumn ("Timestamp") into which I place the value DateTime.Now when I create a row. This column serves as the datasource for a column in my DataGridView.
When this column is shown in the DataGridView, it shows in this format:
1/4/2007 12:56 AM
I would like this to show the milliseconds, also.
I've spent an hour looking at how DataColumn Expressions work, how DateTimeFormats work, and how DefaultCellStyles work, and I'm basically frustrated. It's still not clear to me.
Could somebody please just tell me the exact steps (which properties to change, which values to use) to have my DataTable/DataGridView show milliseconds (or, use the DateTimeFormat.LongTime format, if that indeed shows milliseconds - it's impossible to tell from the MSDN documentation what it really shows).
Yours in frustration,
Joe
|
|
|
|
|
Sure, Joe, I can help. Do this:
DataGridView.Columns["Timestamp"].DefaultCellStyle.Format = "MM/dd/yy hh:mm:ss:FFFFFFF";
It's that simple.
|
|
|
|
|
Thank you, Joe. You are godlike in your skills AND your humility.
|
|
|
|
|
|
Wonderfull conversation!
This would be something for a soap opera on TV.
|
|
|
|
|
Yet - no 5 votes. He'll never make an MVP like this.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
He don't needs that, he knows that he is the best!
|
|
|
|
|
hi all,
im with issue in handle the mouse button right click event.
i wanna 2 disable the listview that ficilitates to paste,select all.... comes when we right click on a text box.
i want a multiline textbox that user couldnt to type text,copy text and all.j't to show text....and i want able to scroll the multiline text box as well..
how ?...
thanks in advance...
--------------------------
Cheers !.....
-- modified at 4:04 Thursday 4th January, 2007
|
|
|
|