|
Wow - that's a really bad idea. What's so hard about creating your own dialog with a window to display text ? Or live with the fact that Notepad will let them change/save it.
You can control Notepad, but it's more work than you need to do, and it sure can't be done with a language as limited as VB.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
rswipe wrote:
how can you disable menu items and the text window in VB.NET code?
Since Notepad doesn't expose any kind of automation interface, you'll have great difficulty in pulling this off, in ANY language, Christian! .
Christian is correct, though. It's much quicker, and FAR easier, to build a form specifically for displaying your help file in a read-only TextBox.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
Since Notepad doesn't expose any kind of automation interface, you'll have great difficulty in pulling this off, in ANY language, Christian!
True, but there are articles here on CP that do it in C++, I believe. Like I said, it's a hell of a lot of work, and a complete waste of time ( the article was proof of concept more than 'here's something useful' ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
Like I said, it's a hell of a lot of work,
I haven't seen the article, but, I'm going to guess it involves window finding and sending a bunch of messages to tell the controls to disable themselves?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
OK guys, thanks for the comments. i agree making your own dialog box isn't so difficult although getting the format right is sometimes time consuming depending on how big the help file is.
i'm all for an easy life and if there was a "one-liner" to do what i wanted then all the better.
thanks anyway.
|
|
|
|
|
I'm not quite sure what you mean by "format". But it is easy enough to place a read-only RichTextBox control on a dialog box you create. Then you can simply load your help file into the RichTextBox with the LoadFile command (RichTextBox1.LoadFile("help.rtf") ). It's a "one-liner" and unlike NotePad, you can display a RTF where you can have more than just text! If that fails to please, you could always use the HTML Help Workshop to create a help file
|
|
|
|
|
|
Hi,
The subject explains what I would like to do, but here's more detail:
I have a WinForm which contains a TreeView control and a AxWebBrowser control. When a user clicks on a TreeNode a file (placed in TreeNode.Tag) is loaded into the AxWebBrowser control. I have hidden the menus and toolbars of the AxWebBrowser control since they are not meant to be seen by the user and in this particular case, my AxWebBrowser control is used for viewing and searching documents.
Is there a way to show the Find Dialog via SendKeys (Ctrl-F) from a menu option or toolbar from my Main form? I have tried the following code:
Private Sub mnuEditFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _<br />
Handles mnuEditFind.Click<br />
SendKeys.Send("^F")<br />
End Sub
OR
Private Sub mnuEditFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _<br />
Handles mnuEditFind.Click<br />
AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_SHOWFIND, _<br />
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER)<br />
End Sub
Using either code has no effect. I believe the SendKeys method is sending the message only to the active window which is my Main form. Is there a way around this to make it work?
Any help or guidance would be much appreciated. Thanks!
|
|
|
|
|
Try using command AppActivate before sending keys "^F".
|
|
|
|
|
Hi, thanks for your reply...
I have tried AppActivate before using send keys, but since the AxWebBrowser control is embedded in the Main form along with other controls, I am having trouble setting focus or locating the process id of the control. For instance if i try something like the following:
<br />
Private Sub mnuEditFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditFind.Click<br />
Dim pi As New Process<br />
pi = Process.GetProcessById(AxWebBrowser1.HWND)<br />
AppActivate(pi.Id)<br />
SendKeys.Send("^F")<br />
End Sub<br />
I recieve an "Unspecified error". I am not having trouble giving focus to the Main form itself. I have tested SendKeys by sending "%{F4}" in code, and as expected, it closed the window.
I need to find a way to activate or set focus to the AxWebBrowser control before using SendKeys. If I click on the AxWebBrowser control when my application is running, I can easily press Ctrl-F on the keyboard and the Find Dialog will popup. But I wish to put this as a menu/toolbar option since the main user's of this application won't be very "computer savvy"
Any other suggestions? Is there some way to send a message in code or have the AxWebBrowser control listen to key events??
Thanks!
|
|
|
|
|
Just to let you know, I figure out how to use the SendKeys method! Who would have thought that SendKeys would be case sensitive! All I had to do was replace my "^F" with "^f" and now it works!
Private Sub mnuEditFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles mnuEditFind.Click<br />
'AxWebBrowser1.Select()<br />
SendKeys.Send("^f")<br />
End Sub
There is however a bug with this. For some reason, the AxWebBrowser does not activate properly in code (AxWebBrowser.Select() ). Therefore, forcing you to click on the control before allowing you to use the menu option! At times, if you do not click on the AxWebBrowser to activate it...the SendKeys method will hang your application and you won't even be able to move your mouse! I still have not found a way around this. But at least I know that send keys works now
Also, for anyone interested in an alternative method which I found (and works) but what I was trying to avoid using since it is dependent on Microsoft.mshtml:
HOW TO: Invoke the Find, View Source, and Options Dialog Boxes for the WebBrowser Control from Visual Basic .NET
|
|
|
|
|
Hey there,
I have an application which has a "ThunderRT6UserControlDC". There are various control within this container such as
1. A drop down box
2. Label box
3. Gifs
4. a List View
For some reason 1 and 2 are not visible as having handles when viewed from Spy++.
I need to get the handle to the Label box (2) to retrieve its text. I'm trying to access this from a different program so I have to use handles and cannot use properties withing my application.
Any suggestions!!
Abhishek
|
|
|
|
|
I would like to take this code:
Dim wsrv As New SEOWS.Service1
And substitute the SEOWS with a string variable.
The result I am looking for would be similar to ASP and HTML where the ASP would resolve the string variable to a value and the HTML would use that value in the statement as if it were typed in that way.
Am I being clear? And is this even possible?
|
|
|
|
|
btoyer wrote:
And substitute the SEOWS with a string variable.
You mean you want to create a variable of indeterminate type ? So it could be anything, or a subset of things ? How would you use this variable ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Example: I would have a variable xString.
I would set the value of xString to SEOWS.
I would then have the code Dim wsrv As New xString.Service1 so that it would make a variable wsrv As New SEOWS.Service1
Is this more clear?
|
|
|
|
|
I was not confused as much as incredulous.
I doubt you can do this. I also don't see why you'd want to. Your code, to compile, would have to cast wsrv to a specific object (defeating the point), or only call the methods that exist on object with this class instance. One other option would be a ton of reflection code, but to what end ?
If you could explain why you'd consider doing this, perhaps we can suggest a sensible solution.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian is right. You can't just have a string value interpreted as code. Your ONLY option is using Reflection, but what you want to do is a huge pain in the a$$ because you want to use it with a web service.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am making a simple media player app using DirectX but i cannot figure out how to
get any control over the actual window the video plays in. help...?
|
|
|
|
|
What are you using to play your media?
|
|
|
|
|
In Visual Basic 6. I am working on a project where people get information from a website.
I have two WebBrowsers. WebBrowser1 and WebBrowser2. WebBrowser1 links to a website and as it links to the website, all the links in WebBrowser1 should open in WebBrowser2. Is this possible to do?
|
|
|
|
|
Here is the example of what I made:
Private Sub Form_Load()
If WebBrowser1.Navigate ("http://www.google.com/") Then
WebBrowser2.Naigate = (WebBrowser1.Navigate)
End IF
End Sub
|
|
|
|
|
What you are trying to do is very difficult. The WebBrowser control does not allow you to detect in-page events like clicking on a hyperlink.
There is a BeforeNavigate event that you can use to get a URL from the first browser after a hyperlink is clicked to pass to the second. It also has a Cancel parameter that you can use to prevent the first window from navigating to the new link, in order to keep it on the original page.
The problem with using that is how do you know when the person clicked on a link in the first browser that should open in the second, versus when the person clicked on a link that should cause navigation in the first window, like moving to the second page of a set of search results?
It's pretty much an impossible problem to solve.
Robert
|
|
|
|
|
I have a combobox with several items. I want each item to open a different avi clip and play it in
the multi media player i have created. how do i point each seperate combobox item to a file on my computer???
Thank you for your help
|
|
|
|
|
if all the files are within the same path then make strPath variable to hold that path name. Then each item in the combo box should be the actual filename (without the extension) so append this item name onto strPath's value and pass it to ur media player.
Example:
' path where avi files are stored
Dim strPath = "C:\Document and Settings\admin\My Documents\"
Dim sFile = strPath & Combo1.Text & ".avi"
' now pass sfile as the file parameter to the media player
|
|
|
|
|
that is exactly what i needed, thank you
|
|
|
|