|
How can I broadcast a User Defined Windows Message on C#?. Somthing like BroadcastSystemMessage. I need cath it on DefWndProc on a form.
|
|
|
|
|
It's not a good way to do interprocess communication, but the API function you're looking for is SendMessage[^], or one of it's variants as you see fit.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So, I've changed the font(style and characteristics), and the fore and background colors for both selected and not selected on the ColumnHeadersDefaultCellStyle of my DataGridView(Image part A). This is the ONLY place I have modified the information. In the editor itself, only the font changes show up(Image Part B), and when the program is run, neither the font nor the color changes show up(Image Part C). Any ideas if this is a bug with the new DataGridView class or I'm just not setting anything correctly?
Link To Image Goodness of my Problem[^]
|
|
|
|
|
Im currently serializing a objects of type Task, which is defined as
[Serializable]
public class Task
{
public event NameChangedHandler NameChanged;
... etc ...
}
the problem is that there are types which are not Serializable connected to the NameChanged event.
one of these objects are of type class UITask. this causes the serialization process of Task objects to try to serialize the UITask objects contained by
the event which naturally results in a serialization exception.
Does anyone know how to avoid this? I guess it can be done by implementing ISerializable, but there should be an easier solution?
Thanks!
Johan
|
|
|
|
|
I'm not clear on what the desired effect is, here:
1. You want the event serialized, but want some way of bypassing or simplifying the UITask type? - or -
2. You just want to skip serializing the event altogether?
In case 1, there's really no shortcut - either implement ISerializable and deal with it in GetObjectData and a deserialization constructor, or come up with a way to mark UITask as serializable.
In case 2, you can mark the event with a [Field:NonSerialized] attribute, or mark the delegate with a [NonSerialized] attribute.
Of the two choices, I would vote for not serializing the event. When you serialize an event, you're making a request to serialize the entire event subscriber graph, and since it's not usually completely knowable what types may be subscribing to your event (or whether they're serializable), it's a risky move as well as a potentially slow one.
Here's a link to a discussion on the topic:
http://weblogs.asp.net/rosherove/archive/2004/12/29/343659.aspx[^]
Hope this helps.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Is there a way to edit the msi database with c#. I want to write a program that will change just one registry entry within the msi database and then email the msi to the client.
This will save me the hassle of recompiling the msi and then emailing it to the client.
Thanks in advance.
|
|
|
|
|
Highly doubtful, an MSI is compressed.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
This is not an easy task. You have to get to know the finest of details of how an MSI database works and how all the tables relate to each other. You can start by reading this[^] and following all the links.
Or you can just get Wise for Windows Installer, or some other product that can edit MSI files directly.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Asad Hussain wrote:
Is there a way to edit the msi database with c#. I want to write a program that will change just one registry entry within the msi database and then email the msi to the client.
If you download the platform SDK[^], you get a tool called "Orca" which you can use to edit the MSI database. If you know what you want to change (in general, changes to the Registry table are very straigtforward), it's very easy to effect and save the change.
If you are determined to do the changes programatically, this article[^] provides the interop signatures and sample code you'll need.
Once you've opened the database, you just use SQL to UPDATE the tables you want.
Share and enjoy.
Sean
|
|
|
|
|
I am using an iterator, which iterates through the xml file and reads each node.
Can I access an element directly if it has an unique name?
|
|
|
|
|
Yes you can if you know the XPath to it one example of doing this could be something like -
<code>
XmlDocument doc = new XmlDocument();
doc.LoadXml("<root><element1/><element2/></root>");
/*DocumentElement is always the root element of the xml and the parameter supplied in the selectSingleNode method is the XPath*/
XmlNode node = doc.documentElement.selectSingleNode("//element2");
</code>
|
|
|
|
|
I got a listview that is in details mode, and I want to have a changeable line that is a property of listviewitem. Or something like that...
It don't have to be a listview, it only needs to do what I described above...
Niklas Ulvinge aka IDK
|
|
|
|
|
hi there,
i just wondered if it is possible to "host" a .NET WebService withing a WinForms Application ( and not as ASP.NET stuff in IIS).
I know this is no Problem in Java and i´d like to know if i can do this with C#.
we´re developing a business software and we want our WebService in our Application (encapsuled in a Plugin). well...is this just possible?
i tried to just let my class inherit from System.Web.Services.WebService but i have no idea how to access this "WebService" Object.
any ideas? thanks
jkersch
|
|
|
|
|
You have to host ASP.NET in your Windows Forms application because this provides the services that a .NET Web Service uses. In fact, Visual Studio 2005 no longer requires that IIS be installed to develop Web Forms and .NET Web Services because it has a separate process that hosts ASP.NET. See the System.Web.Hosting namespace[^] for details.
Once you've hosted ASP.NET you can do just about everything you'd do when hosted from IIS. Keep in mind that IIS does provide some services, such as setting up and tearing down hosts for ASP.NET, handling hung hosts, etc. You could, of course, make your host do that but you'll need to implement it.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I am getting an unexpected OutOfMemoryException when I try to dynamically allocate a large 2 dimensional array. This array requires upto 1 gig of memory. I have 4 gig installed on this XP Pro machine.
My C# code is listed below:
//-------------------------------------------------
NumToBurst = 100;
NumberOfPixels = 2048 * 2048;
try
{
BigImageBuf = null; // de-ref mem from prev alloc
GC.Collect (); // free up mem from prev alloc
BigImageBuf = new byte[NumToBurst, NumberOfPixels * 2 ];
}
catch
{....
//------------------------------------------------
During execution the NumToBurst variable varies from 10-120. The OutOfMemoryException is generated when the NumToBurst value is greater than 92.
No problems with smaller values.
Help!
|
|
|
|
|
With the code you've submitted, there is no problem. I was able to reproduce this on a 1GB machine with a 2.5GB swap file and get it to work to NumToBurst = 169, which works out to be 1.4GB. The entire array went straight to the swap file when it was created. I'm not even calling GC.Collect, which is unncessary in your case, based on what I've seen so far. I think your problem is because of a 2GB limit for any one process. You might want to see this[^] for a bit more information.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is it possible to create a property which shows a small button (like font picker) and when the button is clicked a new form is loaded ?
|
|
|
|
|
Piovra_ wrote:
Is it possible to create a property which shows a small button (like font picker) and when the button is clicked a new form is loaded ?
Yes[^]
Share and enjoy.
Sean
|
|
|
|
|
Hey everyone.
I'm really hoping someone can help me with my problem.
I have an mdicontainer application form. The child forms are opened by double clicking on nodes in a tree control. The default way for a child form to open is not maximized...so when I open one form (not maximized) and then open a second child form (also not maximized), things work fine. However, if I open the first child form and maximize it, then open the second child form (which automatically tries to open maximized), I get an OutOfMemoryException that tells me it can't create the window handle. I stuck a breakpoint in the Load event of the child form and it is never reached. The exception is thrown as soon as it reaches the Show() method of the child form. Please Any ideas? This is driving me crazy.
|
|
|
|
|
This isn't normally a problem at all. What does your code look like thats launching these forms?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well, I just figured it out. Weird...I should have realized when people were telling me that the OutOfMemoryException wasn't always helpful. I have a panel on that form that I'm catching the resize event for. I didn't know that the resize event for the panel would be caught before the Load event for the child form. I was trying to use something that hadn't been initialized yet because it was initialized on Load. So it should have been a null reference exception instead of out of memory.
Thanks for your reply and your willingness to help.
|
|
|
|
|
You probably got the OutOfMemory problem because the window handle for the object your messing with wasn't created yet. Handle problems will normally be thrown in the OutOfMemory exceptions.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
I was trying to find the solution to my problem, but it seems there are no sources to whatever I am facing. Here it is:
I wanted to build a report using Crystal Reports, but my dataset has 120 columns by N records, and in Crystal Reports I can't increase the paper size to whatever I want, so 120 columns don't fit. So now I am trying to build my own report, by adding columns and rows at run time and passing it to a reportViewer. Anyone knows how to do it?
Help will be greatly appreciated.
Thank you.
|
|
|
|
|
120 columns? Who on earth is going to read this?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is this any of your concern who is going to read it!? If you don't the answer, don't f***ing reply!
|
|
|
|