Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   ActiveX or COM or ...? (http://www.velocityreviews.com/forums/t792730-activex-or-com-or.html)

Randy Dietz 01-16-2004 11:18 PM

ActiveX or COM or ...?
 
Hi, how can I create a simple non-UI dll or component which will be used by
MS Access and .ASP apps which I can build with Visual C++ .net? An example
or template which would allow me to paste in C code without learning all the
C++ details would be perfect.

Thanks,
Randy



Mark Schupp 01-17-2004 12:10 AM

Re: ActiveX or COM or ...?
 
MSVC++ has wizards to create server-side com objects. I would expect that
C++ .net would as well. There should also be some sample code available as
well.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


"Randy Dietz" <spam9@spam9.com> wrote in message
news:OnoHUcI3DHA.3196@TK2MSFTNGP11.phx.gbl...
> Hi, how can I create a simple non-UI dll or component which will be used

by
> MS Access and .ASP apps which I can build with Visual C++ .net? An

example
> or template which would allow me to paste in C code without learning all

the
> C++ details would be perfect.
>
> Thanks,
> Randy
>
>




01-17-2004 03:06 AM

Re: ActiveX or COM or ...?
 
Why dont you try to use VB5/6/VB.NET for example if C++ like syntax is not
the one that you like?

"Randy Dietz" <spam9@spam9.com> wrote in message
news:OnoHUcI3DHA.3196@TK2MSFTNGP11.phx.gbl...
: Hi, how can I create a simple non-UI dll or component which will be used
by
: MS Access and .ASP apps which I can build with Visual C++ .net? An
example
: or template which would allow me to paste in C code without learning all
the
: C++ details would be perfect.
:
: Thanks,
: Randy
:
:



Steven Cheng[MSFT] 01-17-2004 07:06 AM

RE: ActiveX or COM or ...?
 
Hi Randy,

Thank you for posting here. Regarding on the issue, I am
finding proper resource to assist you and we will update as soon as posible.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security(This posting is provided "AS IS",
with no warranties, and confers no rights.)


Randy Dietz 01-17-2004 08:16 PM

Re: ActiveX or COM or ...?
 
People in other newsgroups suggested posting here. A few people recommend
using a COM Server or ATL Server but I tried that using
file|new|project|visual c++ projects|ATL|ATL project and couldn't get VBA
code to recognize MyFunc99 maybe because my VBA Declare statement is
incorrect.

In VBA I used

Private Declare Sub MyFunc99 Lib "C:\Documents and Settings\default\My
Documents\Msaccess\Test4" (s1 As String)
....
Dim s1 As String
MyFunc99 (s1)

A summary of info and notes from myself and other posters...
1. create a simple non-UI dll or component which will be used by MS Access
and .ASP apps.
2. use COM because .ASP can't use a DLL.
3. the component needs to work on both non-.net and .net systems if
possible.


"Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
news:fD9A%23hM3DHA.2996@cpmsftngxa07.phx.gbl...
> Hi Randy,
>
> Thank you for posting here. Regarding on the issue, I am
> finding proper resource to assist you and we will update as soon as

posible.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security(This posting is provided "AS IS",
> with no warranties, and confers no rights.)
>




Randy Dietz 01-18-2004 03:29 AM

Re: ActiveX or COM or ...?
 
Class view shows that rsdm2() is exported I think...

Test4
...
Irsd2
...
rsdm2(BSTR *s1)

and the build log shows that regsvr32 test4.dll registers the dll so how do
I get MS Access to use the dll? Tools|ActiveX Controls lists many controls
but no rsd* nor test4* symbols.

Build Log ------- Build started: Project: test4, Configuration:
Debug|Win32 -------

Command Lines Creating temporary file "c:\Documents and
Settings\default\My Documents\Visual Studio
Projects\test4\Debug\RSP000013.rsp" with contents
[
/Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_USRDLL" /D "_ATL_ATTRIBUTES"
/D "_WINDLL" /D "_ATL_STATIC_REGISTRY" /D "_MBCS" /Gm /EHsc /RTC1 /MDd
/Yu"stdafx.h" /Fp"Debug/test4.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c
/Wp64 /ZI /TP
".\toupper.cpp"
".\test4.cpp"
".\rsd2.cpp"
".\rsd1.cpp"
]
Creating command line "cl.exe @"c:\Documents and Settings\default\My
Documents\Visual Studio Projects\test4\Debug\RSP000013.rsp" /nologo"
Creating temporary file "c:\Documents and Settings\default\My
Documents\Visual Studio Projects\test4\Debug\RSP000014.rsp" with contents
[
/Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_USRDLL" /D "_ATL_ATTRIBUTES"
/D "_WINDLL" /D "_ATL_STATIC_REGISTRY" /D "_MBCS" /Gm /EHsc /RTC1 /MDd
/Yc"stdafx.h" /Fp"Debug/test4.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c
/Wp64 /ZI /TP
".\stdafx.cpp"
]
Creating command line "cl.exe @"c:\Documents and Settings\default\My
Documents\Visual Studio Projects\test4\Debug\RSP000014.rsp" /nologo"
Creating command line "rc.exe /d "_DEBUG" /l 0x409 /I "Debug"
/fo"Debug/test4.res" ".\test4.rc""
Creating temporary file "c:\Documents and Settings\default\My
Documents\Visual Studio Projects\test4\Debug\RSP000015.rsp" with contents
[
/OUT:"Debug/test4.dll" /INCREMENTAL /NOLOGO /DLL /IDLOUT:"_test4.idl" /DEBUG
/PDB:"Debug/test4.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"Debug/test4.lib"
/MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib
".\Debug\rsd1.obj"
".\Debug\rsd2.obj"
".\Debug\stdafx.obj"
".\Debug\test4.obj"
".\Debug\toupper.obj"
".\Debug\test4.res"
]
Creating command line "link.exe @"c:\Documents and Settings\default\My
Documents\Visual Studio Projects\test4\Debug\RSP000015.rsp""
Creating temporary file "c:\Documents and Settings\default\My
Documents\Visual Studio Projects\test4\Debug\BAT000016.bat" with contents
[
@echo off
cd .\Debug
regsvr32 /s "test4.dll"
]
Creating command line ""c:\Documents and Settings\default\My
Documents\Visual Studio Projects\test4\Debug\BAT000016.bat""
Creating temporary file "c:\Documents and Settings\default\My
Documents\Visual Studio Projects\test4\Debug\BAT000017.bat" with contents
[
@echo off
regsvr32 /s /c "c:\Documents and Settings\default\My Documents\Visual Studio
Projects\test4\Debug\test4.dll"
if errorlevel 1 goto VCReportError
goto VCEnd
:VCReportError
echo Project : error PRJ0019: A tool returned an error code from "Performing
registration"
exit 1
:VCEnd
]
Creating command line ""c:\Documents and Settings\default\My
Documents\Visual Studio Projects\test4\Debug\BAT000017.bat""
Output Window Compiling...
stdafx.cpp
Compiling...
toupper.cpp
test4.cpp
rsd2.cpp
rsd1.cpp
Generating Code...
Compiling resources...
Linking...
Creating library Debug/test4.lib and object Debug/test4.exp
Microsoft (R) 32b/64b MIDL Compiler Version 6.00.0361
Copyright (c) Microsoft Corporation 1991-2002. All rights reserved.
Processing .\_test4.idl
_test4.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\prsht.idl
prsht.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\wtypes.idl
wtypes.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\basetsd.h
basetsd.h
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\guiddef.h
guiddef.h
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\mshtml.idl
mshtml.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\ocidl.idl
ocidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\oleidl.idl
oleidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\objidl.idl
objidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\unknwn.idl
unknwn.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\oaidl.idl
oaidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\servprov.idl
servprov.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\urlmon.idl
urlmon.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\msxml.idl
msxml.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\dimm.idl
dimm.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\mshtmhst.idl
mshtmhst.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\docobj.idl
docobj.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\exdisp.idl
exdisp.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\objsafe.idl
objsafe.idl
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\oaidl.acf
oaidl.acf
Processing C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\ocidl.acf
ocidl.acf
Registering output...
Performing registration
Results Build log was saved at "file://c:\Documents and
Settings\default\My Documents\Visual Studio
Projects\test4\Debug\BuildLog.htm"
test4 - 0 error(s), 0 warning(s)

"Randy Dietz" <spam9@spam9.com> wrote in message
news:%23Ck7dbT3DHA.2136@TK2MSFTNGP12.phx.gbl...
> People in other newsgroups suggested posting here. A few people recommend
> using a COM Server or ATL Server but I tried that using
> file|new|project|visual c++ projects|ATL|ATL project and couldn't get VBA
> code to recognize MyFunc99 maybe because my VBA Declare statement is
> incorrect.
>
> In VBA I used
>
> Private Declare Sub MyFunc99 Lib "C:\Documents and Settings\default\My
> Documents\Msaccess\Test4" (s1 As String)
> ...
> Dim s1 As String
> MyFunc99 (s1)
>
> A summary of info and notes from myself and other posters...
> 1. create a simple non-UI dll or component which will be used by MS Access
> and .ASP apps.
> 2. use COM because .ASP can't use a DLL.
> 3. the component needs to work on both non-.net and .net systems if
> possible.
>
>
> "Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
> news:fD9A%23hM3DHA.2996@cpmsftngxa07.phx.gbl...
> > Hi Randy,
> >
> > Thank you for posting here. Regarding on the issue, I am
> > finding proper resource to assist you and we will update as soon as

> posible.
> >
> > Regards,
> >
> > Steven Cheng
> > Microsoft Online Support
> >
> > Get Secure! www.microsoft.com/security(This posting is provided "AS IS",
> > with no warranties, and confers no rights.)
> >

>
>




MSFT 01-19-2004 08:02 AM

Re: ActiveX or COM or ...?
 
Hi Randy,

hank you for using MSDN Newsgroup. I am Luke and I am review this issue
currently. As I understand, you want to create a component with VC++.NET
which can be used both in .NET application and Access application. Based on
the requirement, I think Class Library (.NET) should be a proper solution.
(File/New?Project/VC++ Project/Class Library (.NET) ). You can add your
functions in the source file and compile it to a DLL files.

To use the DLL file in another dot application, you can select "Project/Add
a reference", select the DLL file and add the reference file.

To use it in Access application, you first need register it as a COM
librrary with a utility "Regasm.exe":

http://msdn.microsoft.com/library/de...us/cptools/htm
l/cpgrfassemblyregistrationtoolregasmexe.asp

In Access, you can click menu "Tool/Reference" and find the type library in
the list.

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Mark Schupp 01-19-2004 05:37 PM

Re: ActiveX or COM or ...?
 
You do not use declare statements with com object.

After the com object is compiled and registered you use CreateObject just as
you would for a built-in asp object.

set myobj= createobject("mydll.myobject")

Dim s1

s1 = ""

myobj.myfunc( s1 )

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


"Randy Dietz" <spam9@spam9.com> wrote in message
news:%23Ck7dbT3DHA.2136@TK2MSFTNGP12.phx.gbl...
> People in other newsgroups suggested posting here. A few people recommend
> using a COM Server or ATL Server but I tried that using
> file|new|project|visual c++ projects|ATL|ATL project and couldn't get VBA
> code to recognize MyFunc99 maybe because my VBA Declare statement is
> incorrect.
>
> In VBA I used
>
> Private Declare Sub MyFunc99 Lib "C:\Documents and Settings\default\My
> Documents\Msaccess\Test4" (s1 As String)
> ...
> Dim s1 As String
> MyFunc99 (s1)
>
> A summary of info and notes from myself and other posters...
> 1. create a simple non-UI dll or component which will be used by MS Access
> and .ASP apps.
> 2. use COM because .ASP can't use a DLL.
> 3. the component needs to work on both non-.net and .net systems if
> possible.
>
>
> "Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
> news:fD9A%23hM3DHA.2996@cpmsftngxa07.phx.gbl...
> > Hi Randy,
> >
> > Thank you for posting here. Regarding on the issue, I am
> > finding proper resource to assist you and we will update as soon as

> posible.
> >
> > Regards,
> >
> > Steven Cheng
> > Microsoft Online Support
> >
> > Get Secure! www.microsoft.com/security(This posting is provided "AS IS",
> > with no warranties, and confers no rights.)
> >

>
>




Randy Dietz 01-19-2004 08:59 PM

Re: ActiveX or COM or ...?
 
Luke, several others suggested that a COM object will work with both
MSAccess and .ASP. I used oleview.exe 'object classes->all objects' and
there are no rsd* objects so it appears that regsvr32 fails when the vc++
build calls it even though there are no err messages. I copied and built

LABRADOR Sample: Implements a Server with an Out-of-Proc Custom Interface
and Compiler COM Support

then tried oleview and LABRADOR is listed under 'object classes->all objects
' so I must be missing something in my project.


I started over and did...

create test9 with file|new|project|visual c++ projects|ATL|ATL project
right-click test9 in solution explorer
add the rsdm1 class using add|add class|visual c++|ATL|ATL Simple Object
rebuild all and the build log has

regsvr32 /s /c "c:\documents and settings\default\my documents\visual studio
projects\test9\debug\test9.dll"

run oleview.exe 'object classes->all objects' and there are no rsd* objects
listed.

Do I need to do something more to make rsdm1 a COM object or am I missing
something else?


"MSFT" <lukezhan@online.microsoft.com> wrote in message
news:z2cmtKm3DHA.2996@cpmsftngxa07.phx.gbl...
> Hi Randy,
>
> hank you for using MSDN Newsgroup. I am Luke and I am review this issue
> currently. As I understand, you want to create a component with VC++.NET
> which can be used both in .NET application and Access application. Based

on
> the requirement, I think Class Library (.NET) should be a proper solution.
> (File/New?Project/VC++ Project/Class Library (.NET) ). You can add your
> functions in the source file and compile it to a DLL files.
>
> To use the DLL file in another dot application, you can select

"Project/Add
> a reference", select the DLL file and add the reference file.
>
> To use it in Access application, you first need register it as a COM
> librrary with a utility "Regasm.exe":
>
>

http://msdn.microsoft.com/library/de...us/cptools/htm
> l/cpgrfassemblyregistrationtoolregasmexe.asp
>
> In Access, you can click menu "Tool/Reference" and find the type library

in
> the list.
>
> Hope this help,
>
> Luke
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>




Randy Dietz 01-20-2004 12:32 AM

Re: ActiveX or COM or ...?
 
When I run

regsvr32 /c "c:\documents and settings\default\my documents\visual studio
projects\test9\debug\test9.dll"

I get a messagebox that says

DllRegister in c:\documents and settings\default\my documents\visual studio
projects\test9\debug\test9.dll succeeded.

but oleview doesn't list any rsd* objects.


"MSFT" <lukezhan@online.microsoft.com> wrote in message
news:z2cmtKm3DHA.2996@cpmsftngxa07.phx.gbl...
> Hi Randy,
>
> hank you for using MSDN Newsgroup. I am Luke and I am review this issue
> currently. As I understand, you want to create a component with VC++.NET
> which can be used both in .NET application and Access application. Based

on
> the requirement, I think Class Library (.NET) should be a proper solution.
> (File/New?Project/VC++ Project/Class Library (.NET) ). You can add your
> functions in the source file and compile it to a DLL files.
>
> To use the DLL file in another dot application, you can select

"Project/Add
> a reference", select the DLL file and add the reference file.
>
> To use it in Access application, you first need register it as a COM
> librrary with a utility "Regasm.exe":
>
>

http://msdn.microsoft.com/library/de...us/cptools/htm
> l/cpgrfassemblyregistrationtoolregasmexe.asp
>
> In Access, you can click menu "Tool/Reference" and find the type library

in
> the list.
>
> Hope this help,
>
> Luke
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>





All times are GMT. The time now is 07:29 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.