Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I registered for the Active X Components using the path below:

The path was "c:\winnt\system32\Regsvr32.exe"

Now to register for example "msmapi32.ocx", because I wanted to use the mapi feature, all i did was
in the dos prompt run:

C:\winnt\system32\>regsvr32 msmapi32.ocx

Then a msg box pops up and says "DllRegisterServer in msmapi32.ocx succeeded."

However, then I try running a script:

'******************************
Dim MAPI
Set MAPI = CreateObject("MAPI.MAPISession")
'*************************************

The code craps out on the 'Set MAPI = CreateObject("MAPI.MAPISession")'

What am I doing wrong?


 

Okay, here's the story. I want to use the MAPI feature in VBScript. The only way I can do that is through Active X Components. The only way to use Active X Components is to register them. Now I thought the command "Regsvr32 msmapi32.ocx" was supposed to register and allow me to use the Active X components in VBScript. Obviously, i was wrong.

Component Name File Name Controls
Microsoft MAPI Controls6.0 -- MSMAPI32.OCX -- MAPIMessages, MAPISession

'******************************
Dim MAPI
Set MAPI = CreateObject("MAPI.MAPISession")
'*************************************

The Error I get is: ActiveX Component can't create object: 'MAPI.MAPISession'

Bottom line is that I still am not registered to use Active X Component.

The MAPISession has a method called "SignOn Method"

'***************
Syntax

object.SignOn0
'*****************

Do you know what the 'object' is?

I thought it was 'Set MAPI = CreateObject("MAPI.MAPISession")'

I'm not sure if it's correct. :-(
 
The problem is that the MAPI OCX cannot be created in memory like that. An OCX can only be instantiated either in the client browser or in a VB or some such on a form. The only thing that you can use CreateObject on is a DLL or possibly an ActiveX EXE. It doesn't matter if you have registered the OCX or not, the bottom line is that you cannot do what you are trying to do.

James :) James Culshaw
jculshaw@active-data-solutions.co.uk
 
hum......:), okay.
Is it possible to use VBScript in conjunction with Active X Components? C'mon....say it's possible. I know the way I'm doing it is wrong, but could there be a right way to use Components in Visual Basic Script?
 
Yep, you were along the correct track with CreateObject, but this is for DLLs and ActiveX EXE's which are all components. The only thing that seperates these is either that they require a container and/or they are in-process or out-of-process.

If you use ASP, and use Server.CreateObject("ADODB.Command") then you are instantiating the MSADO15.dll or some similar DLL.

James :) James Culshaw
jculshaw@active-data-solutions.co.uk
 
Cool, I am almost on the $$$$. I've looked so many places, but still wasn't able to find a simple example that shows Active X Components being used in VBScript, so at least I would have some idea of how to go about doing it.
Any ideas where I can find this "example", or maybe a website?

 
Okay, my "master plan" is to get into
Inbox - Microsoft Outlook. And once I'm in, I want to be able to open emails, and read through their texts for a specific character. Once the character is found I will copy that line and smack it into a normal .txt notepad file.
Then of course close the email. Sounds like a challenge? Well...i have everything figured out, the only task that remains is:
1) How to get into Microsoft Outlook and sort through the emails.

Good news is that I have some what learned how to use the MapiMessages and MapiSession controls. Though still lost on how to exactly get into the Outlook. Since I'm connected on a network, going through the Exchange Server may be a path. Any opinions or ideas or comments...basically anything, I'm all ears. :)

bud
 
Hi,
I want to use a VB6 Listbox in HTML/ASP with VBSCRIPT.
Is it possible ? If yes, then
what is the ActiveX OCX/DLL/EXE file I must include
in the HTML and how ?
Actually what I am trying to do is this :--
I am trying to display a message in the status bar
of the browser when the user hovers his mouse over
the List Box in the Page, and the message displayed
in the status bar depends on the item in the listbox
on which the mouse is pointing.
I have found that this is not possible with
List Box mouseover event in HTML, since it supports
mouseover event only for the List Box as a whole and
not for individual items in the List Box.
However, I know that it is possible through VB6 List Box,
I also have the VB6 code for that.
Now I want to know if there is a way to use this VB6 Listbox
in HTML, and run the VB6 Code using VBScript.
I know that OCX/DLL/EXE files can be included in HTML/ASP,
but I am not sure how. Do I have to use ASP ( server.createobject ) ?
Also, will this solution work for browsers other than IE ? ( ex. netscape ).
Thanks in Advance for any Help !
Regards,
Vivek.
 
Hi, with reference to my above query, I am
posting the relevant VB6 code here :--
Here, am trapping the List Box item in a tooltip,
which I found is not possible in HTML.
Hence I want to display the message in the status bar
instead of tooltip in the web page.
--------------------------------------------
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam _
As Any) As Long
Private Const LB_ITEMFROMPOINT = &H1A9


Private Sub Form_Load()

List1.Visible = True
With List1
.AddItem "Visit"
.AddItem "VB Square01"
.AddItem "VB Square02"
.AddItem "VB Square03"
.AddItem "VB Square04"
.AddItem "VB Square05"
.AddItem "VB Square06"
.AddItem "VB Square07"
.AddItem "VB Square08"
.AddItem "VB Square09"
.AddItem "VB Square10"
.AddItem "VB Square11"

End With

End Sub




Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

End Sub

Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lXPoint As Long
Dim lYPoint As Long
Dim lIndex As Long

If Button = 0 Then ' if no button was pressed
lXPoint = CLng(X / Screen.TwipsPerPixelX)
lYPoint = CLng(Y / Screen.TwipsPerPixelY)
With List1
' get selected item from list
lIndex = SendMessage(.hwnd, LB_ITEMFROMPOINT, 0, ByVal _
((lYPoint * 65536) + lXPoint))
' show tip or clear last one
If (lIndex >= 0) And (lIndex <= .ListCount) Then
.ToolTipText = .List(lIndex)

Text1.Text = .List(lIndex)
Else
.ToolTipText = &quot;&quot;
Text1.Text = &quot;&quot;
End If
Call Text1_MouseMove(0, 0, 2775, 225)
End With
End If

End Sub



Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.ToolTipText = Text1.Text
End Sub
-----------------------------------------------------------
Regards,
Vivek.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top