|
I have finished a application in VB.NET
How can I startup this application in IE by ActiveX ?
The site have all acceess right in client IE.
|
|
|
|
|
ActuveX doesn't open applications. ActiveX is essentially a fancy name for a COM-based component. You can't just open and run any application you want inside a web browser. There are, in most cases, severe restrictions on what you can and cannot do. Also, your component must be written as an ActiveX (or COM) server that Internet Explorer can use.
Did you consider this when writing your component? In VB.NET, there is a bunch of stuff you have to add to your component to expose it to COM properly so that IE can use it.
Exposing .NET Framework Components to COM[^]
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I don't know this and so I never consider about it.
I think my application cannot register for COM Interop,
and the check box in project property is disabled ...
Can you tell me the steps to create one ?
Thank you!
|
|
|
|
|
All I can do is point you at Google. With my wedding comming up in a few weeks, I really don't have the time to teach anyone anything over the web.
This is NOT an easy topic. There is no step-by-step for creating entire applications that will run in IE.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have used GetCaretPos to get the position of caret on any Editable box belong to any application like notepad for example.
the problem is:
I have a timer calling this function every 100 ms, when I run my program and begin to track the caret on any application it works fine.
but if I try to run another application and get the caret's position from it, the GetCaretPos function always points to the caret's position of the old application.
What can I do ??
|
|
|
|
|
First, why are you tracking the caret in any application? I don't see a reason to do this at all...
The system provides a caret for each message queue for a window. This doesn't mean that the caret actually exists! If the window you're trying to get the caret in chooses not to use the system caret, there's really nothing you can do about it.
Also, some applications don't use the system carest at all and implement their own caret. In this case, you're just out of luck. There is no one function that will give you the caret position for every application out there.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank's for valuable information.
About tracking caret. I need to do this because I want to display something like ToolTip box or List
at the caret's position.
If I have two applications support the system caret, can I get the caret position on each of them ?
|
|
|
|
|
Yes. But, GetCaretPos only works on the window that has the focus, or in other words, the window foreground window. You can't specify which window the function should work on.
The coordinates returned are the coordinates relative to the window the caret is in, or the client window, not the absolute screen position of the caret.
If you wanted to get the caret position of any window, you would first have to bring that window to the foreground and give the focus to the window that you wanted to get the caret position from.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
How to set the myForm.owner to a windows application instance like MS outlook?
For example, Dim oOutlook = new outlook.application,
Is it possible to see the form owner to the ooutlook?
Thanks
|
|
|
|
|
You can't. You're form won't work as part of another application. This has to do with Process and Threading boundries and the applications message pump.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Here is an example which I found on MSDN.
Private Sub ToggleBold()<br />
If Not richTextBox1.SelectionFont Is Nothing Then<br />
Dim currentFont As System.Drawing.Font = richTextBox1.SelectionFont<br />
Dim newFontStyle As System.Drawing.FontStyle<br />
<br />
If richTextBox1.SelectionFont.Bold = True Then<br />
newFontStyle = FontStyle.Regular<br />
Else<br />
newFontStyle = FontStyle.Bold<br />
End If<br />
<br />
richTextBox1.SelectionFont = New Font(currentFont.FontFamily,currentFont.Size, newFontStyle )<br />
End If<br />
End sub
With this code, I can change the current font bold style setting for the text selection of the RichTextBox
But the problem is,
If the selected text consists of two or more font styles, it doesn’t work.
Example :
Say that my selected text is
I am going to somewhere
You can see my sentence is consist of two font styles, When I select the whole sentence and try to change the current font bold style setting for it by using above code, it does not work
I think the problem occurs here
richTextBox1.SelectionFont = New Font(currentFont.FontFamily, ……..
Dose anyone know how to correct it
Regards,
Chatura Dilan
|
|
|
|
|
It's documented on MSDN that the behavior of SelectionFont , when confronted with multiple fonts in the Selection , will return Nothing . RichTextBox.SelectionFont[^]
The only way I can think of to get around this would be to get the bounds of the Selection , the go through that Text, Selecting one character at a time, and character-by-character, change the font to add the bold style. With large volumes of text, this could take a while.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ok, Thank you
Regards,
Chatura Dilan
|
|
|
|
|
Following is from help file in my VB.net(2001):
ReadOnly Public Property Timer() As Double
Remarks
The Timer property returns both the seconds and the milliseconds since midnight. The seconds are in the integral part of the return value, and the milliseconds are in the fractional part.
Example
This example uses the Timer function to pause the application. It can perform other processing during the pause.
Dim Start, Finish, TotalTime As Double
If (MsgBox("Press Yes to pause for 5 seconds", MsgBoxStyle.YesNo)) = _
MsgBoxResult.Yes Then
Start = Timer ' Set start time (seconds).
Finish = Start + 5.0 ' Set end time for 5-second duration.
Do While Timer < Finish
' Do other processing while waiting for 5 seconds to elapse.
Loop
TotalTime = Timer - Start ' Calculate total time.
MsgBox "Paused for " & TotalTime & " seconds"
Else
End
End If
I cannot make it work in ay way.Timer always gets underlined and I get following message:
"Timer is a type and cannot be used for expression."
How does one get it work?
I will appreciate any help you can give me with this.
Thank you Jirka
|
|
|
|
|
I think you are looking at the help for an object which has a Timer() property rather than the System.Timers.Timer object. This is the one you need. For example:
Dim myTimer As New System.Timers.Timer
myTimer.Interval = 1000
myTimer.Enabled = True
myTimer.Start()
Don't forget to establish the event handlers for myTimer.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
Hi, thank you for your answer, but this is not what I was looking for. Ordinary timers and even "server timer" are not exact enough for my purpose.
I was running two of them one interval exactly 45 times of the other and usually faster one got only 35 ticks before slower one ticked.
Since my post I found this:
"System.Environment.TickCount "
which seems to work similar to the thing from my first post. It shows ticks every milisecond but not since midnigt, because at 4PM count was only about 8 000 000 since midnight it should have been 57 000 000.
Does anybody know when the count starts and when it resets if ever?
My VB.Help does not mention it at all.
Thank you Jirka
|
|
|
|
|
Jirikub wrote: System.Environment.TickCount
This is not the tick count since midnight. It's the tick count since the system was started, and if left running, will rollover Int32.MaxValue to Int32.MinValue in just short of 25 days. The resolution is about 500 milliseconds. One tick is about 100-nanoseconds.
The timer you use depends on the application requirements. Different timers use differents methods to signal your app that they have elapsed. Forms-based timers use events, which don't fire exactly on time and there can also be a delay in your code getting the event if your app's message queue gets bogged down with many events. Other timers use callbacks to call your code directly on a seperate thread.
Soooo, what are you trying to do with these timers?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you for your information, it should help. I am trying to make sort of metronom to assist with exercise and there will be graphics synchronized to exercise, but mostly goal is to learn VB. I must add that in this VB-Help is most unhelpful, if it was not for people like you and others, who are willing to spend time helping us dummies I would probably give up. Ilearned a lot just by reading these forums.
Thank you Jirka
|
|
|
|
|
Jirikub wrote: I am trying to make sort of metronom to assist with exercise and there will be graphics synchronized to exercise
OK. Should be easy enough.
But why two timers?? Why not just one?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: But why two timers?? Why not just one?
One timer is set by user choosing speed of exercise, range 10-25 moves a minute. Faster one is set 45 times faster to sequence graphic display. When I tried using one timer and just add it 45 times total time varied wildly, setting of 18 mpm could get you 14 or 15 instead. Time was affected by loading graphics and sounds which are part of the program. Of course with two timers exercise speed would be close to that set, but graphics would finish too early or not finish at all. I also suspect that it would change on different machines. I write this on 3GHz computer,but it will run on old 1GHz in basement. Now that I do not use timers at all, just check everything against this "System.Environment.TickCount" it works fine.
Jirka
|
|
|
|
|
Hi,
How to we play music files (e.g .wma or .mp3 etc) in a vb.net application when the application is running?
And how to let a few songs play one after the other? i.e when the first song finishes, the second one starts after a short pause.
|
|
|
|
|
|
Can someone please explain to me the logic and theory of why we need to use Table adapters. I know they are important in terms accessing your data from your database (access database is what im using because our computers do not have SQL on them at uni)and putting it into a dataGrid on a windows application, but i still have no concept on how to do that as our tutors didnt go over then in details.
for example my Code: it will not run past since i hve not declaired CheckUserAdapter and CheckUserTable, but im not sure how to.
Public Function UserPasswordMatches(ByVal userName As String, ByVal password As String) As Boolean
CheckUserAdapter.Fill(CheckUserTable)
Dim CheckUserDataView As DataView = CheckUserTable.DefaultView
CheckUserDataView.RowFilter = "Name = '" + userName + "'"
With CheckUserDataView
If .Count > 0 Then
Dim SecretKey As String = "785&*(%HUYFteu27^5452ewe"
If .Item(0).Item("Password").ToString.Trim <> vbNullString Then
Dim EncryptedPassword As String = Encryptstring(password, SecretKey)
If .Item(0).Item("Password").ToString.Trim = EncryptedPassword Then
Return True
Else
Return False
End If
Else
If password = vbNullString Then
Return True
End If
End If
Else
Return False
End If
End With
End Function
Thankyou
|
|
|
|
|
Can i call java code from vb.net , is there any way to do it ?
|
|
|
|
|
Not directly.
You have to use something in common that the two runtimes can use to communicate through. In this case, I believe that's COM. Depending on which codebase you want to use as a server, that code would have to expose some kind of COM interface (wrapper) so the other runtime can call it. In VB.NET, this is relatively easy. In Java, I have no idea what's involved, or if it's even possible. But, the client would just instantiate the server just like any other COM-based component.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|