com >> Late bound ActiveX control creation on Windows Server 2003

by cGJsYWNrYnVybg » Fri, 07 Apr 2006 16:51:01 GMT

I have a strange? problem that I am getting using VB6 sp6 and Windows Server
2003.
I am unable to create a late bound instance of a user control in once
instance of VB6
if the user control is running in another instance of VB6.
Eg I have my control running in the IDE in one VB session.
In another VB session I try to create a late bound instance of the control
via CreateObject() using the classId of the user control.
I get error 429, ActiveX component can't create object.
I do not get this under NT.

I can replicate as follows.

Start VB6
Create a new ActiveX control eg TESTUC
Name the new usercontrol UC1.
Compile and set binary compatibility to itself.


Start another instance of VB6
Create a new standard exe project.
Add the code to form1

Private Sub Form_Load()
Dim o As Object
Set o = CreateObject("TESTUC.UC1")
End Sub

Run the project without TESTUC running in the IDE.
Works as expected.
Run the project with TESTUC running in the IDE.
Error.
Again this works as expected on NT.

Any help greatly appreciated.



com >> Late bound ActiveX control creation on Windows Server 2003

by Ken Halter » Fri, 07 Apr 2006 22:12:17 GMT






It's not really a good idea to point binary compatibility to the same file
you're building.


It's really 'hit and miss'... see the article below (which is a much smaller
version than the original)


This may be the culprit..

VB Hijacks the Registry
http://www.devx.com/tips/Tip/12488

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm





com >> Late bound ActiveX control creation on Windows Server 2003

by cGJsYWNrYnVybg » Fri, 07 Apr 2006 23:37:02 GMT





It was just for this quick and dirty example.

It works consistently on NT and will NOT work on 2003.
It works fine for ActiveX DLLs which do exactly the same registry
InProcServer redirection....arrggghhh

Thanks for the input.




Late bound ActiveX control creation on Windows Server 2003

by Ken Halter » Sat, 08 Apr 2006 01:16:43 GMT






I don't have access to a Windows 2003 machine but... it sure seems like...
the newer the OS, the more registry/timing related problems we see around
here. It's getting to the point (actually, already past) where it's truly
scary to get a Windows Update.

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm





Late bound ActiveX control creation on Windows Server 2003

by cGJsYWNrYnVybg » Wed, 12 Apr 2006 16:58:02 GMT

Tried the same test on Windows XP professional SP2 with the same results so
it is not limited to 2003.









RE: Late bound ActiveX control creation on Windows Server 2003

by cGJsYWNrYnVybg » Wed, 12 Apr 2006 23:49:02 GMT

I have investigated further.
I have a small C++ test application which creates an instance of my visual
basic user control.
The control is created as follows

CLSID clsID;
HRESULT hr;

hr = CoInitialize( NULL );

hr = CLSIDFromProgID(OLESTR("TEST.UC1"), &clsID);

LPDISPATCH pObj = NULL;
hr = CoCreateInstance(clsID, NULL, CLSCTX_ALL , __uuidof(_UC1),
(void**)&pObj);

if( SUCCEEDED(hr) )
{
pObj->Release();
pObj = NULL;
}
else
{
AfxMessageBox( "ERROR" );
}

CoUninitialize();

If run this on Xp or 2003 it will only work if the VB OCX is NOT running in
the visual basic IDE.
Once I run the component in the VB IDE i get an error.
However if I change CLSCTX_ALL to CLSCTX_LOCAL_SERVER it steps into the VB6
IDE (unfortunatly it will no longer work with the compiled component)
Running the C++ test application on NT works fine using CLSCTX_ALL
regardless if it is being debugged in the IDE.

Could someone from Microsoft pick this up and explain if there is a fix?

Regds








Similar Threads

1. Late-bound ActiveX Control - Error 438 when calling method

I have been round and round and look at tons of posts on the net and
can not find a real answer.

Basic Info:
I have an application in which I need to create an instance of an
activex control at runtime, put it on a form, and call its methods and
properties.

Problem:
When I put the control on the form at design time, everything works. 
The problem comes in when I do a control.add.

--- Code Snipet ---
Set tAddin = Me.Controls.Add("MyOCX.ControlName", "ctrlReport", Me)
tAddin.Left = 0
tAddin.Top = 0
tAddin.Visible = True

tAddin.doPrint False
--- End Snipet ---

The control is created successfully and displays correctly.  On the
line
tAddin.doPrint False
which is a method in the control, i get Error # 438 Object does not
support this property or method.

I have tried creating an ocx with a single sub called TestThis with no
parameteres and I still get this error.

PLEASE PLEASE PLEASE HELP

I am very stuck and realy need to get this working.

Thanks in advance for any help you can give.

Adam

2. Bulk Creation of Printers on Windows 2003 Server using VB Scri - Scripting for Windows Server

3. Bulk Creation of Printers on Windows 2003 Server using VB Script

Well I had the same challenge that some others had here. Basically I had over 
2000 Novell NDPS Print Agents I needed to bring into Windows 2003. I used the 
over the counter script from the Microsoft Scripting Center, but it would die 
at the objPrinter.Put_ statement. That is because you need to create the 
TCP/IP Printer port first.

