|
Is there any way to get a parent control to accept messages before a child control does? For instance, I have a richtextbox inside of a control that is inside of my current control that seems to be grabbing my OnDrag... messages. I want any of the OnDrag... functions to be handled by my control first and then passed to the child controls to be handled by them. Heck, it would even be good if the child control handled it first and then it percolated outwards to my parent control. That is not happening, however. What is happening is that my dragdrop is being prevented by the inner child control, which ruins the functionality of my outermost parent control.
Is what I'm trying to do possible?
|
|
|
|
|
Hi,
I'm involved in a project which will create a few decision records on how to manage / deploy .NET applications in our environment.
Besides the ".NET best practices" whitepapers from Microsoft, is there any other place I can get some more information about a general .NET architecture or implementation??
Is there any "best practice" information for managing .NET infrastructure (as opposed to developing it)?
thanks for any advice or suggestions!
|
|
|
|
|
Hi,
can anyone direct me to an article which describes importing CSV data into few different variables?
|
|
|
|
|
What language? Some sample in C#, it will read this content:
value1, value2, value3, value4, value5<br />
...
StreamReader reader = new StreamReader(file);
string line = "";
Regex lineMatch = new Regex("([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)");
Match matches = null;
while((line = reader.ReadLine()) != null)
{
matches = lineMatch.Match(line);
if(matches.Success)
{
}
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
yes, language is c#, and this code solves problem...thanks.
|
|
|
|
|
Hello,
When I am uninstalling a setup project, some files (that are not added there at installation time, but are created later by my program) are not deleted. I want to be able to delete those files, too. I tried adding a custom uninstall action where I am specifying an .exe to execute. The exe deletes the two files when is executed, but this does not happens during the uninstall process. Any ideas?
Thanks
|
|
|
|
|
Hi All,
I have a doubt on the Out Of Memory Exception thrown by CLR!! Why does it do so, When Windows is providing a virtual memory of 4GB for a 32-bit processor for each and every process!! So according to this if an application starts, then a virtual memory of 4-GB is provided to it, and Windows keeps performing complex algorithms to swap data from RAM to physical memory!!! My doubt is when Windows is doing so much why at all we get an Out of Memory Exception??
I beleive that the memory management is a lot more complex than i have understood, can any of you please enlighten me on the same??
Thanks anyway,
Rajesh
|
|
|
|
|
OutOfMemoryExceptions can occur for other reasons, if I remember correctly. For example, GDI resources that don't get cleaned up properly will eventually run out. So, if you create an instance of a class that supports the IDisposable interface then remember to Dispose() it when you are done with it.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Colin is correct. If you use any GDI or GDI+ objects, especially when doing you own custom drawing, and don't properly release them by calling Dispose when your done with them, the unmanaged underlying system handles don't get released and are eventually exhausted, causing your OutOfMemory Exception.
There are other things that will cause this too, but not properly Disposing the objects you're using, no matter what they are, will result in exhausting one or more of the system handle pools.
If you want a quick check of this, open TaskManager, click on its Processes tab, then go to the view menu and pick Select Columns. Turn on Handles, Threads, USER Objects, and GDI Objects. Click OK, then go to the list and file your app. Watch it run for a little while. If any of these counters just keeps rising the longer you use your app, this gives you a hint of where the problem lies.
Handle counts usually don't rise above 1,000 in most cases. I have seen examples of piss-poor programming (in commercial software, no less!) where the Handle count grew above 100,000 handles in use! This is a REALLY BIG clue there's leaky code somewhere in that app...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I need to serialize an unmanaged class in VC .NET. Please guide me how can I do this.
Ahmad
|
|
|
|
|
i have created a console application in C#.Net. This exe calls a dts package on a sql server and that package in return generates a text file and some excel files as result.
i have scheduled this through window scheduled tasks option to run daily with a domain account which is not included in the adminstrator group of the local machine.
The problem is that the text file is generated but the excel files are not.
But when i run the exe thru : right click> Run As> and then provide the same non admin credentials, all files including excel files are generated.
Even when i log on to the system as this non admin account and run the exe directly, i get full results!
Is there any privilege difference in executing a task thru the task scheculer? or am i missing something?
I have also checked the event viewer and the following error was logged:
"Access denied attempting to launch a DCOM Server. The server is:
{00024500-0000-0000-C000-000000000046}
The user is visiadmin/KARACHI, SID=S-1-5-21-854245398-2146720035-839522115-2639."
visiadmin is the non admin account and KARACHI is the domain name.
i have also followed the support on
http://support.microsoft.com/default.aspx?scid=kb;en-us;290398
but still no results!
I am using VS.Net 2003, O/S: Windows Server 2003, exe developed on C#.NET, MS Office 2003.
Please help me!
thanx in advance
Regards
☺«««DTA»»»☺
|
|
|
|
|
Could someone please tell me if firefox is compatible with .NET framework? I need to write a firefox plugin to call a particular engine that is written in c++ , so..
|
|
|
|
|
Firefox plugins are written in javascript. If you can get a JS plugin to start a process with your engine (and your computer has the framework) then sure.
I looked at the CVS For IeView a firefox plugin that views a page in ie... So its possible to start a process...
http://www.mozdev.org/source/browse/ieview/ieview/content/ieviewOverlay.js[^]
<br />
usePath = targetFile.target;<br />
<br />
var process = Components.classes['@mozilla.org/process/util;1'].getService(Components.interfaces.nsIProcess);<br />
process.init(targetFile);<br />
var arguments= [] ;<br />
<br />
arguments.push(argumentstext);<br />
<br />
process.run(false, arguments, arguments.length, {});<br />
return true;<br />
All I can suggest is Googleing Components.classes and @mozilla.org/process/util
I'll get ya started:
http://www.xulplanet.com/references/xpcomref/comps/c_processutil1.html[^]
Matthew Hazlett
Sometimes I miss the simpler DOS days of Borland Turbo Pascal (but not very often).
-- modified at 20:35 Wednesday 25th January, 2006
|
|
|
|
|
I'm writing a network sniffer in C# on Windows XP SP2 using VS 2005 and .NET 2.0, and apparently with SP2 Microsoft has disabled the ability to create Raw Sockets.
Does anybody know if there is a workaround so that Raw Sockets
will work? Other than going to a different OS?
Thx,
Tom
|
|
|
|
|
I'm just off the wikipedia site, reading on the concept of CLI, bytecode, JIT, Managed C++, etc. It jdawns on me that Microsoft's .NET Framework( still a key part of VS 2005)makes C++ no longer a precompiled Lan tool anymore! The C++ code is precompiled by .NET engine to bytecode, which is transmitted to the user, then translated into machine code by .NET virtual machine on the users's computer, just before runtime. (Just In Time-- JIT)
This is exactly like what Java does. So .NET Framework makes C++ like Java?
Here is my question, if .NET Framework makes C++ portable now, why bother with C#? to create web, ADO.NET, and ASP.NET applycations?
Can I stay with C++ to creat a powerful ASP.Net apps? Do you have weblinks talking about this subject?
Thanks
|
|
|
|
|
Essentially, managed C++, C#, J# and VB.NET all get compiled into MSIL (Microsoft Intermediary Language, if i remember correctly), so anything you can do in one language, you can call/re-write in another.
However, certain features of C++'s syntax make this harder than in C#, so I would advise learning the syntax of C#.
|
|
|
|
|
There are two flavors of C++ now. The normal unmanaged C++ that you've always had, still compiles to native code. And the Managed C++ variety, that compiles to MSIL or sometimes sections in native and sections in MSIL.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
larryfran wrote: why bother with C#? to create web, ADO.NET, and ASP.NET applycations?
Because it's a damn site easier!
class="FQ">larryfran wrote: Can I stay with C++ to creat a powerful ASP.Net apps?
As far as I'm aware there is no support for creating ASP.NET apps. in C++. Thre certainly isn't in the IDE. Though in theory there's no reason why you shouldn't be able to.
Kevin
|
|
|
|
|
Hello,
I have a C# interface with a method carrying C# structs(inherted from System.ValueType whose base class is System.Object). I implemented this interface in MC++ adapter class. Pasting the sample code below:
eg:
//C# interface definition:
public interface ISrv
{
void Ping(PingIn aPing_in, ref PingOut aPing_out);
}
[StructLayout(LayoutKind.Sequential)]
[Serializable]
[Guid("C6497AEF-1839-45bd-AFAC-E533D7A03225")]
public struct PingIn
{
public Int32 flag;
public Guid lockId;
}
[StructLayout(LayoutKind.Sequential)]
[Serializable]
[Guid("B6BC3BEB-2FA2-45c6-B64A-434CE00F6A55")]
public struct PingOut
{
public Int32 status;
public Int32 lockStatus;
public Int32 nFailures;
[MarshalAs(UnmanagedType.SafeArray,SafeArraySubType=VarEnum.VT_I4)]
public Int32[] list;
public Int32 state;
public UInt32 errMsgId;
}
//MC++ class implementing ISrv interface
public __gc class AimAdapter: public ISrv
{
///c'tor
:
:
:
void Ping( [In] nsIAimServer::PingIn aPing_in,
[In,Out] nsIAimServer::PingOut* aPing_out)
{
}
:
:
:
:
};
When tried to use aPing_out in Marshal:;StructureToPtr() to convert to IntPtr, I received compilation error for casting. For some reason aPing_out lost its connectivity to System.ValueType (whose base class is System.Object). Is there a special way to maintain this connecitivity while implementing C# interface in MC++? Can you please clarify?
-- modified at 16:45 Tuesday 24th January, 2006
|
|
|
|
|
I've got a list of ~1500 items that I am putting into a ListView. Originally I was doing it in the main UI thread but it "freezes" the application for a few seconds. So I tried moving it to a BackgroundWorker, but the main UI thread still gets bogged down. In my ProgressChanged event handler I added Sleep(10), as a few examples suggest. The good news is that it works; the bad news is that it makes the operation take an order of magnitude longer. What can I do to speed this up?
private void fillListView(IList list)
{
this.listView.Items.Clear();
this.listView.BeginUpdate();
this.progressBar.Visible = true;
this.backgroundWorker.RunWorkerAsync(list);
}
private void backgroundWorker_DoWork(System.Object sender, System.ComponentModel.DoWorkEventArgs e)
{
System.ComponentModel.BackgroundWorker worker = sender as System.ComponentModel.BackgroundWorker;
IList list = (IList)e.Argument;
for(System.Int32 i = 0; i < list.Count; i++)
{
System.Windows.Forms.ListViewItem item = getListViewItem(list[i]);
System.Threading.Thread.Sleep(10);
System.Int32 progress = (System.Int32)System.Math.Ceiling((System.Single)(i + 1) / (System.Single)(list.Count) * 100.0f);
worker.ReportProgress(progress, item);
}
}
private void backgroundWorker_ProgressChanged(System.Object sender, System.ComponentModel.ProgressChangedEventArgs e)
{
System.Windows.Forms.ListViewItem item = (System.Windows.Forms.ListViewItem)e.UserState;
this.listView.Items.Add(item);
this.progressBar.Value = e.ProgressPercentage;
}
private void backgroundWorker_RunWorkerCompleted(System.Object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{
this.progressBar.Visible = false;
this.listView.EndUpdate();
}
|
|
|
|
|
Try turning off screen updates for that control before you add the items and then turn them on again when you are done.
Take a look into SuspendLayout and ResumeLayout.
The bottom line is that you have to trade off SOMETHING. Suspend and Resume stop you form seeing the updates as the data is put in. Adding the sleep allows you to process the main thread and see UI updates but as you see causes the process to take longer.
Better, Faster, Cheaper, Pick two. You can't have it all. Maybe look into how you can load less items. Do you really need all 1500?
Maybe consider doing something like putting them into a local dataset and then binding to that instead of writing directly to the control.
Maybe write some entries then wait for the user to scroll down closer to the end and then add more as needed at that time.
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
Well ListView has BeginUpdate() and EndUpdate() to temporarily disable paiting the control. I am already using these, and adding SuspendLayout() and ResumeLayout() didn't change anything. Perhaps I should have mentioned that I'm using the ListView in Details view with multiple columns; the ListView does not support complex databinding out of the box and all the examples I've seen use the same method to fill the ListView that I am using so that's not really any help. I think I will look into Virtual mode. Thanks.
|
|
|
|
|
The UI can only be updated in the main thread, so a BackgroundWorker doesn't help.
Use listView.VirtualMode, then you can display items without having to add them to the list.
|
|
|
|
|
I am using the BackgroundWorker mainly to get progress updates. It also prevents the UI thread from freezing (i.e. I can drag the window or resize it, click menu items, etc). I agree that using a BackgroundWorker shouldn't help, but for some reason it does. Anyway, I am going to look into using Virtual mode.
|
|
|
|
|
I tried the virtual mode but that led to all sorts of problems. I need to have the listview sorted and be able to remove items from the listview; both are non-trivial in virtual mode (sorting may not even be possible). I have comprimised and split the 1500 items into smaller sets and just entirely forego virtual mode and threading altogether. The slight delay to add ~200-300 items is acceptable.
|
|
|
|
|