Board index » cppbuilder » VB to C++

VB to C++

Hello,

I'm trying to rewrite a vb application that automates a drawing program.
I can start ,stop and open a drawing by automation.
But how do i translate the following code ?

'============ Check active drawing properties
Set objDoc = Applicatie.ActiveDocument          'Refence to the active
document
Set objprop = objDoc.Properties                 'Properties collection
object

Set ProjectInfoPropSet = objprop("ProjectInformation")
Set DocumentNumberProperty = ProjectInfoPropSet("Document Number")
Set RevisionProperty = ProjectInfoPropSet("Revision")

thanks,

Rob

 

Re:VB to C++


Hello Group,

I've found the solution.
No response is necessary.

Rob

"Rob" <h...@wxs.nl> schreef in bericht news:3bbe4270_1@dnews...

Quote
> Hello,

> I'm trying to rewrite a vb application that automates a drawing program.
> I can start ,stop and open a drawing by automation.
> But how do i translate the following code ?

> '============ Check active drawing properties
> Set objDoc = Applicatie.ActiveDocument          'Refence to the active
> document
> Set objprop = objDoc.Properties                 'Properties collection
> object

> Set ProjectInfoPropSet = objprop("ProjectInformation")
> Set DocumentNumberProperty = ProjectInfoPropSet("Document Number")
> Set RevisionProperty = ProjectInfoPropSet("Revision")

> thanks,

> Rob

Re:VB to C++


What was it.
Quote
"Rob" <h...@wxs.nl> wrote in message news:3bc09c0b_1@dnews...
> Hello Group,

> I've found the solution.
> No response is necessary.

> Rob

> "Rob" <h...@wxs.nl> schreef in bericht news:3bbe4270_1@dnews...
> > Hello,

> > I'm trying to rewrite a vb application that automates a drawing program.
> > I can start ,stop and open a drawing by automation.
> > But how do i translate the following code ?

> > '============ Check active drawing properties
> > Set objDoc = Applicatie.ActiveDocument          'Refence to the active
> > document
> > Set objprop = objDoc.Properties                 'Properties collection
> > object

> > Set ProjectInfoPropSet = objprop("ProjectInformation")
> > Set DocumentNumberProperty = ProjectInfoPropSet("Document Number")
> > Set RevisionProperty = ProjectInfoPropSet("Revision")

> > thanks,

> > Rob

Re:VB to C++


Hi all,

I am having some troubles passing a string to and from VB as a function
parameter.
I have written a CBuilder component that I would like to use in VB by
wrapping it into an axtiveX control.

Any suggestions would be greatly appreciated.

Thanks John.

Re:VB to C++


Hello Leonard,

I mixed up the function OlepropertyGet() and OleFunction().
And I used VB to get the functions and properties of the type library, it
was more clear to me
then the wrapper of the cbuilder created with import typlibrary.

