|
Thanks for the response.
I have tried your suggestion but the Memory in use from the application increases each time the notifyicon is clicked.
Calling dispose() from the eventhandler shuts the process down entirely - even when I try to escape the closure!
Hope you can help!
|
|
|
|
|
Hi,
thanks for using PRE tags; there are many problems with your code, such as:
1.
ScreenShot() is called twice; that must be a mistake
2.
there is a lack of Dispose() calls, as Dave already mentioned.
You must dispose of each of the graphics you create, so there must also be a dispose inside the for loop.
And you must dispose of each of the bitmaps you create.
3.
Jordan1982 wrote: Catch ex As Exception
Return False
End Try
is not acceptable; you should at least log what went wrong, not just ignore it.
And the helpdesk will probably hate you for providing no clue whatsoever:
"MessageBox.Show("Failed to take a screenshot - please report to helpdesk")"
4.
Jordan1982 wrote: Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
that is better, however ex.ToString() would show more information.
5.
Jordan1982 wrote: If System.IO.File.Exists(strPath) Then
System.IO.File.Delete(strPath)
End If
No need to test, Delete() does nothing when the file doesn't exist.
6.
Jordan1982 wrote: Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
'The click method for the systray icon
Main()
End Sub
Bad choice of a method name; Main() normally is what runs first, not something called by an event handler.
[ADDED]
7.
When multiple screens are present, the user can choose the configuration; they could be side by side,
on top of each other, with a gap in between, whatever. So simply adding the widths and looking for the maximum height will fail for all but some simple side-by-side configurations.
[/ADDED]
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
hi!
I have a Form with a CrystalReportViewer control (I should say that I use embedded Crystal report in .Net 2005). there are some reports to be shown in CrystalReportViewer of course, the problem is here: after showing the reports in runtime, I can not select(by mouse) or copy any of data shown in the report page. is there any setting omitted?
every suggestion whould be appreciated
|
|
|
|
|
I am working on a component that does its own non-client area borders using NCCalcSize and NCPaint. On some computers, it works correctly, and on others it works incorrectly.
The CODE:
using(Graphics g = Graphics.FromHwnd(Handle)}
{
Rectangle backGround = new Rectangle(new Point(0, 0), Size);
Rectangle clientRect = backGround;
clientRect.Inflate(-wnd.BorderWidth, -wnd.BorderWidth);
clientRect.Height -= captionDelta;
clientRect.Y += captionDelta;
g.ExcludeClip(clientRect);
g.FillRectangle(new Pen(BackColor).Brush, new Rectangle(0, 0, Width, borderWidth + captionDelta));
int halfBorder = borderWidth / 2;
int halfCaption = wnd.CaptionHeight / 2;
bool oddSize = (borderWidth % 2) == 1;
int borderRectTop = Math.Max(wnd.CaptionHeight, 0) / 2;
Rectangle borderRect = new Rectangle(0, borderRectTop, Width - 2, Height - (borderRectTop + 2));
g.DrawRectangle(new System.Drawing.Pen(SystemColors.ButtonShadow, 1), borderRect);
borderRect.Offset(1, 1);
g.DrawRectangle(new System.Drawing.Pen(SystemColors.ButtonHighlight, 1), borderRect);
}
(I know this has undrawn pixels at top right, bottom left)
The Problem:
On some machines, this correctly draws the two rectangles inside the clipping region. On other machines, it does not. When it does not draw correctly, it is as through the excluded rectangle started one pixel earlier, and was two pixels wider than it really is.
So, if the excluded rectangle is [2,2,Width-4,Height-4], a line drawn from [0,0] to [0,Height] draws correctly, but a line drawn from [1,0] to [1,Height] only draws in the top and bottom two pixels, as though the excluded rectangle were[1,2,Width-2,Height-4].
All the machines are Dell optiplex 330s, the video driver dates are mixed, they are all using the same video chip set (NVidia 8400s, IIRC).
Does anyone know why this would happen? Is this a known bug, am I messing up somewhere, or ... ?
Urgent, please send code
Silver member by constant and unflinching longevity.
|
|
|
|
|
I'm developing a small application in which the user can open/save files. It's very simple, the possibilities are actually just like Notepad. However, with my new application I'd like to use a custom file format with a custom extension. The main thing is that I'd like to be able to store properties like labels, author, etc. in my file format and that Windows can recognize it - for example when showing it in the right columns in Details view in Windows Explorer. Does someone have an idea how I'd go about this?
Thanks.
|
|
|
|
|
You can register a file extension under HKEY_CLASSES_ROOT in the system registry such that Windows will recognise the file extension, and launch a particular application if you click on such a file. There is some useful information here[^] at MSDN. However I am not aware of anything whereby Windows will actually look at the content of a file to make such a decision.
|
|
|
|
|
Thanks for your reply.
The extension part is not the problem actually, registering it with a custom icon etc. is working well. What's the problem is the properties part that I can't manage to get information about. It's a shame you don't have an answer on that but I'll keep looking for it.
Thanks.
|
|
|
|
|
pimb2 wrote: What's the problem is the properties part that I can't manage to get information about.
I'm not sure I understand what you mean here. The contents of a file mean nothing to Windows, only to an application that reads it.
|
|
|
|
|
I mean that properties like labels and author are saved in the contents of the file, for example with Word files (.doc, .docx).
At the moment I've managed to let Windows display several properties (like labels) in the Details pane (on Vista), just like Word files. The only thing is that I have to create a so-called Property Handler which has the job to read and write properties to a file.
Thanks.
|
|
|
|
|
pimb2 wrote: I mean that properties like labels and author are saved in the contents of the file, for example with Word files (.doc, .docx).
Sorry, my mistake; I'm not sure how to do this, I suspect it may be something to do with file streams. I do know that the version information in .exe files gets picked up via properties, but I've not looked into how that can be extended. I would guess MSDN has the details somewhere.
|
|
|
|
|
I just discovered some information here on MSDN[^] which may help.
|
|
|
|
|
Apologies for the delay in responding but I have been a little bit busy last few days.
Thanks for the link. Now, I've made quite some progress - I've managed to let Windows succesfully apply properties to a .docx file with a custom extension (ie, an Word file with the extension changed). Unfortunately, I've discovered that property handlers (dll's) must be made in native code because Windows Explorer uses internal calls to them. This means I cannot use .NET for this. I assume I should use the Word file format for the properties and put the actual contents of the file in the Word file. As the .docx file is actually a zip file, it won't give that much problems I hope.
I'll be experimenting some more.
Thanks.
|
|
|
|
|
pimb2 wrote: Apologies for the delay in responding
No worries, just hope you solve your problem. Maybe when you fully understand this stuff you can write an article about it.
|
|
|
|
|
How can we set a value for a field in code before ending the insert? I have a bindingsource and have bound some textboxes to it. But I want to set some of my database fields in code rather than through textboxes . These fields don't allow null values so that I will get exception if they are not set in code.
|
|
|
|
|
I Just loaded VS2008 pro 90 trail. When I try to display an WPF XMAL in the designer it gives me the error that I do not have an editor for XMAL.
Anyone know what needs to be loaded/change or where I get the XMAL editor.
|
|
|
|
|
|
|
Had the same problem, the solution for me was using Microsoft Expression Blend for the GUI design and visual studio for the rest.
|
|
|
|
|
hi!
I would like to disassembly some dll files with .Net Reflactor but I got the MSCDRUN, Module 'C:\WINDOWS\system32\MSCDRUN.DLL' does not contain a CLI header". compliance. I searched this problem the only thing I learned about the reason is this files had not been written any cli languages or there might be usage of obfuscation tool to keeping code secret . do you have any opinion how can I overcome this problem ?
|
|
|
|
|
So it holds native code, not .NET managed code. You could use DUMPBIN to peek inside.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
thanks for your attention. could you explain it in detail ? because it does not express me anaything
|
|
|
|
|
Simple. You don't. Reflector will not work on a native code .DLL.
You can find other disassemblers out there, but reversing a native code .DLL is not going to be that easy.
|
|
|
|
|
Hi Dave
I am new to this subject so I have very little opinion do you have any idea for other disassemblers ?
|
|
|
|
|
I think Dave gave you the answer; you can disassemble a dll but it will not mean much to you. Perhaps you could explain what you are trying to achieve with this?
|
|
|
|
|
I have a graduation project. I need to get the data form the blood pressure meter which has a usb gateway. this device also includes software that enables user to archieve the result in html or txt format. What I need to do is trasferring measured result from BP meter to PDA instead of PC. I think that if I reach the dll code of the application I can find a solution to do it. ıf you have better I idea I am completely open mind.
|
|
|
|