wahooo
asked on
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
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
ASKER
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:)
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:)
ASKER
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(Ph No 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
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(Ph
MsgBox PhNo
End Sub
The name of the files i saved is shellexecutioncontrol).exe
I got the ')' with me on the paste..does this **** up the code?
Sjur
ASKER
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
Sjur
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..
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..
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??
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??
ASKER
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(Ph No As String)
shell "c:\program files\x-pro\x-pro.exe " & phno
End Sub
to try if it works..
nowhere in the code so far is the c:... command prompt line..
where should i put:
Private Sub UserControl11_CallShell(Ph
shell "c:\program files\x-pro\x-pro.exe " & phno
End Sub
to try if it works..
ASKER
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
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
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..
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..
ASKER
Yes, the name is: UserControl1
sjur
sjur
ASKER
Standard Exe code:
Private Sub Form_Load()
UserControl11.SetPhno = "363634"
End Sub
Private Sub UserControl11_CallShell(Ph No As String)
MsgBox PhNo
End Sub
Private Sub Form_Load()
UserControl11.SetPhno = "363634"
End Sub
Private Sub UserControl11_CallShell(Ph
MsgBox PhNo
End Sub
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?
did u get any message box when u run the test project??
can i get the code where u r testing ur control?
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??
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??
ASKER
It opens a browser: source code:
<HTML><BODY><OBJECT classid="clsid:E61CFE4F-2B 33-4AD2-9F DF-A6FAF10 AC807">
</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..
<HTML><BODY><OBJECT classid="clsid:E61CFE4F-2B
</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..
ASKER
I just copyed the code in your first post..
Private Sub Form_Load()
UserControl11.SetPhno = "363634"
End Sub
Private Sub UserControl11_CallShell(Ph No As String)
MsgBox PhNo
End Sub
Private Sub Form_Load()
UserControl11.SetPhno = "363634"
End Sub
Private Sub UserControl11_CallShell(Ph
MsgBox PhNo
End Sub
hi Sjur
instead of teh message ..add the shell command in the UserControl1_CallShell(phn o 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
instead of teh message ..add the shell command in the UserControl1_CallShell(phn
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
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
sjur
Accept my answer...
check the author's comment before making any decision...
check the author's comment before making any decision...
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(Ph
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(Ph
shell "c:\program files\x-pro\x-pro.exe " & phno
End Sub