|
how can i develop plug-in control using vb.net?
Manish
|
|
|
|
|
All you have to do is search the articles for "plugin", or click[^]. There's plenty of examples.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am doing a project in which I need to get some information from the ppd file and display in my application. The fields like holepunch, staple etc. I want to get these information from the ppd file into my comboboxes. can anyone help me in doing this in vb.net.
thanks
kavitha
|
|
|
|
|
I have to guess at what you mean by a "PPD" file, so if it's a Postscript Printer Definition file, it should be loadable into an XmlDocument, then you just use normal XPath queries to get the information you want out of it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello there,
I have to repost this message to see if anyone can give me the ideal of how to solve this problem. Please accept my appologies if I have caused anything to the forum's rule.
I have a VB app that creates and runs MS PowerPoint 24/7. When I first started, the application runs Ok as I expected, but then sometime the COM's error from MS PowerPoint throw an exception such as "PowerPoint currently experiencing the problem. We are sorry for the inconvenience, bla, bla... Click Ok to restart the MS PowerPoint", and the system is hung till user must click Ok to dismiss the error dialog box. Since this application runs 24/7 so in the middle of the night, there is noone there to click the OK button to restart the PowerPoint.
I am trying every posible ways to prevent this error to show up such as kill the PowerPoint Object and reinstantiate, reboot host if error happen... Howerver, none of my code worked since the system was hung unexpectedly because MS PowerPoint throw the error and system was hung before the pointer returned back to my code.
I am wondering if there is any way I can sense the error message from PowerPoint and prevent it before it shows up as the error dialog box. Or is there any way I can send code to click the Ok button to dismiss the error diaglog box. Please give me some advice where to start, or point me to some direction. I know there are messages que but I don't know how to access them and how to find the ID of the error windows. I am totally lost in this part now. Please give some advice.
thanks in advance for reading this message
Paula
|
|
|
|
|
There's no way to "sense" the error message. You'll have to poll the windows (FindWindowEx) to see if the error Window exists. If so, then you'll have to get it's window handle and send the appropriate Window messages to it to click the OK button to dismiss the dialog.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you Dave for your response
should the algorithm to click the Ok button as following?
0/ Activate timer to call the procedure 1/
1/ Enumerate through all windows
2/ compare the error window with the error ID
3/ if there is a matched then go to 4/ else exit and wait for next timer's pulse
4/ Get the error window handle
5/ send the click message to the Ok button
I think I can do 0, 1, 3, 4. But I don't know how to get the error ID of the error windows because the error windows seems having the same signature as PowerPnt.exe. the error seemed inside the COM server's object.
I did a trace in system event log but it just said COM's error return from HRESULT of powerpnt.exe which does not make any sense at all. Another problem is this error did not happen very often. Sometime twice a day, or one in three days, or sometime once a week which is very annoyed me.
Do you have any ideal how I can capture the errorID of that windows? And what's API name should I call to complete number 5.
Thanks you all again for read and responded to my post.
|
|
|
|
|
paulajohn wrote: I am trying every posible ways to prevent this error to show up such as kill the PowerPoint Object and reinstantiate, reboot host if error happen... Howerver, none of my code worked since the system was hung unexpectedly because MS PowerPoint throw the error and system was hung before the pointer returned back to my code.
Instead of focusing on trying to recover from the error, focus on figuring out where the error originates from and handle the error.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Thank you all for the reading and input.
I have no ideal how's the error throw. I put try catch every where but it did not go into the try catch template. Moreover, after every line of code, I had the sub routine to write to system event log such as time, variable that the code did process, etc... It seemed to work just fine when I investigated the system event log because it passed and exit the sub routines normally. I believed my code logic is correct.
I think I will do as Dave's advice. It's really suck when it does not work the way it's expected.
Thanks again
|
|
|
|
|
I cannot find the code on how to create a KeyChar for an "Enter" key. The only tutorial I have found tells me to do it like this:
<br />
Private Sub FormName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress<br />
If e.KeyChar = "Enter" Then<br />
Function1()<br />
End If<br />
End Sub<br />
But this doesn't work. Can someone give me some ideas please? Thank you!
|
|
|
|
|
Example from MSDN:
Imports System
Imports System.Windows.Forms
Public Class Form1
Inherits Form
Public Sub New()
' Create a TextBox control.
Dim tb As New TextBox()
Me.Controls.Add(tb)
AddHandler tb.KeyPress, AddressOf keypressed
End Sub 'New
Private Sub keypressed(ByVal o As [Object], ByVal e As KeyPressEventArgs)
' The keypressed method uses the KeyChar property to check
' whether the ENTER key is pressed.
' If the ENTER key is pressed, the Handled property is set to true,
' to indicate the event is handled.
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
e.Handled = True
End If
End Sub 'keypressed
Public Shared Sub Main()
Application.Run(New Form1())
End Sub 'Main
End Class 'Form1
---
b { font-weight: normal; }
|
|
|
|
|
Thanks a lot for your help!
|
|
|
|
|
Hi,
I have been trying to write a program in VB .net to convert an HTML document to a tiff file. It will be used to retrieve a page from a secure web site that our customers must first login to, then when they pull up the information that we need they will use our activex control to grab the html from the current page and it will then be converted to tiff format and sent to us. I have had no problem working with IE but I have not been able to grab the HTML source from an open firefox window. This is crucial since so many people use firefox over IE. Any assistance would be greatly appreciated.
Thanks!
|
|
|
|
|
View --> Page Source?
File --> Save Page As
Or do you want to retrieve it programmatically?
"a fool will not learn from a wise man, but a wise man will learn from a fool"
"It is hard to fail, but it is worse never to have tried to succeed." - Theodore Roosevelt
"Success is going from failure to failure without losing your enthusiasm." - Winston Churchill
My Website || My Blog
|
|
|
|
|
View --> Page Source?
File --> Save Page As
Or do you want to retrieve it programmatically? ActiveX components won't work in firefox you may have to write your own Class Lib.
"a fool will not learn from a wise man, but a wise man will learn from a fool"
"It is hard to fail, but it is worse never to have tried to succeed." - Theodore Roosevelt
"Success is going from failure to failure without losing your enthusiasm." - Winston Churchill
My Website || My Blog
|
|
|
|
|
Thanks for the reply
Fair enough... yes I would like to retrieve it programmatically, perferrably with VB code. I suppose that an activex control would not work in firefox in this case, but is there any way of doing this even with a program that the user could simply download and run?
Thanks again for any assistance
|
|
|
|
|
Hi,
I need a Visual Basic .NET source which can capture network traffic in packets. I have found a lot written in C/C++ but i need a Visual Basic .NET version of that.
I already got a version made in Visual Basic 6, but im not able to find a free version to VB.NET!
Please help me!
|
|
|
|
|
|
Oh yea thank you.
But i dont know much about how to implement or call functions, and if you could catch a link where it is made through vb.net that would be great!
|
|
|
|
|
This is my first time with VB.NET and XML, so feeling my way through. In VB6, you could get the text of the xml into a string using the dom.xml. Is there an equivalent in .NET using the XmlTextWriter? I am basically building 2 xml documents, then I need to concatenate them in a string. Is the XmlTextWriter the best way to go to build xml?
Thanks
|
|
|
|
|
I have the above problem figured out. However, my output is odd. Using the following code:
xws = New XmlWriterSettings
xws.Indent = True
xws.CheckCharacters = True
xws.IndentChars = " "
xws.NewLineOnAttributes = True
xws.Encoding = System.Text.Encoding.UTF8
xws.CloseOutput = False
Dim test As New System.Text.StringBuilder
'Create the access request portion
Using xw As XmlWriter = XmlWriter.Create(test, xws)
xw.WriteStartDocument(False)
xw.WriteStartElement("AccessRequest")
xw.WriteAttributeString("xml", "lang", Nothing, "en-US")
xw.WriteElementString("AccessLicenseNumber", "LicNum")
xw.WriteElementString("UserId", "UID")
xw.WriteElementString("Password", "PW")
xw.WriteEndElement()
xw .WriteEndDocument()
xw.Flush()
xw.Close()
End Using
Return test.ToString()
And the output is as follows:
<?xml version="1.0" encoding="utf-16" standalone="no"?>
<AccessRequest
xml:lang="en-US">
<AccessLicenseNumber>LicNum</AccessLicenseNumber>
<UserId>UID</UserId>
<Password>PW</Password>
</AccessRequest>
I set the encoding version in the xmlWriterSettings, so why is it putting in utf-16? Also, I dont understand why there is a line feed between the AccessRequest and its attribute. Is this normal?
Thanks
|
|
|
|
|
Use XMLTextWriter as posted above, but be carefull joining two XML docs, a well-formed xml doc must have a single root. You can create a XMLDataDocument from the XMLTextWriter and using XPath Functions (like selectnodes) you can join the docs easily. Once joined, get xml-string. XPath functions return nodes by using expressions (i.e. Select("\ROOT\SECOND_LEVEL\") returns all nodes under <root><second_level>. With the property InnerText u can access to tag value.
Hope it helps
-----------------
Solo hay 10 tipos de personas, las que saben binario y las que no
|
|
|
|
|
That helps yes, thank you. But I am still not understanding why I am getting the utf-16 encoding attribute when I tell it to use utf-8.
|
|
|
|
|
I've tried setting the encoding for TextWriters,
Dim test As New System.Text.StringBuilder()
Dim twriter As StringWriter = New StringWriter(test)
'twriter.Encoding = Encoding.UTF8 -- Readonly
Dim twriter2 As TextWriter = twriter
'twriter2.Encoding = Encoding.UTF8 -- Readonly
Dim xmlWriter As XmlWriter = New XmlTextWriter(twriter2)
...no success...
It seems that VB Strings do not allow other than utf-16 encoding (mmmm, strings are stored that way...) for "memory-string-writers"
Using files and encoding "utf-8" OK.
"I dont understand why there is a line feed between the AccessRequest and its attribute. Is this normal?"
take a look to xws.NewLineOnAttributes = True
-----------------
Solo hay 10 tipos de personas, las que saben binario y las que no
|
|
|
|
|
"take a look to xws.NewLineOnAttributes = True"
Thanks, that was stupidity on my part. So I'm stuck with utf-16 unless I switch away from a string builder/writer. Thanks for the help.
|
|
|
|