Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #898 > unrolled thread
| Started by | "Gary Miller" <gary_@_lucero_.com (remove all underscores)> |
|---|---|
| First post | 2011-04-20 10:53 -0700 |
| Last post | 2011-04-21 13:54 -0700 |
| Articles | 16 — 5 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Creating a COM object "Gary Miller" <gary_@_lucero_.com (remove all underscores)> - 2011-04-20 10:53 -0700
Re: Creating a COM object "Ginny Caughey" <ginny.online@hotmail.com> - 2011-04-20 14:24 -0400
Re: Creating a COM object Nick Friend <nicktekhne@googlemail.com> - 2011-04-20 12:50 -0700
Re: Creating a COM object "Gary Miller" <gary_@_lucero_.com (remove all underscores)> - 2011-04-20 13:45 -0700
Re: Creating a COM object "Ginny Caughey" <ginny.online@hotmail.com> - 2011-04-20 16:53 -0400
Re: Creating a COM object "Gary Miller" <gary_@_lucero_.com (remove all underscores)> - 2011-04-20 14:11 -0700
Re: Creating a COM object "Ginny Caughey" <ginny.online@hotmail.com> - 2011-04-20 19:23 -0400
Re: Creating a COM object "Geoff Schaller" <geoffx@softwarexobjectives.com.au> - 2011-04-20 21:38 +0000
Re: Creating a COM object Nick Friend <nicktekhne@googlemail.com> - 2011-04-21 02:08 -0700
Re: Creating a COM object "Gary Miller" <gary_@_lucero_.com (remove all underscores)> - 2011-04-21 07:35 -0700
Re: Creating a COM object "Ginny Caughey" <ginny.online@hotmail.com> - 2011-04-21 11:51 -0400
Re: Creating a COM object "Gary Miller" <gary_@_lucero_.com (remove all underscores)> - 2011-04-21 09:41 -0700
Re: Creating a COM object "Ginny Caughey" <ginny.online@hotmail.com> - 2011-04-21 16:09 -0400
Re: Creating a COM object "Gary Miller" <gary_@_lucero_.com (remove all underscores)> - 2011-04-21 13:50 -0700
Re: Creating a COM object "Willie Moore" <williem@wmconsulting.com> - 2011-04-21 13:32 -0500
Re: Creating a COM object "Gary Miller" <gary_@_lucero_.com (remove all underscores)> - 2011-04-21 13:54 -0700
| From | "Gary Miller" <gary_@_lucero_.com (remove all underscores)> |
|---|---|
| Date | 2011-04-20 10:53 -0700 |
| Subject | Creating a COM object |
| Message-ID | <ion6gb$2m8h$1@adenine.netfront.net> |
Thanks to Ginny and Geoff I've successfully created a .NET DLL to use in VO to extend functionality. So now I'm looking to go the other way. I want to create a VO DLL to use in .NET. The problem is I'm really ignorant on this as I have no idea how to go about it. Is anyone willing to share a small sample? Thanks, Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [next] | [standalone]
| From | "Ginny Caughey" <ginny.online@hotmail.com> |
|---|---|
| Date | 2011-04-20 14:24 -0400 |
| Message-ID | <4daf2413$0$27597$c3e8da3$a8a65a91@news.astraweb.com> |
| In reply to | #898 |
Congrats! I think Geoff and Meinhard have both worked on going from a .NET app to a VO DLL, but I haven't needed to do that myself except for some early experimental work I did for a conference demo. Ginny "Gary Miller" wrote in message news:ion6gb$2m8h$1@adenine.netfront.net... Thanks to Ginny and Geoff I've successfully created a .NET DLL to use in VO to extend functionality. So now I'm looking to go the other way. I want to create a VO DLL to use in .NET. The problem is I'm really ignorant on this as I have no idea how to go about it. Is anyone willing to share a small sample? Thanks, Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | Nick Friend <nicktekhne@googlemail.com> |
|---|---|
| Date | 2011-04-20 12:50 -0700 |
| Message-ID | <a88a09d8-3209-41a6-b7ba-bc2ccecad315@v33g2000prn.googlegroups.com> |
| In reply to | #898 |
Gary, I'm currently working on a project where we move data in both directions... I have a C# WPF app that is called from VO via COM, and then calls back into the VO application to call functions in VO and return data. Let me know more precisely what you need and I can give you some indications (though most of what I'm doing is second hand from Ginny and Meinhard). Nick On Apr 20, 6:53 pm, "Gary Miller" <gary_@_lucero_.com (remove all underscores)> wrote: > Thanks to Ginny and Geoff I've successfully created a .NET DLL to use in VO > to extend functionality. So now I'm looking to go the other way. I want to > create a VO DLL to use in .NET. The problem is I'm really ignorant on this > as I have no idea how to go about it. > > Is anyone willing to share a small sample? > > Thanks, > > Gary > > --- news://freenews.netfront.net/ - complaints: n...@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Gary Miller" <gary_@_lucero_.com (remove all underscores)> |
|---|---|
| Date | 2011-04-20 13:45 -0700 |
| Message-ID | <iongko$30js$1@adenine.netfront.net> |
| In reply to | #902 |
Nick I want to expose the DBSERVER class in a COM object to use in C#. Thanks, Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Ginny Caughey" <ginny.online@hotmail.com> |
|---|---|
| Date | 2011-04-20 16:53 -0400 |
| Message-ID | <4daf471d$0$28810$c3e8da3$c8b7d2e6@news.astraweb.com> |
| In reply to | #903 |
I have actually done that one except I used PInvoke instead of COM. I'll see if I can find the code if you're interested. Ginny "Gary Miller" wrote in message news:iongko$30js$1@adenine.netfront.net... Nick I want to expose the DBSERVER class in a COM object to use in C#. Thanks, Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Gary Miller" <gary_@_lucero_.com (remove all underscores)> |
|---|---|
| Date | 2011-04-20 14:11 -0700 |
| Message-ID | <ioni56$cd$1@adenine.netfront.net> |
| In reply to | #904 |
Ginny Yes, interested. Thanks. Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Ginny Caughey" <ginny.online@hotmail.com> |
|---|---|
| Date | 2011-04-20 19:23 -0400 |
| Message-ID | <4daf6a45$0$2892$c3e8da3$38634283@news.astraweb.com> |
| In reply to | #905 |
Ok I'll look on my server when I get to the office tomorrow. (It's not on my laptop atm.) "Gary Miller" wrote in message news:ioni56$cd$1@adenine.netfront.net... Ginny Yes, interested. Thanks. Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Geoff Schaller" <geoffx@softwarexobjectives.com.au> |
|---|---|
| Date | 2011-04-20 21:38 +0000 |
| Message-ID | <4daf5267$0$55568$c30e37c6@exi-reader.telstra.net> |
| In reply to | #903 |
It sounds like you should really move to SQL <g>. (it is going to be about the same effort) We don't do this because there is nothing in Vo that we need. Once you've moved to SQL and C# it is always a case that new functionality is written in C# and accessed from VO. Geoff "Gary Miller" <gary_@_lucero_.com (remove all underscores)> wrote in message news:iongko$30js$1@adenine.netfront.net: > Nick > I want to expose the DBSERVER class in a COM object to use in C#. > > Thanks, > Gary > > > > --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | Nick Friend <nicktekhne@googlemail.com> |
|---|---|
| Date | 2011-04-21 02:08 -0700 |
| Message-ID | <89fc6af8-0ae3-4085-9dee-a993af2ebdf4@gu8g2000vbb.googlegroups.com> |
| In reply to | #903 |
Gary, Sounds like a perfect use for Vulcan.... Nick On Apr 20, 9:45 pm, "Gary Miller" <gary_@_lucero_.com (remove all underscores)> wrote: > Nick > I want to expose the DBSERVER class in a COM object to use in C#. > > Thanks, > Gary > > --- news://freenews.netfront.net/ - complaints: n...@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Gary Miller" <gary_@_lucero_.com (remove all underscores)> |
|---|---|
| Date | 2011-04-21 07:35 -0700 |
| Message-ID | <iopfaf$1hq0$1@adenine.netfront.net> |
| In reply to | #910 |
I don't have Vulcan. Thanks for the suggestion though. Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Ginny Caughey" <ginny.online@hotmail.com> |
|---|---|
| Date | 2011-04-21 11:51 -0400 |
| Message-ID | <4db051e7$0$28728$c3e8da3$c8b7d2e6@news.astraweb.com> |
| In reply to | #913 |
Email me at gcaughey at hotmail and I'll email you the conference demos I did. These include COM and Vulcan samples. You may need VS 2008 to open the projects. I can't remember which version of VO the aef was built against but the date is 2009. Ginny "Gary Miller" wrote in message news:iopfaf$1hq0$1@adenine.netfront.net... I don't have Vulcan. Thanks for the suggestion though. Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Gary Miller" <gary_@_lucero_.com (remove all underscores)> |
|---|---|
| Date | 2011-04-21 09:41 -0700 |
| Message-ID | <iopmlo$1o2f$1@adenine.netfront.net> |
| In reply to | #914 |
Email sent. Thanks, Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Ginny Caughey" <ginny.online@hotmail.com> |
|---|---|
| Date | 2011-04-21 16:09 -0400 |
| Message-ID | <4db08e57$0$27616$c3e8da3$a8a65a91@news.astraweb.com> |
| In reply to | #916 |
Here's the VO wrapper code I use for PInvoke on the C# side. (Build the dll.
All the data types are .NET friendly.) If this looks better than the COM
approach, I'll try to find the PInvoke wrappers.
FUNCTION test
LOCAL s AS STRING
// force linker to include VO runtime functions used in index
expressions
s := StrZero(6, 3)
s := DToS(Today())
FUNCTION Unicode2Str(p AS PTR) AS STRING
LOCAL nLen AS LONGINT
LOCAL pBuffer AS PTR
LOCAL cString AS STRING
IF (nLen:=WideCharToMultiByte(CP_ACP,0,p,-1,NULL_PTR,0,NULL,NULL))<1
RETURN NULL_STRING
ENDIF
pBuffer :=MemAlloc(nLen+1)
nLen :=WideCharToMultiByte(CP_ACP,0,p,-1,pBuffer,nLen,NULL,NULL)
cString :=Mem2String(pBuffer,nLen-1)
MemFree(pBuffer)
RETURN cString
FUNCTION ConstructUniqueAlias( cFilename AS STRING ) AS SYMBOL PASCAL
// Modified from 1.0c SDK in dbfsrvr.prg
LOCAL cTryNewAlias AS STRING
LOCAL w AS DWORD
IF IsNil(cFileName)
cFileName := "NOFILENAME"
ELSEIF ( w := At( ".", cFileName ) )>0
cFileName := SubStr( cFileName, 1, w-1 )
ENDIF
w := 1
cTryNewAlias := Upper(cFileName)
DO WHILE VODBSymSelect( String2Symbol( cTryNewAlias ) )>0
cTryNewAlias := Upper(cFileName)+"_"+AllTrim( Str( w++ ) )
ENDDO
RETURN String2Symbol(cTryNewAlias )
FUNCTION OpenDbfQuiet(cFilename, cAliasname, lExclusive)
LOCAL nTries := 0 AS INT
IF IsNil(lExclusive)
lExclusive := FALSE
ENDIF
IF IsNil(cAliasname)
cAliasname := cFilename
ENDIF
IF SELECT(cAliasname) != 0 // Alias already in use
cAliasname := Symbol2String(ConstructUniqueAlias(cFilename))
ENDIF
WHILE nTries < 10
++nTries
DBUSEAREA(TRUE, "DBFCDX" , cFilename, cAliasname, !lExclusive,
FALSE)
IF !NetErr()
RETURN TRUE
ENDIF
Sleep(500)
END
RETURN FALSE
FUNCTION DbfUseArea(filename AS STRING, alias AS STRING, shared AS LOGIC,
readonly AS LOGIC) AS LOGIC PASCAL
SetEpoch(1980)
SetCentury(TRUE)
SetAnsi(FALSE)
SetCollation(#CLIPPER)
RDDSETDEFAULT("DBFCDX")
RDDINFO(_SET_AUTOOPEN, TRUE)
SetDeleted(TRUE)
RETURN DBUSEAREA(TRUE,, filename, alias, Shared, ReadOnly)
FUNCTION DbfRlock() AS LOGIC PASCAL
RETURN RLOCK(RECNO())
FUNCTION DbfUnlock() AS LOGIC PASCAL
RETURN DBUNLOCK()
FUNCTION DbfFieldPut(fieldName AS STRING, data AS USUAL) AS VOID PASCAL
FIELDPUT(FieldPos(fieldName), data)
FUNCTION DbfFieldPutReal8(fieldName AS STRING, data AS REAL8) AS VOID PASCAL
FIELDPUT(FieldPos(fieldName), data)
FUNCTION DbfFieldGetString(fieldName AS STRING) AS STRING PASCAL
LOCAL xVal AS USUAL
IF FieldPos(fieldName) == 0
RETURN ""
ENDIF
xVal := FIELDGET(FieldPos(fieldName))
IF IsString(xVal)
RETURN xVal
ENDIF
RETURN ""
FUNCTION DbfFieldPutString(fieldName AS STRING, data AS PSZ) AS VOID PASCAL
FIELDPUT(FieldPos(fieldName), Psz2String(data))
FUNCTION DbfFieldPutInt(fieldName AS STRING, data AS INT) AS VOID PASCAL
FIELDPUT(FieldPos(fieldName), data)
FUNCTION DbfFieldPutDate(fieldName AS STRING, data AS STRING) AS VOID PASCAL
FIELDPUT(FieldPos(fieldName), SToD(data))
FUNCTION DbfFieldPutLogic(fieldName AS STRING, data AS LOGIC) AS VOID PASCAL
FIELDPUT(FieldPos(fieldName), data)
FUNCTION DbfFieldGetFloat(fieldName AS STRING) AS STRING PASCAL
LOCAL xVal AS USUAL
xVal := FIELDGET(FieldPos(fieldName))
IF IsNumeric(xval)
RETURN AsString(xVal)
ENDIF
RETURN "0"
FUNCTION DbfFieldGetInt(fieldName AS STRING) AS INT PASCAL
LOCAL xVal AS USUAL
LOCAL i AS INT
xVal := FIELDGET(FieldPos(fieldName))
IF IsNumeric(xval)
i := xVal
RETURN i
ENDIF
RETURN 0
FUNCTION DbfAppend() AS LOGIC PASCAL
LOCAL nTries := 0 AS INT
WHILE nTries < 10
IF VODBAppend(TRUE)
RETURN TRUE
ENDIF
++nTries
Sleep(500)
ENDDO
RETURN FALSE
RETURN NIL
FUNCTION DbfFieldGetLogic(fieldName AS STRING) AS LOGIC PASCAL
LOCAL xVal AS USUAL
LOCAL bool AS LOGIC
xVal := FIELDGET(FieldPos(FieldName))
IF IsLogic(xval)
bool := xVal
RETURN bool
ENDIF
RETURN FALSE
FUNCTION DbfFieldGetDateString(fieldName AS STRING) AS STRING PASCAL
LOCAL xVal AS USUAL
xVal := FIELDGET(FieldPos(fieldName))
IF IsDate(xval)
RETURN DToC(xVal)
ENDIF
RETURN ""
FUNCTION DbfFieldGetType(fieldName AS STRING) AS DWORD PASCAL
LOCAL xVal AS USUAL
IF FieldPos(FieldName) == 0
RETURN 0
ENDIF
xVal := FIELDGET(FieldPos(FieldName))
RETURN UsualType(xVal)
FUNCTION DbfOpen(filename AS STRING, shared AS LOGIC, readonly AS LOGIC) AS
LOGIC PASCAL
LOCAL ret AS LOGIC
SetEpoch(1980)
SetCentury(TRUE)
SetAnsi(FALSE)
SetCollation(#CLIPPER)
RDDSETDEFAULT("DBFCDX")
RDDINFO(_SET_AUTOOPEN, TRUE)
SetDeleted(TRUE)
ret := OpenDbfQuiet(filename)
RETURN ret
FUNCTION DbfClose() AS VOID PASCAL
VODBCloseArea()
FUNCTION DbfFieldGet(fieldName AS STRING) AS USUAL PASCAL
LOCAL xVal AS USUAL
xVal := FIELDGET(FieldPos(FieldName))
IF IsDate(xVal) .AND. Empty(xVal)
RETURN NIL
ENDIF
RETURN xVal
FUNCTION DbfRecno() AS INT PASCAL
LOCAL ret AS INT
ret := Val(AsString(VODBRecno()))
RETURN ret
FUNCTION DbfSeek(sValue AS STRING) AS VOID PASCAL
DBSEEK(Unicode2Str(@sValue), TRUE)
"Gary Miller" wrote in message news:iopmlo$1o2f$1@adenine.netfront.net...
Email sent.
Thanks,
Gary
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Gary Miller" <gary_@_lucero_.com (remove all underscores)> |
|---|---|
| Date | 2011-04-21 13:50 -0700 |
| Message-ID | <ioq57u$24bv$1@adenine.netfront.net> |
| In reply to | #918 |
Ginny Thanks, I'm going to use the COM approach. It seems pretty straight forward. Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Willie Moore" <williem@wmconsulting.com> |
|---|---|
| Date | 2011-04-21 13:32 -0500 |
| Message-ID | <iopt8d$pem$1@speranza.aioe.org> |
| In reply to | #913 |
Gary, I have wrapped the DBServer class using VOCOM+. Before I had Vulcan I used to so my VB friends could read/write DBF files with out messing up the DBFs. I can send you the source if you need it. Regards, Willie "Gary Miller" wrote in message news:iopfaf$1hq0$1@adenine.netfront.net... I don't have Vulcan. Thanks for the suggestion though. Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | "Gary Miller" <gary_@_lucero_.com (remove all underscores)> |
|---|---|
| Date | 2011-04-21 13:54 -0700 |
| Message-ID | <ioq5h3$24l7$1@adenine.netfront.net> |
| In reply to | #917 |
Willie Thanks, I'm going to use Ginny's wrapper for DBFs in .NET. Gary --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web