The folwoing codesipped was the sollution:

 // Get the document property collections object.
 FvDocumentPropertyCollections.Clear();
 FvDocumentPropertyCollections = FvDocument.OlePropertyGet("Properties");
 // Is it a valid object.?
 if (!FvDocumentPropertyCollections.IsEmpty())
 {
   // Get the number of property collections.
   int iResult = FvDocumentPropertyCollections.OlePropertyGet("Count");
   for(int i = 1; i <= iResult;i++)
   {
      // Get the property collection.
     FvDocumentPropertyCollection.Clear();
     FvDocumentPropertyCollection =
FvDocumentPropertyCollections.OleFunction("Item",(Variant)i);
     // Is it a valid object.?
     if (!FvDocumentPropertyCollection.IsEmpty())
     {
        // Test if it is the requested property collection.
        if (FvDocumentPropertyCollection.OlePropertyGet("Name") ==
(Variant)"ProjectInformation")
        {
          // Get the number of properties in the property collection.
          int iCount = FvDocumentPropertyCollection.OlePropertyGet("Count");
          for(int i = 1; i <= iCount;i++)
          {
            // Get the property.
            FvDocumentProperty.Clear();
            FvDocumentProperty =
FvDocumentPropertyCollection.OleFunction("Item",(Variant)i);
            // Is it a valid object.?
            if (!FvDocumentProperty.IsEmpty())
            {
              // Test if it is the requested property.
              if (FvDocumentProperty.OlePropertyGet("Name") ==
(Variant)cProperty)
              {
                 try
                 {
                   // Return the value of the requested property.
                   return FvDocumentProperty.OlePropertyGet("Value");
                 }
                 catch(...)
                 {
                 }
               }
            }
         }
       }
     }
   }

Rob.

"Leonard W. Bogard" <thinkt...@hotmail.com> schreef in bericht
news:3bc0e5b7_1@dnews...

Quote
> What was it.

> "Rob" <h...@wxs.nl> wrote in message news:3bc09c0b_1@dnews...
> > Hello Group,

> > I've found the solution.
> > No response is necessary.

> > Rob

> > "Rob" <h...@wxs.nl> schreef in bericht news:3bbe4270_1@dnews...
> > > Hello,

> > > I'm trying to rewrite a vb application that automates a drawing
program.
> > > I can start ,stop and open a drawing by automation.
> > > But how do i translate the following code ?

> > > '============ Check active drawing properties
> > > Set objDoc = Applicatie.ActiveDocument          'Refence to the active
> > > document
> > > Set objprop = objDoc.Properties                 'Properties collection
> > > object

> > > Set ProjectInfoPropSet = objprop("ProjectInformation")
> > > Set DocumentNumberProperty = ProjectInfoPropSet("Document Number")
> > > Set RevisionProperty = ProjectInfoPropSet("Revision")

> > > thanks,

> > > Rob

Re:VB to C++


Hello Leonard,

I mixed up the function OlepropertyGet() and OleFunction().
And I used VB to get the functions and properties of the type library, it
was more clear to me
then the wrapper of the cbuilder created with import typlibrary.

The folwoing codesipped was the sollution:

 // Get the document property collections object.
 FvDocumentPropertyCollections.Clear();
 FvDocumentPropertyCollections = FvDocument.OlePropertyGet("Properties");
 // Is it a valid object.?
 if (!FvDocumentPropertyCollections.IsEmpty())
 {
   // Get the number of property collections.
   int iResult = FvDocumentPropertyCollections.OlePropertyGet("Count");
   for(int i = 1; i <= iResult;i++)
   {
      // Get the property collection.
     FvDocumentPropertyCollection.Clear();
     FvDocumentPropertyCollection =
FvDocumentPropertyCollections.OleFunction("Item",(Variant)i);
     // Is it a valid object.?
     if (!FvDocumentPropertyCollection.IsEmpty())
     {
        // Test if it is the requested property collection.
        if (FvDocumentPropertyCollection.OlePropertyGet("Name") ==
(Variant)"ProjectInformation")
        {
          // Get the number of properties in the property collection.
          int iCount = FvDocumentPropertyCollection.OlePropertyGet("Count");
          for(int i = 1; i <= iCount;i++)
          {
            // Get the property.
            FvDocumentProperty.Clear();
            FvDocumentProperty =
FvDocumentPropertyCollection.OleFunction("Item",(Variant)i);
            // Is it a valid object.?
            if (!FvDocumentProperty.IsEmpty())
            {
              // Test if it is the requested property.
              if (FvDocumentProperty.OlePropertyGet("Name") ==
(Variant)cProperty)
              {
                 try
                 {
                   // Return the value of the requested property.
                   return FvDocumentProperty.OlePropertyGet("Value");
                 }
                 catch(...)
                 {
                 }
               }
            }
         }
       }
     }
   }

Rob.

"Leonard W. Bogard" <thinkt...@hotmail.com> schreef in bericht
news:3bc0e5b7_1@dnews...

Quote
> What was it.

> "Rob" <h...@wxs.nl> wrote in message news:3bc09c0b_1@dnews...
> > Hello Group,

> > I've found the solution.
> > No response is necessary.

> > Rob

> > "Rob" <h...@wxs.nl> schreef in bericht news:3bbe4270_1@dnews...
> > > Hello,

> > > I'm trying to rewrite a vb application that automates a drawing
program.
> > > I can start ,stop and open a drawing by automation.
> > > But how do i translate the following code ?

> > > '============ Check active drawing properties
> > > Set objDoc = Applicatie.ActiveDocument          'Refence to the active
> > > document
> > > Set objprop = objDoc.Properties                 'Properties collection
> > > object

> > > Set ProjectInfoPropSet = objprop("ProjectInformation")
> > > Set DocumentNumberProperty = ProjectInfoPropSet("Document Number")
> > > Set RevisionProperty = ProjectInfoPropSet("Revision")

> > > thanks,

> > > Rob

Re:VB to C++


Thanks!
Quote
"Rob" <h...@wxs.nl> wrote in message news:3bc22145_1@dnews...
> Hello Leonard,

> I mixed up the function OlepropertyGet() and OleFunction().
> And I used VB to get the functions and properties of the type library, it
> was more clear to me
> then the wrapper of the cbuilder created with import typlibrary.

> The folwoing codesipped was the sollution:

>  // Get the document property collections object.
>  FvDocumentPropertyCollections.Clear();
>  FvDocumentPropertyCollections = FvDocument.OlePropertyGet("Properties");
>  // Is it a valid object.?
>  if (!FvDocumentPropertyCollections.IsEmpty())
>  {
>    // Get the number of property collections.
>    int iResult = FvDocumentPropertyCollections.OlePropertyGet("Count");
>    for(int i = 1; i <= iResult;i++)
>    {
>       // Get the property collection.
>      FvDocumentPropertyCollection.Clear();
>      FvDocumentPropertyCollection =
> FvDocumentPropertyCollections.OleFunction("Item",(Variant)i);
>      // Is it a valid object.?
>      if (!FvDocumentPropertyCollection.IsEmpty())
>      {
>         // Test if it is the requested property collection.
>         if (FvDocumentPropertyCollection.OlePropertyGet("Name") ==
> (Variant)"ProjectInformation")
>         {
>           // Get the number of properties in the property collection.
>           int iCount = FvDocumentPropertyCollection.OlePropertyGet("Count");
>           for(int i = 1; i <= iCount;i++)
>           {
>             // Get the property.
>             FvDocumentProperty.Clear();
>             FvDocumentProperty =
> FvDocumentPropertyCollection.OleFunction("Item",(Variant)i);
>             // Is it a valid object.?
>             if (!FvDocumentProperty.IsEmpty())
>             {
>               // Test if it is the requested property.
>               if (FvDocumentProperty.OlePropertyGet("Name") ==
> (Variant)cProperty)
>               {
>                  try
>                  {
>                    // Return the value of the requested property.
>                    return FvDocumentProperty.OlePropertyGet("Value");
>                  }
>                  catch(...)
>                  {
>                  }
>                }
>             }
>          }
>        }
>      }
>    }

> Rob.

> "Leonard W. Bogard" <thinkt...@hotmail.com> schreef in bericht
> news:3bc0e5b7_1@dnews...
> > What was it.

Re:VB to C++


"Leonard W. Bogard" <thinkt...@hotmail.com> wrote:

Quote
>Thanks!

[quoted material snipped]

Ah, we're happy to help. However, could you go read the 'netiquette'
link referred to below.

Thanks.

Alan Bellingham
--
Team Mongolian Wok
<url:http://www.borland.com/newsgroups/> Borland newsgroup descriptions
<url:http://www.borland.com/newsgroups/netiquette.html>      netiquette

Re:VB to C++


Sorry.  Thanks for the reminder.

Other Threads