|
.NET String datatype is Unicode. I do not have much knowledge about php, perhaps it is not Unicode. That explains why it is half the size of its C# counterpart.
|
|
|
|
|
Your C# string has 12 bytes, a plus, and 10 bytes.
Your PHP string has 6 bytes, a space, and 5 bytes.
Hence in PHP you're using a special character set, capable of representing all required chars as a single byte; whereas in C# you're using two bytes per char.
Suggestion: find out what the character set ("codepage") is you need, then use new Encoding(codepage) and its GetBytes() method.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I need to write a .NET application that captures screenshots of various web pages periodically. The application needs to run as a windows service in unattended mode - when there is no user session or when the workstation is locked. A situation similar to: (http://stackoverflow.com/questions/1445788/c-screenshot-of-process-under-windows-service), only, I need to do this on web pages rather than processes.
When I try to use PrintWindow API, I am able to capture inactive or hidden windows, but get a black image when the workstation is locked. Tried this approach (www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic34231.aspx) but doesn't work.
I know this is possible since there are apps like WebShot (www.websitescreenshots.com) that are able to do it - capture screenshots of web pages even when the workstation is locked or when it runs as a service.
What am I missing? How do I get this to work?
More on my approach - I'm using the .NET WebBrowser control created programmatically. I load the webpage in the browser control and capture the image from it using the PrintWindow API. This I'm able to do whether the control is visible or not, but it trips me up when the workstation is locked.
Thanks much for your time.
|
|
|
|
|
It would be easier if you do it using printscreen.
You can anytime use Graphics.CopyFromScreen(..) to get screenshot programmatically and store it using Bitmap class.
You can easily open program for a second and take the screenshot .
But The main concern is how to do this without actually loading the page, or to do this without showing it in the desktop.
No Idea on this. Hopefully someone else might answer on this.
But for the time being, this might be your solution. If not, please let me know.
|
|
|
|
|
I can only think of one solution, and it is a lot of work. You parse the URL, instead painting to screen, you just save it to image file. I doubt it is possible to make screen shot of a window, while system is locked
|
|
|
|
|
Yes Saksida...
You are right. Just for curiosity, I did this and found the program errors out if I try to take screen shot of a window while system is locked.
It produces System.ComponentModel.Win32Exception - "The handle is invalid" on g.CopyFromScreen call.
|
|
|
|
|
Hi,
Please let me know where can i find the diff b/w c# and c++
|
|
|
|
|
|
Have you even attempted to look for any information on your own?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I guess posting on codeproject is easier than searching Google.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
There's plenty of answers to that question online.
|
|
|
|
|
hi , sorry my english is very bad so, can you help me if a write my problem in french
..
"pour simplifier ma question,
je débute en programme c# et le Pb est le suivant :
dans mon application je possède deux formulaires form1 et form2 et supposons que dans le code source de form1 j'ai 'X' une variable qui a pour valeur '6',et aussi dans form1 j'ai un boutton qui me permet de basculer a form2 et dans le code source de cette dernière je voudrai utiliser (ou récupérer)cette valeur c-à-d "6" pour d'autres calcules . voila j'espère avoir été assez claire"
Friends any help is greatly appreciated
|
|
|
|
|
où est la question?
it is yet again a "how do we pass a variable, an object, a whatever from one Form to another?". this gets asked and answered on a daily basis, although it is fundamental and covered in every introductory book.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I'm afraid my french is non-existent, though I managed to work out your question without difficulty. No chance of replying in French though I am afraid.
in the button click on form1 you can pass the value of x to form2, either as a parameter in the constructor, or by creating a property on Form2 that you set in the button click event.
Pretty basic .Net coding really. When is the homework due in?
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Have you tried "Google Translate"?
I don't understand French
Avez-vous essayé "Google Translate"?
Je ne comprends pas le français
public class Form2 : Form
{
<snip>
public String someText = "OO";
<snip>
}
public class Form1 : Form
{
<snip>
public void ButtionOk_Click(Object, System.EventArgs e)
{
Form2 frm = new Form2()
frm.someText = "NOPE";
frn.show();
}
<snip>
}
|
|
|
|
|
Vous pouvez passer le valeur de X quand vous creez la Form2 (Constructor).
Vous pouvez créer une propriété que s'appelle aussi X en Form2, et la settez avant the utilizez le Show de Form2.
Vous pouvez faire un chose que ça samble a Delphi. Créez un "variable" static en Form1 que s'appele Value. Quand tu créez Form1 vouz settez le valeur (Form1.Value) comme "this" (constructor de Form1)
E en Form2 vous utilizes Form1.Value.X quand vous besoin.
|
|
|
|
|
Hi,
public class Parent
{
string parentString;
public Parent()
{
Console.WriteLine("Parent Constructor.");
}
public void print()
{
Console.WriteLine("I'm a Parent Class.");
}
}
public class Child : Parent
{
public Child()
: base("From Derived")
{
Console.WriteLine("Child Constructor.");
}
public static void Main()
{
Child child = new Child();
child.print();
}
}
In the above example why we should give public in front of each class name...eventhough
after removing that modifier it works in the same way....and when i tried to give private in front of class name it throws error...
Please let me know im a beginner in c#
|
|
|
|
|
Private members, are accessable only in the same class. So if you declare an integer as private, you can only access that integer within the class. Classes however must be available somehow. The private modifier in front of the class would make the class inaccessable. If you want the class to be accessable only from the same project use the internal modifier.
|
|
|
|
|
http://msdn.microsoft.com/en-us/library/ms173121.aspx[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
To make it clear (to the reader not to the compiler) that you want it public. Leaving it out results in the class being public by default anyway, so it doesn't make much difference.
I'm of the opinion that there should be no default access modifiers, that the developer should always specify his intent by including one. (Same with virtual/sealed as well.)
"Things would be different if I ran the zoo." -- Dr. Seuss
|
|
|
|
|
Sorry but the default is internal!
From MSDN:
Classes and structs that are declared directly within a namespace (in other words, they are not nested within other classes or structs) can be either public or internal. Internal is the default if no access modifier is specified.
Greetings
Covean
|
|
|
|
|
I sit corrected; but that's simply more reason not to have a default.
|
|
|
|
|
There you are completely right. I also always use access modifier. At least this looks better in code.
Greetings
Covean
|
|
|
|
|
If you remove the public in front of your class def it becomes internal.
internal:
The type or member can be accessed by any code in the same assembly, but not from another assembly.
Greetings
Covean
|
|
|
|
|
You use Public because it helps in code reusability and extensibility. If ur class is private it becomes inaccessible same for any private members or methods. they can only be used by the objects of that class. U might want to extend it's functionality in future by inheriting. Hence it's a good practise to make your class public.
|
|
|
|