|
Ok, haven't read them yet but just noticed there are quite a few articles listed under Add-In's on the main page.
PS to webmaster (the search functionality could stand a tweak I think)
--Tony Archer
"I can build it good, fast and cheap. Pick any two."
|
|
|
|
|
So my original question remains. All the articles I saw were for vb add-ins.
--Tony Archer
"I can build it good, fast and cheap. Pick any two."
|
|
|
|
|
So? Don't you realize that VB uses automation, which is what the interop assemblies you'd use does? It's the same thing. The object model documented for any automation client like VB is the same which you'd use in .NET. If you're talking about VB.NET, then you don't seem to understand that different languages that target the CLR are only different syntaxes (some compilers support different levels of the CLI/CLR, however). All the languages compile down to Microsoft Intermediate Languages (MSIL), which is why the .NET Framework allows for so many languages.
For a true .NET developer, translating between VB.NET and C# should be no problem. If you're talking about VB6, then again I remind you that the automation object model exposed to clients like VB6 is the same that comprises the interop assemblies I mentioned in previous replies to your posts.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Oops, no I typed the wrong letter. I am well aware that they all compile to the same thing and use the same object structure. I meant VS as in Visual Studio Add-Ins. I am interested in Office Add-Ins. Specifically Power Point. I cannot seem to find many docs on automation of powerpoint (or office in general) from .NET
I already wrote an the add-in, so now there is an extra button on the toolbar when I run Power Point. The button when clicked opens a custom form but I am having trouble finding documentation on how to interact with Power Point from that form.
Specifically,
- How do I get a reference to the power point application so I can set my form's .owner property (or .parant)?
- How can I programatically make power point go into full screen mode?
- How can I read/set notes for specific slides in the current .ppt file?
--Tony Archer
"I can build it good, fast and cheap. Pick any two."
|
|
|
|
|
The best object model documentation is actually in the programming help that is not installed by default (with a typical installation) of Office. Re-run set and choose the programming help files. MSDN Online doesn't have much for some reason. When your control is created, the context in which it's created is the ApplicationClass as it's known in the interop assembly for PowerPoint (one word, BTW). The add-in object model should already expose a way to get the running instance, such as an Application property. This is very common throughout the object model.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I don't get it. I am trying to download from a series of webpages using a call to HttpWebResponse.BeginGetResponse. This is set up in a for loop, all calls are made in the main thread and I keep getting the following NullReference Exceptiion in system.dll:
> system.dll System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback(uint errorCode = 64, uint numBytes = 0, System.Threading.NativeOverlapped* nativeOverlapped = 1712424) + 0xa0 bytes
If its not this then its a Unable to read from transport error.
Can anybody help?
|
|
|
|
|
After how many requests do you start getting NullReferenceException s? Just getting responses async without any checks is dangerous. There may be a limit and there are warnings about this in the .NET Framework SDK documentation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Well after about 20 hours of trying every possible combination, I found out a way around this. All my requests/responses are in the main thread and I close the HttpWebResponse and the response stream as soon as I get them and I am fine. I managed to first make an initial request which gives a webpage with about 50 links. I make the 50 requests/responses on these links and this works fine. I thought I was good until I tried to repeat the process and it gives me this exception. I dont' get it since I close all the streams and all the async calls return fine. All my HttpWebResponse/Request objects are local variables in a function so they are never reused. When looking at the threads when this exception is thrown I notice that there are two threads that are blocked waiting to read the response stream, ie.
private void ProcessResponse(System.IAsyncResult state){<br />
HttpWebResponse linkpage=(HttpWebResponse)((HttpWebRequest)state.AsyncState ).EndGetResponse(state);<br />
StreamReader stream = new StreamReader(response.GetResponseStream());<br />
string info = stream.ReadtoEnd();
stream.Close()<br />
response.Close();
You said that getting them without checks is dangerous. What do you mean by a check?
|
|
|
|
|
Well, I see one problem: what if the file is not simply a text file? It will not have an EOF (end of file) so StreamReader.ReadToEnd will never return. Even streams that may appear as text may not be, and may not have an EOF. Just use a Stream and buffer the output (you don't have to do anything with it, like you're not doing for string info ).
What I mean is that creating threads wildly like this - without limiting how many threads are created - is dangerous. You should either have some mechanism that counts the number of async requests and blocks at a certain limit. An even better way is to not using async calls but to instead use a ThreadPool and queue requests synchronously (the end result is still asynchronous). The ThreadPool limits the number of concurrent worker items (threads) and queues the rest. It also has a few additional benefits you can learn by reading about the ThreadPool class in the .NET Framework SDK documentation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I am drawing the tab control myself and here is the problem:
In the app the user is allowed to change the tab name. However, if the string he/she enters is too long, not all of it is displayed on the tab label. Here is the code I am using:
<br />
private void buttonsTab_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)<br />
{<br />
Font f;<br />
Brush foreBrush;<br />
<br />
f = new Font(e.Font, FontStyle.Italic | FontStyle.Bold);<br />
foreBrush = Brushes.Black;<br />
<br />
string tabName = this.buttonsTab.TabPages[e.Index].Text;<br />
StringFormat sf = new StringFormat();<br />
sf.Alignment = StringAlignment.Center;<br />
Rectangle r = e.Bounds;<br />
r = new Rectangle(r.X, r.Y + 3, r.Width, (int)f.GetHeight() + 2);<br />
e.Graphics.DrawString(tabName, f, foreBrush, r, sf);<br />
}<br />
I set the height of the rectangle I use in DrawString to the font height. I dont want the string to wrap and start on a new line.
Is there anyway that I can ensure that the entire string is displayed at once?
Is my only option to limit how long the new name that the user enters can be?
Thanx for the help
-Flack
|
|
|
|
|
StringFormat allows various ways of clipping your string. Dig around there
|
|
|
|
|
I looked at StringFormat but it didn't solve the problem. I could clip the string but I would rather the tab label width increase to allow for the whole string.
When I let the tab control draw itself, the tab label width is automatically set to an approproate width so that it can contain the entire label.
Is there any way for me to change the tab label size myself?
I use e.Bounds from the System.Windows.Forms.DrawItemEventArgs arg to the DrawItem function but for some reason the width is not large enough.
Does anyone have an idea as to how the tab control draws itself to allow for the whole string to be seen so that I can use similar code in my DrawItem method?
Any suggestions?
-Flack
|
|
|
|
|
The TabControl encapsulates the Tab common control, so you can P/Invoke SendMessage to send the TCM_SETITEMSIZE (0x1329) to the control (use its Handle property, which is the HWND for the control).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I would like to override the default .NET OpenFileDialog to add a text box and label, and then be able to retrieve the entered value via the properties of the overriden dialog.
Is this even possible, if so can anybody point me in the direction of any docs that could help me achieve this effect.
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Inheriate from the OpenFileDialog, and alter the visuall aperance of the windows by resizing the window and adding your controls.
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Yeah - that doesn't work. OpenFileDialog uses the OPENFILENAME struct (documented in the Platform SDK). This can accept a dialog template as a field (requires a mask). Extending this simply won't work. Any experience with native Win32 programming would tell you that, as well as knowing that most everything Windows Forms merely encapsulates native functionality, like the GetOpenFileName API that the OpenFileDialog uses. See the IL using ildasm.exe for that class and you'll see.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Forget what he told you - it won't work. The OpenFileDialog class uses the GetOpenFileName native API, which uses a OPENFILENAME struct. This can accept a dialog template, but this is a native resource and not reproducable (not without direct memory manipulation, which would require an unsafe context and experience with dialog templates) using purely managed code.
I recommend using a mixed-mode Managed C++ assembly in order to create the dialog template using the visual designer (not a Windows form - an "old school" dialog).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'am sorry for missleading you then.
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hello everyone,
how do I save and print a graphic created by GDI+, using C#?
I just want to save and print the graphic not including the form where graphic was drawn.
Thank!!!
|
|
|
|
|
This is how you save something. Lets just say the class UI is the user control that you want to save. Printing is a bit more complicated. I gotta go now, but if I come back and nobody has answered I will show you.
public class UI:System.Windows.Forms.UserControl<br />
{<br />
public void UI_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
} <br />
public event PaintEventHandler paint = new PaintEventHandler(UI_Paint);<br />
public void Save()<br />
{<br />
<br />
Bitmap b = new Bitmap(this.Width,this.Height,this.CreateGraphics());<br />
PaintEventArgs pe = new PaintEventArgs(Graphics.FromImage(b),this.ClientRectangle);<br />
paint(this,pe);<br />
b.Save("filename",System.Drawing.Imaging.ImageFormat.Jpeg);<br />
}<br />
}<br />
}
You can save it to any format you want, there are quite a few you can pull from ImageFormat.
|
|
|
|
|
I'm trying to upload very large files to an image datatype in SQL Server 2000 using a c# app. The necessary code is below:
FileStream fsFile = new FileStream(chkLstFiles.Items[x].ToString(), FileMode.Open, FileAccess.Read); <br />
Byte[] fileData = new Byte[fsFile.Length]; <br />
fsFile.Read(fileData, 0, fileData.Length);
The code works fine for 'small' files (Under 40mb), but after that it fails. The error returned is, "Insufficient system resources exist to complete the requested service." It is choking on the fsFile.Read line. If I split that out to individual lines like:
fsFile.Read(fileData, 0, 10000000); <br />
fsFile.Read(fileData, 10000001, 20000000); <br />
...
It will continue until it passes into the 40-50million reads. (That's where I get the 'Under 40mb' limit above)
Ideas, thoughts or tips? Thanks in advance!
|
|
|
|
|
No databases has been designed for this. File systems has been design for this. Save a link to the location in the record and save the file where it belongs.
|
|
|
|
|
leppie wrote:
No databases has been designed for this
Oracle can accept file this large. A database vendor I used to program systems for actually had a scheme where they'd sit their database file (multi-gigabyte) inside an oracle database and access their own datastores through the oracle database. I never tried it, but they claimed that if you tweaked Oracle just right you would get faster access to the data sitting in their datastore files, and the client's DBAs would only need to worry about backing up one database.
If you were wondering why not just use Oracle directly the answer was that one of this database vendors specialities was the concept of "long transactions" - A short transaction is one that is complete in a fraction of a second, or maybe a few minutes at the very most (SQL Server and Oracle are very good at those). A long transaction is one that can take potentially years to complete.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
When I am using Microsoft Web Browser, I want to take the data that sending by "Microsoft Web Browser". But, when I trigger the BeforeNavigate2 event successfully. I can't get the post data or headers.
private void axWebBrowser1_BeforeNavigate2(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
{
MessageBox.Show(e.postData.ToString());
}
It doesn't work. Is any body know the reason or how to solve this problem.
Thanks
|
|
|
|
|
I would like to pass a public integer variable from a C#.Net Win Form to another C#.Net Win Form within the same project. I use the get{}; set{}; acessor or a global struct (is this available in C#? Maybe only available in C++).
I am thinking that maybe I should pass by reference instead of pass by value.
There is so much difference between SDK Compiler code, and Visual Studio Win Form code, I am really kind of lost right at the moment.
|
|
|
|