|
In my random spare time, I was thinking about creating a few C# plug-ins for Eclipse. There is already an editor available, but I want to do it myself for a few reasons. I also plan on working on more than just an editor so I can learn more about the Eclipse architecture.
Michael Flanakin
Web Log
|
|
|
|
|
Hi,
I'm wondering if the Application.Idle event in the .NET Frameworks supports a concept similar to that in MFC whereby the Idle method can perform a small amount of work and release control back to the message pump but also indicate if it is finished or not. I have a senario where a lot of work may need to be performed while the application is Idle, but I don't want to degrade the user experience. Nor do I want to use threads as that will just get messy.
Cheers,
Andy
|
|
|
|
|
Andy MacAngus wrote:
Nor do I want to use threads as that will just get messy.
Why not?
- Nick Parker My Blog
|
|
|
|
|
Just a thought, but you could set up a mini message pump in your idle time event handler.
For example:
private static void Application_Idle(object sender, EventArgs e)
{
while(DoIdleTimeProcessing())
{
Application.DoEvents();
}
}
private static bool DoIdleTimeProcessing()
{
return isMoreProcessingToDo;
}
In the example isMoreProcessingToDo represents a boolean that is true if more idle time processing is necessary and false if all the idle time processing is complete. In the Application_Idle() method the return value from DoIdleTimeProcessing() is used as the condition in the while statement to determine whether to keep looping or not. If another iteration is necessary a call to DoEvents() will ensure that any pending events get processed.
Its been a while since I've done any MFC, but as I recall this should approximate the results you are looking for.
Does this help?
EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
|
|
|
|
|
Hi Colin,
Thanks for the sample. It worked great. However I noticed that if the idle time processing is not finished and the user shuts the application window then the application continues to run until the idle time processing is completed.
What I did was to create an event handler for the main form's Closed event. I also created a boolean private member variable on my application's main form class that gets flagged if the application Closed event fires. I then added a check in your DoIdleTimeProcessing() method to return false if the application closed flag was set to true. Now if the user shuts the application the Idle time processing also stops.
Cheers,
Andy.
|
|
|
|
|
hi,
im searching for the class that allows me to readin the network files and session informations.
under "fsmgmt.msc" i can see that connections but how can i get these in a programm? i have searched under System.Diagnostics but no result
|
|
|
|
|
There are two ways:
Use Interop Services and Windows API to do this, see Networking and Directory Services, plus a slew of other native OS functions...
Or the easy way...query the WMI...System.Management Namespace, specifically the SelectQuery Class. A good reference for can be found here.
With WMI, you query and do all kinds of things which are beyond the scope of this answer...just a taste of some of the things you can query:
Good luck!
|
|
|
|
|
hello,
Now I develop tool using socket class.
I use UDP protocol.
When I sent message to some client, I recept message from them. But some client sent message to me, I can't receive.
I investigated how to keep waiting for receiving message.
I used Poll method.
The following is my send message code.
If you know how to, please tell me.
regards,
IPAddress ip = IPAddress.Parse(psIP);
IPEndPointlep = new IPEndPoint(ip, port);
Socket s = new Socket(lep.Address.AddressFamily,Type.Dgram, ProtocolType.Udp);
s.SendTo(sMsg, 0, sMsg.Length, SocketFlags.None, lep);
The following is my receive message code
IPEndPoint sender =new IPEndPoint(IPAddress.Any, 0);
EndPoint tempRemoteEP = (EndPoint)sender;
byte[] sMsg=new byte[2048];
s.ReceiveFrom(sMsg, 0, 2048, SocketFlags.None, ref tempRemoteEP);
|
|
|
|
|
hi,
i am trying to call the functions from VB.net dll to COM dll.
First i wrote a vb.net dll for SMTP interface and took following steps
1. generated a key pair for sink class using sn -k
2. then i export the dll using tlbexp ..\x.dll ..\x.tlb
3. then registered that dll with registry usin RegAsm /codebase option
4. gacutil /i , to make it available in global chache.
Thus now my dll is registered with registry.
In my COM dll, i import the .tlb but, i not getting the CLSID and IID then
how should create an instance in the com dll?
Also how to call the function from vb.net dll to com dll
Plz help me out
Any help is welcome
Regards
bharti
|
|
|
|
|
|
I have an ArrayList of objects, all of which implement a known interface. However, I can't figure out how to get an interface to an object returned from the ArrayList:
IMyInterface I = (IMyInterface)(MyArrayList[3]); // Invalid cast exception.
I can't just cast MyArrayList[3] to a class that implements IMyInterface, since the objects may be of different classes.
Can somebody give me a hint?
Thanks.
|
|
|
|
|
Are you sure the item at MyArrayList[3] is an instance of an object that implements IMyInterface ?
You should be able to cast by just writing (C#):
IMyInterface iface = (IMyInterface)myArrayList[3];
You can check if an object implements a certain interface as follows (this assumes testObject is the object you're testing for it's definition):
if (!typeof(IMyInterface).IsAssignableFrom(testObject))
throw new ApplicationException("Object {0} doesn't support IMyInterface", testObject.GetType());
IMyInterface iface = (IMyInterface)testObject;
iface.SomeMethod();
|
|
|
|
|
I found the problem.
I had defined the same interface in two different assemblies and assumed this would be the "same" interface, but it is not. I moved the interface definition to a common assembly and the cast now works like I though it should.
Thanks,
Daniel
|
|
|
|
|
You can also use "as" key word: casts if possible, otherwize returns null:
Object o;
IMyInterface mi = o as IMyInterface;
if (mi==null)
...
Jonathan de Halleux.
www.dotnetwiki.org
|
|
|
|
|
What in the HELL is wrong with this code:
<br />
Private Sub Form_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load<br />
Dim Document As New CrystalDecisions.CrystalReports.Engine.ReportDocument<br />
<br />
#If DEBUG Then<br />
Document.Load(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) & "\..\Reports\" & m_ReportSource & ".rpt")<br />
#Else<br />
Document.Load(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) & "\Reports\" & m_ReportSource & ".rpt")<br />
#End If<br />
Dim LogOnInfo As CrystalDecisions.Shared.TableLogOnInfo = <font style="color: blue;">Document.Database.Tables(0).LogOnInfo</font><font style="color: green;">
</font><br />
LogOnInfo.ConnectionInfo.Password = "*******"<br />
Document.Database.Tables(0).ApplyLogOnInfo(LogOnInfo)<br />
<br />
CrystalReportViewer1.ReportSource = Document<br />
End Sub<br />
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
Is there an easy way to change the default on the browsable attribute for the property grid? I have a derived class with a few members and a base class with a large number of members. If I set an object of the derived class to display in the property grid, I would like to hide the inherited members. Currently, to hide the inherited memebers I need to define them in the derived class and set the browsable attribute to false. Is there a way to default the browsable attribute to false?
|
|
|
|
|
Just add the BrowsableAttribute :
[Browsable(false)]
new public Font CaptionFont
{
get { return base.CaptionFont; }
set { base.CaptionFont = value; }
}
|
|
|
|
|
Hi, anyone know where I can find a graphical chart over the classes and namespaces of the .NET framework? Something similar to what exists for MFC library, see link below. Thanks, Patric
Hierarchy Chart
|
|
|
|
|
|
Hi
I am trying to test the time it takes my .NET application to load 1st time. When the application is called the 1st time, the JIT compiler generates a native code. I am looking for a way to clear the cache which is holding thie native code, so I can measure the time the app takes to load accurately.
Any tips would be welcome!
thank you.
|
|
|
|
|
You try writing an unmanaged loader to instrument the load time of the app by binding to a specific runtime (not the current one) and launching the app. See Hosting the Common Language Runtime for more information. Also check out the Unmanaged API Reference, especially CorBindToRuntimeEx
This may not work, as I'm not sure how different instances of the load time of the newly hosted runtime is affected by an already loaded instance of a runtime version.
Good luck!
|
|
|
|
|
Setup:
I am using several multi-selection listboxes on various pages of a tab control on a Windows form.
Problem:
After leaving a tab page that has one of the multi-selection listboxes on it, then returning to the initial page, all multiple selections in the listbox are lost except the topmost selection.
Potential solution:
Save the listbox selections on a tab page change (or update the collection constantly) and reset the listbox when the tab page is reactivated.
Question:
Does anyone have a better solution?
|
|
|
|
|
Hi,
I'm struggling with some code:
Dim ico As New Icon("c:\copy.ico")
Dim bmp As Bitmap()
bmp = ico.ToBitmap
bmp.MakeTransparent(bmp.GetPixel(0, 15))
bmp.Save("c:\copy.gif", Imaging.ImageFormat.Gif)
the copy.ico is the standard icon from office with on the lower left (in vs.net) the color rgb: 0 128 128. I'm trying to set this color as transparent before converting it to a gif image. Unfortunately it always turns out to be a black backgroundcolor instead of transparent. When I leave the Imaging.ImageFormat.Gif the image has a color of grey (still not transparent) and it can't be opened with photoshop (it opens when I put the ImageFormat back to gif).
Does anyone have any experience with solving this problem?
Thx, Kris.
|
|
|
|
|
We have an application that is running under .net. Most of the code is in VB.net, however, we have several cobol programs that are compiled for .net using fujitsu cobol. We are using cobol because we have several sites that we support and most sites are mainframe, so we use a case probduct that generates these core translate programs for the various platforms. When we run these programs that have been compiled for .net via Fujitsu cobol, we are getting a SQLState error of 9999B with SQLCODE error of 999999800 on an insert when we send alot of data through these programs. When we get this error, we loose the record. We are using ODBC and using a microsoft ODBC driver for SQL Server. I haven't been able to find anything on what these error codes mean. I've tried displaying the SQLMSG but there is nothing in that field when this error occurs. Has anyone seen this, and if so, do you know what it means?
|
|
|
|
|
I am trying to figure out mimic this code in the visual C++ .net anyone know how to attach this?
void GoFullScreen( HWND hwnd,int FullScreen, RECT *sizerect, int x, int y )
{
int cx, cy;
HDC DC = GetDC( NULL );
if( x == 0 || y == 0 )
{
cx = GetDeviceCaps( DC,HORZRES ) + GetSystemMetrics( SM_CXBORDER ) + 1;
cy = GetDeviceCaps( DC,VERTRES ) + GetSystemMetrics( SM_CYBORDER ) + 1;
}
else
cx = x; cy = y;
ReleaseDC( 0, DC );
if( FullScreen )
{
// Remove caption and border
SetWindowLong(hwnd, GWL_STYLE,
GetWindowLong(hwnd, GWL_STYLE) & ((~WS_CAPTION | WS_BORDER )));
// Put window on top and expand it to full screen
SetWindowPos( hwnd, HWND_TOPMOST, -(GetSystemMetrics( SM_CXBORDER ) - 1 ),
-( GetSystemMetrics( SM_CYBORDER ) - 1 ), cx+2,cy+2, SWP_NOZORDER );
}
else
{
SetWindowLong( hwnd, GWL_STYLE,
GetWindowLong( hwnd, GWL_STYLE ) | WS_CAPTION | WS_BORDER );
SetWindowPos( hwnd, HWND_NOTOPMOST, sizerect->left, sizerect->top,
sizerect->right-sizerect->left, sizerect->bottom-sizerect->top, SWP_SHOWWINDOW );
SetWindowLong( hwnd, GWL_STYLE, GetWindowLong( hwnd, GWL_STYLE ) | WS_CAPTION |
WS_BORDER | WS_SYSMENU | WS_GROUP | WS_DLGFRAME );
SetWindowPos( hwnd, HWND_TOPMOST, -GetSystemMetrics( SM_CXBORDER ) - 1,
-GetSystemMetrics( SM_CYBORDER ) - 1, cx+1+5,cy+1+30, SWP_NOZORDER );
}
}
Thanks,
Steve
|
|
|
|