Totally Newbie, active x control

Hi,

I have an .asp (sql2000) web application.
I have VBStudio 6.0 installed, and I am totally new to this stuff. Need just code, donot have time to learn VB now unfortunately.
Want to create an activeX control that runs on my web-application.
I have one phonenumber in my asppage say: <% phonenumber = "12345678" %>

I want an activex-control that grabs this phone number and sends it to the command line with this command:
c:\program files\x-pro\x-pro.exe "12345678"

(the number changes each time).

I think this is possible. To use shell command in the asp-page does not work because of security issues.

(But I am in control of all the users machines that will use this web -application so I can do anything on the clients pc's if that is needed).

Best regards

Sjur
wahoooAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

anvCommented:
hi

open a new Vb Project

choose Activex Control from the Project Options..

in the Code window..of the User Control...just added into the project..

add an Event Like This

Public Event CallShell(PhNo As String)


add a command button to the control..
in the click event of this command button add code to raise the event

like this..

Dim phno As String

Public Event CallShell(phno As String)

Private Sub Command1_Click()
    RaiseEvent CallShell(phno)
End Sub

Public Property Get SetPhno() As String
     SetPhno = phno
End Property

Public Property Let SetPhno(ByVal vNewValue As String)
    phno = vNewValue
End Property

also, inthe above code i've created a property for the usercontrol..to set the phone number..

save the Project and user control...give any name u want..(say ShellExecutionControl)

now from the file menu..choose make ShellExecutionControl.ocx (or Whatever name u have given to ur project)

add a new project to test ur control...


from project menu choose components..

choose the user control..u just created above...

it'll be available in the list once u ve chosen make <anyNAme>.ocx from the file menu of the user control project...

u can see the component is added into the control box oif the the Standard EXe project u r working on now...

and add following code..

Private Sub Form_Load()
    UserControl11.SetPhno = "363634"
End Sub

Private Sub UserControl11_CallShell(PhNo As String)
   MsgBox PhNo
End Sub


hope its not so confusing...

try ..this..

and let me know if u have any doubt...

'ive just added a message box..if u want u can add a shell command ...

like this

Private Sub UserControl11_CallShell(PhNo As String)
   shell "c:\program files\x-pro\x-pro.exe " & phno
End Sub
0
wahoooAuthor Commented:
Hi, thanks for fast reply..

I created new activex-control..

is this the code I should paste in..?

Dim phno As String

Public Event CallShell(phno As String)

Private Sub Command1_Click()
    RaiseEvent CallShell(phno)
End Sub

Public Property Get SetPhno() As String
     SetPhno = phno
End Property

Public Property Let SetPhno(ByVal vNewValue As String)
    phno = vNewValue
End Property


in the view code

or is it more to it?

sjur (I will then go to step to in the above text:)
0
wahoooAuthor Commented:
think i did it right..but i get error when i am testing:

runtime error 424  object required
debug goes to this line:

UserControl11.SetPhno = "363634"

testing code:
Private Sub Form_Load()
    UserControl11.SetPhno = "363634"
End Sub

Private Sub UserControl11_CallShell(PhNo As String)
   MsgBox PhNo
End Sub

The name of the files i saved is shellexecutioncontrol).exe and so on..

I got the ')' with me on the paste..does this **** up the code?

Sjur
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

wahoooAuthor Commented:
Ok, think I got everything to work, but nothing happens when I test..nothing, I see the command button, but when onclick, nothing triggers..

Sjur
0
anvCommented:
hi wahooo

Please Check if the Name u have given to ur UserControl is UserControl1 ..(which is actually the Default name )..u can change it to anythig else u want. to..give..

 
0
anvCommented:
hi wahooo

the Name of the Project is the Logical Name not the Physical name that u'll be getting in the Components List...

can i see ur code please??
0
wahoooAuthor Commented:
I think the thing is..i have not added any shell command..
nowhere in the code so far is the c:... command prompt line..

where should i put:

Private Sub UserControl11_CallShell(PhNo As String)
   shell "c:\program files\x-pro\x-pro.exe " & phno
End Sub

to try if it works..
0
wahoooAuthor Commented:
Here is the code:

Dim phno As String

Public Event CallShell(phno As String)

Private Sub Command1_Click()
    RaiseEvent CallShell(phno)
End Sub

Public Property Get SetPhno() As String
     SetPhno = phno
End Property

Public Property Let SetPhno(ByVal vNewValue As String)
    phno = vNewValue
End Property
0
anvCommented:
alright ..this is what u ve added into the ActiveX Control u 've Created..rt?

what abt the Code where u r testing the control...

the code in the Standard Exe where u r testing it...

can u paste that too..
0
wahoooAuthor Commented:
Yes, the name is:  UserControl1

sjur
0
wahoooAuthor Commented:
Standard Exe code:

Private Sub Form_Load()
    UserControl11.SetPhno = "363634"
End Sub

Private Sub UserControl11_CallShell(PhNo As String)
   MsgBox PhNo
End Sub


0
anvCommented:
hi Sjur

did u get any message box when u run the test project??

can i get the code where u r testing ur control?
0
anvCommented:
hi Sjur

here in ur code..u r using UserControl11 instead of UserControl1..

did u give theh name to ur User Control here in the Test Project as

UserControl11 or what??
0
wahoooAuthor Commented:
It opens a browser: source code:
<HTML><BODY><OBJECT classid="clsid:E61CFE4F-2B33-4AD2-9FDF-A6FAF10AC807">
</OBJECT></BODY></HTML>


Shows a button with command1, but no message..
could it have something to do with my security settings in iexplorer..
I will try to change them now to low and try again..

0
wahoooAuthor Commented:
I just copyed the code in your first post..

Private Sub Form_Load()
    UserControl11.SetPhno = "363634"
End Sub

Private Sub UserControl11_CallShell(PhNo As String)
   MsgBox PhNo
End Sub

0
anvCommented:
hi Sjur

instead of teh message ..add the shell command in the UserControl1_CallShell(phno As string) event..

Also ..whenever u make any  changes to ur control...u need to recompile it..or u need to repeat this step:

from file menu of the control project...

choose Make <anyName>.ocx
0
wahoooAuthor Commented:
Ok, I got it to work..thanks very much..

How do I call the activex function from my .asp page and pass the variable to it?

Must the activex-control be on the webserver or the client machine

sjur
0
anvCommented:
hi sjur

>>How do I call the activex function from my .asp page and pass the variable to it?

Like u do with other 3rd party components

>>Must the activex-control be on the webserver or the client machine

Client Machine , i Would Say or u u can register it on the web server..ur choice..
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wahoooAuthor Commented:
ok, i will give you points here anyway..but do you know the code for doing this in asp-page..or do I need to start another question:)

sjur
0
anvCommented:
Accept my answer...

check the author's comment before making any decision...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.