|
I'm looking for some documentation on core system DLL's (in XP).
I've been trawling search engines looking for the method specs, but had no joy. Does anyone know where I could find something like this?
Cheers
Cata
|
|
|
|
|
We'll just go on MSDN : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_api_start_page.asp
|
|
|
|
|
|
Thanks guys, found all the stuff I was looking for and more
Cheers
Cata
|
|
|
|
|
hi
can anyone send me the source code of flow diagram?
it is very important for me.
best regards.
|
|
|
|
|
Your not too clear on this.
Do you need source code for a flow diagram control?
|
|
|
|
|
I have some sample code Heath (Stewart) may recognise it, as it's from his Icon Extraction sample.
Anyway, I'm confused about the use of the | operator with enumerations.
<br />
[DllImport("shell32.dll", CharSet=CharSet.Auto)]<br />
private static extern IntPtr SHGetFileInfo(<br />
string path,<br />
int fileAttributes,<br />
[MarshalAs(UnmanagedType.Struct), Out]out SHFileInfo info,<br />
int fileInfoSize,<br />
[MarshalAs(UnmanagedType.U4)]SHGFI flags);<br />
First is the use of the SHGFI Flags, which I take as wanting to use the Hex values as handles or refferences or pointers or something. I'm sure I'll figure it out.
The next part is:
<br />
IntPtr retVal = SHGetFileInfo(filename, FILE_ATTRIBUTE_NORMAL,<br />
out info, Marshal.SizeOf(typeof(SHFileInfo)),<br />
SHGFI.AddOverlays | SHGFI.DisplayName | SHGFI.Icon | SHGFI.SmallIcon<br />
| SHGFI.TypeName | SHGFI.UseFileAttributes);<br />
Now, how does the | operator in this work? Is it actualy an or statement? Or a collection of flags from the enumeration? If so, what effect does the | charachter have?
Thanks guys
Cata
|
|
|
|
|
The_Catalyst wrote:
Now, how does the | operator in this work? Is it actualy an or statement? Or a collection of flags from the enumeration? If so, what effect does the | charachter have?
The latter, it behave like flags. A bit-wise OR iow.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
How do flags work? What is the OR required for? What do flags represent? Hex numbers paired with ordered values from an enumeration?
Cheers
Cata
|
|
|
|
|
The bitwise OR operator combines the bits of two values into one value, making each bit that is "1" in either value be "1" in the new value, and any bit that's "0" in both be "0" in the new value. So, you're using each bit to represent a "flag" instead of having lots of boolean (true/false) values, one for each flag.
So, if you had the flags 1, 2, & 4, and OR'ed them together, each bit would represent a flag, and it would look like this (where r = result):
binary
value value
--------------
1 = 00000001
2 = 00000010
4 = 00000100
--------------
r = 00000111
|
|
|
|
|
How do flags work? What is the OR required for? What do flags represent? Hex numbers paired with ordered values from an enumeration?
Cheers
Cata
|
|
|
|
|
Dear, Sir.
How to convert "string" type to "Shortcut" type ?
For example
convert the strings, "CtrlM", "CtrlN", "CtrlO", "CtrlP", etc to Shortcut type.
Thank you.
|
|
|
|
|
You're lucky c# has an enum parse feature
you can use this:
System.Windows.Forms.Shortcut s = (System.Windows.Forms.Shortcut)Enum.Parse(typeof(System.Windows.Forms.Shortcut), "Alt1");
|
|
|
|
|
The method that the post above mentions works for some but not all shortcuts (AFAIK). The preferred method is to use the KeyConverter class (in System.Windows.Forms) to do this. It does not take strings like "CtrlM", but it will take strings like "Ctrl+M" or "Ctrl+Shift+M".
|
|
|
|
|
What's the easiest way of rounding the time to the nearest five minutes in C#?
Rich.
|
|
|
|
|
There really isn't a builtin method for this. However - you can access the minutes property of the DateTime object and calculate the nearest multiple of 5.
|
|
|
|
|
Hi, is there anyone who can point or provide me with some samples of how to Select, Insert Update and delete using OLEDB in C#
Preferably a simple basic example that doesn't use stored procedure.
thanks.
|
|
|
|
|
I use something similar to this for INSERT an new record:
OleDbConnection conn = new OleDbConnection( DB_STR );
OleDbDataAdapter da = new OleDbDataAdapter( "SELECT TOP 1 * FROM Guestbook", conn );
OleDbCommandBuilder cb = new OleDbCommandBuilder( da );
cb.QuotePrefix = "[";
cb.QuoteSuffix = "]";
DataSet ds = new DataSet();
da.Fill( ds );
DataTable table = ds.Tables[0];
DataRow row = table.NewRow();
row["Date"] = DateTime.Now;
row["Name"] = name;
row["EMail"] = email;
row["Text"] = text;
table.Rows.Add( row );
da.Update( ds );
conn.Close();
And for INSERT or UPDATE :
OleDbConnection conn = new OleDbConnection( DB_STR );
OleDbDataAdapter da = new OleDbDataAdapter( "SELECT TOP 1 * FROM Guestbook WHERE ID="+ID, conn );
OleDbCommandBuilder cb = new OleDbCommandBuilder( da );
cb.QuotePrefix = "[";
cb.QuoteSuffix = "]";
DataSet ds = new DataSet();
da.Fill( ds );
DataTable table = ds.Tables[0];
if ( table.Rows.Count==0 )
{
DataRow row = table.NewRow();
row["Date"] = DateTime.Now;
row["Name"] = name;
row["EMail"] = email;
row["Text"] = text;
table.Rows.Add( row );
}
else
{
DataRow row = table.Rows[0];
row["Date"] = DateTime.Now;
row["Name"] = name;
row["EMail"] = email;
row["Text"] = text;
}
da.Update( ds );
conn.Close();
For the SELECT and DELETE I just use single-statement SQL-queries, which I format with string.Format() .
--
- Free Windows-based CMS: www.zeta-software.de/enu/producer/freeware/download.html
- See me: www.magerquark.de
|
|
|
|
|
thanks.
I got a question. what is the following code for?
<br />
cb.QuotePrefix = "[";<br />
cb.QuoteSuffix = "]";<br />
thanks =)
|
|
|
|
|
Here is my code.
HttpClientChannel channel = new HttpClientChannel();
ChannelServices.RegisterChannel(channel);
try{
url = "http://"+servername+":7777";
RemotingConfiguration.RegisterActivatedClientType(typeof(MyService), url);
MyService myservice = new MyService();
}catch(Exception){...}
If I input an error servername,I want to know error in customized timeout such as 10 seconds or else. How? Thanks!
|
|
|
|
|
If you looked at the SDK documentation for HttpClientChannel , the solution is obvious: channel.Properties.Add("timeout", timeout in milliseconds)
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Are you sure?
When I use the following code,
channel = new HttpClientChannel();
channel.Properties.Add("timeout",10000);
JIT throws System.NotSupportedException.
What is your suggestion?
|
|
|
|
|
I knew something about it. The timout is a new property that is introduced in .NET framework 1.1. I have changed my framework version to 1.1.
But when I use it like the following,
IDictionary props = new Hashtable();
props["timeout"] = 30000;
HttpClientChannel channel = new HttpClientChannel(props,
new SoadClientFormatterSinkProvider());
it seems the timeout(30 seconds) does not take effect.
Why? Could you help me ?
|
|
|
|
|
No, the "timeout" property has existed even before the release of 1.0 and the documentation backs this up (plus the fact I have MS Press's "Microsoft .NET Remoting" that was written about the time 1.0 was released and mentioned it.
As far as the timeout not working, are you sure it's the HttpClientChannel that's timing out? I just ask because we had a similar problem at work yesterday I worked on for a while where our remoting objects talk to SQL Server and communicate over HTTP since they're hosted by IIS. In that case, there were many timeouts: SQL Server's query timeout, the SqlCommand.CommandTimeout , the HttpClientChannel timeout (which worked, and we're using 1.0), and - in some cases - the ASP.NET worker process's timeout.
You can also configure the timeout as an arbitrary attribute in the <channel> section of your .config file (if you configure your remoting object via a configuration file). This makes it easy to change. See the docs for the element for more details.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
It sounds quite reasonable.Thank you!
|
|
|
|