|
Cool, thanks for the help.
|
|
|
|
|
Read about synclock and monitor. They provide a mechanism that locks an object and blocks other threads from accessing it except the thread that created the lock. When the lock is released the blocked threads are allowed similar lock and access.
|
|
|
|
|
I’m writing a C# DLL that executes a web browser. I have to grab a static image when the browser is done updating. So I wrote the following code.
public string SaveImageToFile()
{
int done = 0;
String file = "";
while (done < 20)
{
if (((webbrowser1.IsBusy == false) && (webbrowser1.ReadyState == WebBrowserReadyState.Complete)) || (done == 19))
{
Bitmap docImage = new Bitmap(webbrowser1.Width, webbrowser1.Height);
webbrowser1.DrawToBitmap(docImage, new Rectangle(webbrowser1.Location.X,
webbrowser1.Location.Y, webbrowser1.Width, webbrowser1.Height));
file = "C:\\Rumper\\tempA" + num + ".bmp";
docImage.Save(file, System.Drawing.Imaging.ImageFormat.Bmp);
++num;
done = 20;
}
else
{
System.Threading.Thread.Sleep(100);
Application.DoEvents();
++done;
}
}
return file;
}
However when I call SaveImageToFile from my MFC application, I get a stackoverflow. If I comment out the DoEvents. No stack overflow and no image.
I need to replace DoEvents, but I’m not sure what would be a better method.
Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Is this method called from within an event handler? If so, calling DoEvents may be refiring the same event and calling your code again, and again while you are still inside of the While loop. I would suggest removing the event handler at the begining to the SaveImageToFile method, then adding the handler at the end. This can also be done within the Event handler method as well.
I have had way to many headaches for this problem to hit me again, and 99% of the time, it's because the event is being fired before your code completes.
Hope this helps,
Scott Page
"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
( President Ronald Reagan)
|
|
|
|
|
No I’m not calling from an event but there are several timer procs in the main MFC software.
I have totally abandoned the DoEvent method. It causes to much strange stuff.
Now I have to keep my webbrowser control going. I need it to paint the info.
Thanks for thring to help
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
I'm using serialization of objects for a client-server application, these need to communicate and I want them to send and receive a message (ApiMessage) that contains a base class NetworkElement. There are several types of network elements that derive from this base class.
[serializable]
class NetworkElement
{
}
[serializable]
class NetworkElementX: NetworkElement
{
}
[serializable]
[XmlInclude(__typeof(NetworkElement))
class ApiMessage
{
NetworkElement* pNetworkElement
}
When I fill my message with a NetworkElementX and serialize an exception is thrown, the inner exception mentions that class NetworkElementX is not expected and I should use a XmlInclude arghhhh
The technology is great and works in cases when I use an ArrayList to transport objects. I shall try and encapsulate my object in an ArrayList and see if that works.
I've tried all sorts and been going around in circles for ages, if anyone has any pointers it'd be much appreciated.
|
|
|
|
|
good morning freinds,
i m designing crystal report in.net framework i.e. bundeled version.
i am preparing payslip, for that i wnt to place watermark image on page.
whn i insert picture by right clicking on the report then it is inserting my backgruound image but lines present on my report go backward & also not shown whn i run the project.
i rightclick on image & send it backward but it lines will not cum in front.
& there is no option of line to bring it forward .
please anyone tell me how should i place background image on my report.
thanks for any help in advance.
"The Difficult i can do it now...
The Impossible will take a little longer."
|
|
|
|
|
hi priya
i have got complete payroll source code if you want it send mail or
IM in yahoo my yahoo id is nare700
my emails nare700@yahoo.com
nare700@gmail.com
I have read the previous posting in this forum. In it, it mentioned the use of dataset to achieve this.
I create a dataset which one of the field in the data table is base64binary.
After retrieval of the file path, open the file and store the image file as array of byte in that column.
When you bind the dataset to your report as the data source, you can easily drag and drop the image field to your report.
Conversion of image file to array of byte:
Dim fs As New System.IO.FileStream(<file path="">, IO.FileMode.Open)
Dim br As New System.IO.BinaryReader(fs)
Dim arrayByte() As Byte
arrayByte = br.ReadBytes(CInt(fs.Length))
br.Close()
fs.Close()
Hope this help!
naresh
|
|
|
|
|
I think I know the answer to this, but here goes.
I have developed an app using .NET 2.0 Framework, and now have a potential customer wanting to run it on Windows NT. I have trawled the web for the last 2 nights, all leading me to the same conclusion; .NET 2.0 cannot be installed on WIn NT. Could someone please confirm or deny this for me please.
Thanks in advance
Bit
|
|
|
|
|
All you had to do was search MSDN for ".NET Framework System Requirements" and you would have had it in 10 seconds.
System Requirements for Version 2.0[^]
You are correct, NT4 is not supported.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave
I had found that info, but the post was a last chance; just in case.
Bit
|
|
|
|
|
OK. I don't know what was so ambiguous about the part of the that page that said "The .NET Framework cannot be installed on the following operating systems...", but, OK....
Wait 'til the .NET Framework 4.0 comes out and Windows 2000 won't be supported.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
The only possibility I can think of is one of the commerical programs that compiles .net into a native executable. If your app isn't actually calling any post win2k APIs one might work.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
dan neely wrote: If your app isn't actually calling any post win2k APIs one might work.
Yeah, but what about the classes in the .NET Framework that would be calling post-NT API's?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
It would depend on what all he's using from the 2.0 framework, which was why had the disclaimer. Some stuff like generics I assume should be OS independent.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
http://support.microsoft.com/kb/829740
This article would have you use a wrapper class that serializes more nicely than DataSet, and in fact it really does halve the size of the dataset (in serialized form).
However, the time it takes to serialize a decently sized dataset 100 times to the time it takes to serialize the surrogate 100 times is 6 seconds to 30...
Nonetheless it seems like the overall consensus is that it's good to avoid sending DataSets across remoting and soap.
What are your thoughts and solutions on the matter?
|
|
|
|
|
I ran into something like this a while back. We had large files that we needed to send across a web service. I wrote an article on the solution I came up with:
http://www.codeproject.com/cs/webservices/sending_files_via_webserv.asp[^]
Note if you do have a web service some of the new WSE 3.0 allow some pretty nice features for attaching files. It means that WSE 3.0 needs to be installed, but some nice stuff comes with it.
Anyway, my article is about files, but you can certainly take other large objects and zip them down and encode them and pass them along a cdata node.
Anyway, I don't know if that will help you out or not.
Ben
|
|
|
|
|
Thanks for your response. I looked at your solution and it may work well enough for files, but in serialization and compression it's really the file type that matters. You created a pseudo-schema, which is almost like a dataset in itself.
I'm just trying to find the quickest way to do it. The problem with the Surrogate that MSDN suggests is the large overhead to get to it.
A simple object[][] (light but a pain to use) outperforms DataSet and DataSurrogate (zipped and unzipped) significantly on a small number of rows, but as the actual size increases, the difference fades.
|
|
|
|
|
Hello! Has anyone known what are the problems with http://www.bozemanblog.com It hasn't worked any more? There were a lot of useful articals...
|
|
|
|
|
If there are multiple projects in a single solution, then how to access a function from one project in another project.
aasstt
|
|
|
|
|
:-DI have same problem
wert
|
|
|
|
|
You can add a reference in the caller project.
Right click references, click projects ,select the project that contains the class.
make the class and the function public
|
|
|
|
|
Hi guys.
I want to write my program in .NET 2.0, just because I'm used to it (and because it will be primarily run on XP). However, for a certain part of the screen (i.e. a separate window) I want to use WPF to render text and video etc. Is this possible? What I was thinking was creating a component in WPF, and adding it to my app. Does anyone know of an easy way to do this? Am I just confused, thinking that I cant use .NET 2 controls in a .NET 3 project?
Any help would be appreciated.
Cheers
Jacob.
|
|
|
|
|
The CLR and Windows Forms are completely unchanged in ".NET 3.0". I put the quotes round it because ".NET 3.0" is a stupid marketing name for .NET 2.0 plus WPF, WCF, Workflow Foundation.
I believe there are components which allow WPF to render to part of a Windows Forms form, and to put Windows Forms controls on a WPF-managed window.
|
|
|
|
|
Anybody know right off the top of their head how
to ping /poll the SMTP server before hitting
email.send("","","","") without resorting to:
Try
Catch
Finally...?
If I forget to load OL Express, it dies..
Isn't: System.Net.Mail.SmtpClient("svr")
supposed to return a value?
Thanks,
B.Griffin
|
|
|
|