|
I've decided to implement DSS_MONO and DSS_DISABLED by making a region excluding the transparent areas and light areas, and then filling the resulting region with the brush passed in. (The brush can be any brush, including semi-transparent and gradient brushes. ).
If you have better ideas, let me know.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Mission accomplished!
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Well, beforehand I need to say I must be doing something fundamentally wrong, but I simply cannot see it. Maybe it’s something on machine.config, or web.config, but I was not able to find it anywhere else.
The problem is: my webservices are being handled in a single thread on the server. I compiled release, disabled debugging, tried almost everything. And my webservice seems to be handled only on a single thread.
A simple code that shows this is:
[WebMethod]
public int MyWait(int Waittime)
{
DateTime dt = DateTime.Now.AddSeconds(Waittime);
while (DateTime.Now < dt)
;
return Waittime;
}
As you can see, if you start the webservice and quickly call it twice (I’m testing with IE and the quick test page), passing 20s as the time, you should have both answers in 20s, if there were two threads. The problem is:the second request returns after 40s.
I know that changing this loop for Sleep() solves the problem, but my real code is much more complicated, and has to process several requests simultaneously.
I simply cannot believe that ASP.NET webservices are single threaded.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
Setting your Webservice to run at a lower priority mite work...
<a TITLE="See my user info" href=http:
|
|
|
|
|
IIRC ASP.NET makes heavy use of the CLR ThreadPool, one of the down sides to the threadpool is that it won't create a new thread (or queue a new worker item) if the CPU is at 100%*, which your sample code does [edit]by looping until the time has elapsed[/edit].
That is also why changing the loop to a call to Thread.Sleep will allow it to work properly, the thread is suspended (or whatever it really is) until the the time elapses rather than spinning, using up all excess processor time.
*The logical reason is that if you are using up all of the processor, it doesn't make sense to try to get it to do more work. The downside is that you can see longer than usual request times in ASP.NET if the processor is pegged.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Hi,
how can i pass data from byte[] variable into struct. In C/C++ I use memmove. But isnt something like this...
Thank
Wiizi
|
|
|
|
|
Try something like:
using System.Runtime.InteropServices;
...
public static object ByteArrayToStructure(byte[] buffer, int index, Type tStructure)
{
if (null == buffer || 0 == buffer.Length)
throw new ArgumentNullException("buffer");
if (0 > index || buffer.Length <= index)
throw new ArgumentOutOfRangeException("index");
if (null == tStructure)
throw new ArgumentNullException("tStructure");
int size = Marshal.SizeOf(tStructure);
if (index + buffer.Length < size)
throw new ArgumentException("Insufficient data passed", "buffer");
IntPtr pStructure = Marshal.AllocHGlobal(size);
try
{
Marshal.Copy(buffer, index, pStructure, size);
return Marshal.PtrToStructure(pStructure, tStructure);
}
finally
{
Marshal.FreeHGlobal(pStructure);
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hey All,
Im doing a simple GUI prototype, and Im using alot of data screen shots from the old application to represent data in the new prototype. Following that thinking I have alot of forms what simply contain picture controls, and I set these bitmaps of the old app to those picture or image control, whatever the new one is called. Anyways, when I set the sizemode property to stretch, the image control doesnt stretch the picture. Any ideas?
Thanks,
Ryan
|
|
|
|
|
Ryan@SalamanderTechnologies wrote:
Anyways, when I set the sizemode property to stretch, the image control doesnt stretch the picture. Any ideas?
I think those names are confusing, try the autosize one.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
|
Look at the WebClient class in the System.Net namespace.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
Thanks for the info leppie.
I was looking for something that I could possibly tie into some sort of progress control to show the progress of the download [URLDownloadToFile uses a Callback]. Any ideas?
Regards,
Brian Dela
|
|
|
|
|
Use URLDownloadToFile. Seriously though, I don't think there's any way to do that with the WebClient class.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
David Stone wrote:
Use URLDownloadToFile.
I could.. I'm just wondering if there is a method in the BCL to do it.
Regards,
Brian Dela
|
|
|
|
|
U cant use the HttpWebRequest class then, a bit more work, but all .NET
<a TITLE="See my user info" href=http:
|
|
|
|
|
Please tell me how to get all the content of a web page by using this AxSHDocVw.AxWebBrowser!Thax.
|
|
|
|
|
Hi,
I'm writing a .NET Data Provider in C# and I want to create an application that will test all of the objects thoroughly. Can I use reflection for this? What I would like to do is have the test app walk through each object testing all of the properties and methods to make sure that everything is as expected. For instance, I want it to set the ConnectionString property and then read it back to make sure it was stored correctly.
Am I trying to make things too complicated? The Data Provider is relatively simple, so is writing a generic object walker overkill? Any thoughts would be appreciated.
Josh
Find a penny, pick it up, and all day long you'll have a back-ache...
|
|
|
|
|
Have a look at NUnit on sourceforge. nunit.sourceforge.net[^] I think.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
Or www.nunit.org I know that one is correct.
nUnit rocks for writing test cases.
|
|
|
|
|
I'm writing an MMC snapin using C#. So far I've got most things working and I've moved onto persistance. I need to implement the IPersistStream interface. I've defined the IPersistStream, IPersist and IStream interface in my C# code plus all the structure etc required as parameters. However when MMC or my C++ test harness calls the GetSizeMax method which has an out parameter of type ULARGE_INTEGER (which is a structure wrapping a ulong) I get an access violation. Am I doing anything wrong? I'm quite experienced with COM and C++ but marshalling between managed and unmanaged code is all quite new to me. Can anyone help?
|
|
|
|
|
solidstore wrote:
ULARGE_INTEGER (which is a structure wrapping a ulong) I get an access violation.
ulong is 4 bytes AFAIK. so use a UInt32 Dont get confused with C's long type.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
Please find below my definitions. When stepping into some of these
interfaces from C++ client the code either works, crashes or steps into the
wrong functions. Any ideas?
<br />
[<br />
StructLayout(LayoutKind.Sequential)<br />
]<br />
public struct _GUID<br />
{<br />
public uint x;<br />
public ushort s1;<br />
public ushort s2;<br />
<br />
[MarshalAs(UnmanagedType.ByValArray, SizeConst=8)]<br />
public byte[] c;<br />
}<br />
<br />
[<br />
StructLayout(LayoutKind.Sequential)<br />
]<br />
public struct _FILETIME<br />
{<br />
public uint dwLowDateTime;<br />
public uint dwHighDateTime;<br />
}<br />
<br />
[<br />
StructLayout(LayoutKind.Sequential)<br />
]<br />
public struct tagSTATSTG<br />
{<br />
[MarshalAs(UnmanagedType.LPWStr)]<br />
public string pwcsName;<br />
public uint type;<br />
public _ULARGE_INTEGER cbSize;<br />
public _FILETIME mtime;<br />
public _FILETIME ctime;<br />
public _FILETIME atime;<br />
public uint grfMode;<br />
public uint grfLocksSupported;<br />
public _GUID clsid;<br />
public uint grfStateBits;<br />
public uint reserved;<br />
}<br />
<br />
[<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),<br />
Guid("0c733a30-2a1c-11ce-ade5-00aa0044773d")<br />
]<br />
public interface ISequentialStream<br />
{<br />
void Read(out byte pv, uint cb, out uint pcbRead);<br />
<br />
void Write(out byte pv, uint cb, out uint pcbWritten);<br />
}<br />
<br />
[<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),<br />
Guid("0000000C-0000-0000-C000-000000000046")<br />
]<br />
public interface IStream : ISequentialStream<br />
{<br />
void Seek(_LARGE_INTEGER dlibMove, uint dwOrigin, out _ULARGE_INTEGER<br />
plibNewPosition);<br />
<br />
void SetSize(_ULARGE_INTEGER libNewSize);<br />
<br />
void CopyTo(IStream pstm, _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead,<br />
out _ULARGE_INTEGER pcbWritten);<br />
<br />
void Commit(uint grfCommitFlags);<br />
<br />
void Revert();<br />
<br />
void LockRegion(_ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint<br />
dwLockType);<br />
<br />
void UnlockRegion(_ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint<br />
dwLockType);<br />
<br />
void Stat(out tagSTATSTG pstatstg, uint grfStatFlag);<br />
<br />
void Clone(out IStream ppstm);<br />
}<br />
<br />
[<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),<br />
Guid("0000010C-0000-0000-C000-000000000046")<br />
]<br />
public interface IPersist<br />
{<br />
void GetClassID(out _GUID a);<br />
}<br />
<br />
[<br />
StructLayout(LayoutKind.Sequential)<br />
]<br />
public struct _ULARGE_INTEGER<br />
{<br />
public ulong QuadPart;<br />
}<br />
<br />
[<br />
StructLayout(LayoutKind.Sequential)<br />
]<br />
public struct _LARGE_INTEGER<br />
{<br />
public long QuadPart;<br />
}<br />
<br />
[<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),<br />
Guid("00000109-0000-0000-C000-000000000046")<br />
]<br />
public interface IPersistStream : IPersist<br />
{<br />
[PreserveSig()]<br />
int IsDirty();<br />
<br />
void Load(IStream Stm);<br />
<br />
void Save(IStream Stm, int ClearDirty);<br />
<br />
void GetSizeMax(out _ULARGE_INTEGER Size);<br />
}<br />
<br />
[<br />
ProgId("ICRMMC.IcrSnapin"),<br />
Guid("43C8177A-2392-419F-9156-34D24FE22319"),<br />
ClassInterface(ClassInterfaceType.None)<br />
]<br />
public class IcrSnapin : IPersistStream<br />
{<br />
public IcrSnapin()<br />
{<br />
}<br />
<br />
public void GetClassID(out _GUID a)<br />
{<br />
a.x = 0x43C8177A;<br />
a.s1 = 0x2392;<br />
a.s2 = 0x419F;<br />
a.c = new Byte [] {0x91, 0x56, 0x34, 0xD2, 0x4F, 0xE2, 0x23, 0x19};<br />
}<br />
<br />
public int IsDirty()<br />
{<br />
return 1;<br />
}<br />
<br />
public void Load(IStream Stm)<br />
{<br />
}<br />
<br />
public void Save(IStream Stm, int ClearDirty)<br />
{<br />
}<br />
<br />
public void GetSizeMax(out _ULARGE_INTEGER Size)<br />
{<br />
Size.QuadPart = 1234;<br />
}<br />
<br />
}<br />
|
|
|
|
|
I want to paste from my app into Notepad.
I am doing a straightforward
Clipboard.SetDataObject(stringValue, true)
and then when I look into Notepad, paste is disabled (as is copy/cut). I can cut and paste to and from other apps with notepad, no problem. What am I missing?
Sincerely,
Lindsay
|
|
|
|
|
The stringValue wasn't. So, since I'd not done anything with setting a DataProvider, I'm assuming that if the object type is not "well known", then you get nothing.
Sincerely,
Lindsay
|
|
|
|
|
Hi, is there a way to have a server run button jump to an anchor in the page?
Im having trouble getting request.redirect(...) to work, because just adding currenturl+#myanchorname doesnt seem to work. I dont want to use a link, becuase i want them to enter text in a box and then do a search, where it jumps to the anchor based on the text in the box.
if anyone has dont this before it be alot of help
thanks
steve
|
|
|
|