|
|
How about skipping all this garbage and taking a screen shot and drawing on that instead. No need to worry about transparency and mouse clicks going to the wrong form at all.
|
|
|
|
|
Yes, that's an option I am considering right now.
But if I could make it draw directly on screen it would have been much more better.
Thanks,
Parth
|
|
|
|
|
I got this from MSDN before
[DllImport("user32.dll")]
private extern static IntPtr SetActiveWindow(IntPtr handle);
private const int WM_ACTIVATE = 6;
private const int WA_INACTIVE = 0;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_ACTIVATE)
{
if (((int)m.WParam & 0xFFFF) != WA_INACTIVE)
{
if (m.LParam != IntPtr.Zero)
{
SetActiveWindow(m.LParam);
}
else
{
SetActiveWindow(IntPtr.Zero);
}
}
}
base.WndProc(ref m);
}
I cant find the link for it though so I just found it in my own code
found the link[^]
modified on Friday, June 19, 2009 3:39 PM
|
|
|
|
|
This does not work. I tried this one as well as the
[DllImport("user32", CharSet = CharSet.Auto)]<br />
private extern static int SendMessage(<br />
IntPtr handle, int msg, int wParam, IntPtr lParam);<br />
<br />
[DllImport("user32", CharSet = CharSet.Auto)]<br />
private extern static int PostMessage(<br />
IntPtr handle, int msg, int wParam, IntPtr lParam);<br />
<br />
private const int WM_ACTIVATE = 0x006;<br />
private const int WM_ACTIVATEAPP = 0x01C;<br />
private const int WM_NCACTIVATE = 0x086;<br />
<br />
<br />
protected override void WndProc(ref Message m)<br />
{<br />
<br />
if (m.Msg == WM_NCACTIVATE)<br />
{<br />
<br />
if (((int)m.WParam) == 0)<br />
{<br />
xyz += m.Msg + " ";<br />
SendMessage(this.Handle, WM_NCACTIVATE, 1, IntPtr.Zero);<br />
<br />
}<br />
<br />
}<br />
else if (m.Msg == WM_ACTIVATEAPP)<br />
{<br />
<br />
if ((int)m.WParam == 0)<br />
{<br />
xyz += m.Msg + " ";<br />
PostMessage(this.Handle, WM_NCACTIVATE, 0, IntPtr.Zero);<br />
}<br />
}<br />
<br />
base.WndProc(ref m);<br />
}
code.
Later code actually does the reverse of what I want, but still it does not work.
Neither works.
|
|
|
|
|
My config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="sunshine" value="125" />
<add key="moonshine" value="50" />
<add key="seashine" value="10" />
</appSettings>
<Settings2>
<add key="persistent" value="0" />
<add key="smooth" value="1" />
</Settings2>
</configuration>
I can read/write settings into <appSettings> but don´t know how can i read/write from <Settings2> .... and if i can create new sections like <SettingsN>
...
I´m using System.Configuration but only could read/write into the default section named <appSettings>... perhaps someone can give me a hand or point me to the right direction, thanks in advance.
|
|
|
|
|
Zeokat wrote: I´m using System.Configuration but only could read/write into the default section named <appsettings>...
System.Configuration only exposes methods which for the predefined section (i.e. appsettings).
For your purpose, you should rather consider it as a normal xml file and do the read/write.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Ok, thanks for the informations...
I already thougth into write my own config file reader writer, but want to be sure firts that built-in class not allow me do that
|
|
|
|
|
As modifying configuration files directly can be very dangerous. You should also take a look at How to: Create Custom Configuration Sections[^].
There are also loads of articles, which you might find easier to understand. Just Google for Custom Configuration Section
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
Good Evening All
Am amazed that i cant use the Replace Function , its Probably the long that i had.
i have the Following code
String Username = "Vuyiswa";
String Password = "secret";
String strBody = @"<p>Thank you for using !obooking System <br><br> Username:(Username)<br><br>Password:(Password)<br<br>Kind Regards !oBooking</p>";
strBody = Regex.Replace(strBody,Username,"(Username)");
strBody = Regex.Replace(strBody, Password, "(Password)");
Response.Write(strBody);
i have tried the Normal replace Function, but the Variables are not returned with the Variables values.
Thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
string username = "user1";
string password = "pass1";
string body = "something with a (username) and a (password)";
body = body.Replace("(username)", username);
body = body.Replace("(password)", password);
you saying that does not work?
you can also do...
string body = "something with a " + username + " and a " + password;
or...
string body = string.Format("something with a {0} and a {1}", username, password);
...I think your regex could have something to do with the brackets which are used in regular expression to specify a group, but I'm not sure about that
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thanks
i used it this way
string Username = "Vuyiswa";
string Password = "secret";
string strBody = @"<p>Thank you for using !obooking System <br><br> Username:(Username)<br><br>Password:(Password)<br<br>Kind Regards !oBooking</p>";
strBody = strBody.Replace("(Username)", Username).Replace("(Password)", Password);
Response.Write(strBody)
but what is the Difference between this
strBody.Replace("(Username)",Username);
strBody.Replace("(Password)",Password);
and this working code
strBody = strBody.Replace("(Username)", Username).Replace("(Password)", Password);
Thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
string.Replace creates and returns a new string, so do strBody.Replace(...) ;
that also is why the second way does work.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Hi,
nothing gets replaced, since there is no match: "Vuyiswa" and "secret" are not present in the original strBody.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
That means the Replace Function intellisense is misleading because it says
strBody.Replace(char oldchar,char newChar)
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
that is just one of the functions signatures, the other is with string types instead of char types
your intellisense should show multiple signatures available that you can cycle through with the Up/Down arrow keys
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I see
Thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Vuyiswa Maseko wrote: strBody.Replace(char oldchar,char newChar)
that is completely irrelevant, your original post and my reply to it referred to Regex.Replace, not string.Replace; and there are no char variables present at all.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Correct , what am saying is that the normal replace has those arguments. So i changed from Regex to use normal replace.
thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
ahhh... the parameters are in the wrong order. Good Spot!
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
musefan wrote: Good Spot!
Not really. If a replace operation fails, either you did not catch the result, or there was no match to begin with. How hard can it be?
BTW: the OP made both mistakes in this thread.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
oh don't get me wrong if I was coding it myself I would know the match had failed as I would have had the parameters in the right order.
But I did not spot that it is the second param that is the search pattern and the third is the replace just by looking at his code. Mainly because I dont use the Regex function often (but we have had that discussion[^] before )
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Yeah, it was another regex abuse, there wasn't any real pattern to match, or special substitution going on, just a simple string.Replace; and my view on regex hasn't changed since our last encounter on the subject
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
i want to know how i can access to sectors used by typical file to read and write directly them in c#
and i need the methods that read and write hard disk sectors directly
thanks
|
|
|
|