Well here's what I came up with that works with a twist; it reads all the 
info from an Excel spreadsheet. Key point is the DriverName needs to be what 
Microsoft lists when you run through the wizard (I.e. "HP LaserJet Series 
4000 PS")

Excel needs to have a Sheet called "Add" with each column named in order as 
follows (It has to be this way to work with the offset) :
PortName PortAddress DriverName PortName DeviceID Network Shared ShareName

Here is the VB Script:

Option Explicit
On error resume next
Dim oXL
Dim TextXL
Dim CRLF
Dim oArgs
Dim oObject
Dim objPrinter
Dim objWMIService
Dim strComputer
Dim objExcel
Dim objNewPort

'Get the command line args

    set oArgs=wscript.arguments

    CRLF = Chr(13) & Chr(10)


'If no command line arguments provided, prompt for file containing users to 
add/delete

    If oArgs.Count = 0 Then

       TextXL = InputBox("This scripts reads an Excel spreadsheet and adds 
printers to the specified Windows Server." & CRLF & CRLF & _
       "Type in the path of a file containing printers to add" & CRLF & CRLF 
& _
       "Sample Add User file: C:\ADDPRTRS.XLS" & CRLF) ' & CRLF & _


'Else file containing users is the first argument

    Else

      TextXL = oArgs.item(0)

    End If

 

    If TextXL = "" Then

       WScript.Echo "No input file provided. Stopping the script now."

       WScript.Quit(1)

    End If

 

'Start EXCEL

    Set oXL = WScript.CreateObject("EXCEL.application")

	
'True Displays Excel False Hides Excel

	'oXL.Visible = True

 

'Open the workbook passed in the command line

    oXL.workbooks.open TextXL

 

'Activate the Add page of Excel Spreadsheet

    oXL.sheets("Add").Activate


'Specifies Local Server to run script against

    strComputer = "."



'Put the cursor in the starting cell 

    oXL.ActiveSheet.range("A2").Activate 



    'Until we run out of rows

    Do While oXL.activecell.Value <> ""
 
'Creates TCPIP Printer Port

Set objWMIService = GetObject("winmgmts:")
Set objNewPort = objWMIService.Get _
    ("Win32_TCPIPPrinterPort").SpawnInstance_


	objNewPort.Name = oXL.activecell.offset(0, 0).Value ' "IP_169.254.110.160"
	objNewPort.Protocol = 1
	objNewPort.HostAddress = oXL.activecell.offset(0, 1).Value ' 
"169.254.110.160"
	objNewPort.PortNumber = "9100"
	objNewPort.SNMPEnabled = False
	objNewPort.Put_        

'Creates Printer with Associated TCPIP Printer Port

Set objWMIService = GetObject("winmgmts:")
Set objPrinter = objWMIService.Get _
	("Win32_Printer").SpawnInstance_

	objPrinter.DriverName = oXL.activecell.offset(0, 2).Value ' "HP LaserJet 
4000 Series PS"	
	objPrinter.PortName = oXL.activecell.offset(0, 3).Value ' 
"IP_169.254.110.160"
        objPrinter.DeviceID = oXL.activecell.offset(0, 4).Value ' 
"ScriptedPrinter"
        objPrinter.Network = oXL.activecell.offset(0, 5).Value ' "TRUE"
        objPrinter.Shared = oXL.activecell.offset(0, 6).Value ' "TRUE"
        objPrinter.ShareName = oXL.activecell.offset(0, 7).Value ' 
"ScriptedPrinter"
        objPrinter.Put_        


    

'Step to the next printer...

        oXL.activecell.offset(1, 0).Activate   'Next row

    Loop


    'Done.  close excel spreadsheet

    oXL.application.quit


' Hope this helps someone else : )

4. Shell command failing inside a late-bound object created inside a late-bound object - Visual Basic/VB

5. VB6 Activex DLL 32bits on 64bits Windows 2003 Server

Hi,

I have few VB6 Activex DLLs 32bits that must run on 64bits Windows 2003 
Server. I am using these DLLs in my ASP pages. The DLLs are registered, but 
when I call server.createobject I get

Microsoft VBScript runtime error '800a01ad'
ActiveX component can't create object

The IWAM_... and IUSR_... users are set up correctly, which solved the 
problem on 32bits OS, but it does not help now. I have researched and found 
that many people have the same problem, but I have not found the solution. 
It is obvious that the issue is 32bits vs 64bits, but what do I have to do 
to solve the problem.

TIA,
regards,
George. 


6. Late binding PowerPoint 2003 and 2007 - VB.Net

7. late binding when vb.net 2005 updates excel 2003

Douglas,

Why do early binding and late binding not mix well?

I've never heard of that.

But beside a piece of code this is probably all we can tell you.

(In Excel something like 00123 is as well a "text". The name in all Net 
languages is "string" for that and the most simply format to create)

Cor


"douglas" < XXXX@XXXXX.COM > wrote in message 
news: XXXX@XXXXX.COM ...
>  I need to put char(5) into 'selected' columns in an excel 2003 worksheet
> using vb.net 2005.
>  The problem is some of the data looks like '00123' and ends in the
> spreadsheet looking like '123'. I am losing the leading zeroes. The only 
> way
> I know to make the selected range of columns is to make the selected 
> columns
> a 'text' format.
>  Basically I need to accomplish this task with late binding. (Early 
> binding
> and late binding do not mix well.) I am using late binding since I am 
> using
> the pageset feature in excel 2003.
>
>  Thus can you tell me how to solve this problem?
>
> 

8. Run time error 430 with late binding Outlook 2003