<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/318001#M36916</link>
    <description>"rwilkins" &lt;RWILKINS&gt; wrote in message news:f153d73.5@WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Ok guys, got a working version that does what I need. If&lt;BR /&gt;
&amp;gt; you would please take a look and see if I have anything&lt;BR /&gt;
&amp;gt; that could cause issues. Again I'm new to the C++ side and&lt;BR /&gt;
&amp;gt; am very greatful for all your help. //&lt;BR /&gt;
&lt;BR /&gt;
Sure thing. My guess is that you're in for a few surprises.&lt;BR /&gt;
&lt;BR /&gt;
First, the VBARUN command executes VBA macros in the&lt;BR /&gt;
application context.&lt;BR /&gt;
&lt;BR /&gt;
If you try to display a dialog, I think you'll find that&lt;BR /&gt;
there will be problems. You could register the ARX command&lt;BR /&gt;
to run in the Application context as well, but that would&lt;BR /&gt;
prevent you from using acedCommand().&lt;BR /&gt;
&lt;BR /&gt;
In short, how you're doing this is amounts to a kludge&lt;BR /&gt;
that will probably create more problems than it solves,&lt;BR /&gt;
and that may only become apparent once you try doing&lt;BR /&gt;
other things in VBA code that's run from this thing.&lt;BR /&gt;
&lt;BR /&gt;
The correct way to do this is to implement a COM server in&lt;BR /&gt;
ARX, which can fire an event at a connected VBA client, when&lt;BR /&gt;
the commands it registers are issued. If you do that, the&lt;BR /&gt;
command executes in the document context, and the VBA event&lt;BR /&gt;
handler also does. So, you can use acedCommand() and so&lt;BR /&gt;
can the VBA macro (provided you expose a method allowing&lt;BR /&gt;
acedCommand() to be called from VBA).&lt;BR /&gt;
&lt;BR /&gt;
You can see that exact menthod in the AcadXEditorCommand&lt;BR /&gt;
class in AcadX.arx (http://www.caddzone.com/acadx).&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; // ObjectARX defined commands, created by  [3/27/2003], ,&lt;BR /&gt;
&amp;gt; #include "StdAfx.h"&lt;BR /&gt;
&amp;gt; #include "StdArx.h" void GetFolder(char *path);&lt;BR /&gt;
//-----------------------------------------------------------------------------&lt;BR /&gt;
&amp;gt; // This is command 'CHECKDIMS, by  [3/27/2003], ,&lt;BR /&gt;
&amp;gt; void AMSIMiscellaneousUtilitiesCheckDims()&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt; #ifdef OARXWIZDEBUG&lt;BR /&gt;
&amp;gt; acutPrintf ("\nOARXWIZDEBUG - AMSIMiscellaneousUtilitiesCheckDims() called.");&lt;BR /&gt;
&amp;gt; #endif // OARXWIZDEBUG // TODO: Implement the command&lt;BR /&gt;
&amp;gt; char modulePath[512];&lt;BR /&gt;
&amp;gt; char vbastatement[1000];&lt;BR /&gt;
&amp;gt; GetModuleFileName(_hdllInstance, modulePath, 512); GetFolder(modulePath);&lt;BR /&gt;
&amp;gt; vbastatement[0]='\"'; strcat(modulePath , "AmsUtilities.dvb!Module1.CheckForOverRiddenDimensions"); int MAX =&lt;BR /&gt;
strlen(modulePath); for (int i = 0; i &amp;lt;= MAX; i++)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt; vbastatement[i+1] = modulePath&lt;I&gt;;&lt;BR /&gt;
&amp;gt; } MAX = strlen(vbastatement)-1; vbastatement[MAX+1] = '\"';&lt;BR /&gt;
&amp;gt; vbastatement[MAX+2]=0; //acutPrintf (vbastatement);&lt;BR /&gt;
&amp;gt; acedCommand (RTSTR, "_-vbarun", RTSTR, vbastatement, 0); } void GetFolder(char *path)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt; char *pdest;&lt;BR /&gt;
&amp;gt; int result;&lt;BR /&gt;
&amp;gt; int ch = '\\';&lt;BR /&gt;
&amp;gt; pdest = strrchr(path,ch); result = pdest - path + 1; path[result]=0;&lt;BR /&gt;
&amp;gt; }&lt;/I&gt;&lt;/RWILKINS&gt;</description>
    <pubDate>Wed, 02 Apr 2003 21:47:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2003-04-02T21:47:17Z</dc:date>
    <item>
      <title>VB'er making the leap!</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317994#M36909</link>
      <description>First off let me thank you a head of time, THANKS!&lt;BR /&gt;
&lt;BR /&gt;
Okay as the header says I'm a VB programmer making the leap to C++/ARX programming. In other words NEWBIE.&lt;BR /&gt;
&lt;BR /&gt;
Basically all I really want to do is create an ARX file that registers commands in AutoCAD that run VBA macros. I currently have a working version using acedCommand function.&lt;BR /&gt;
&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
//-----------------------------------------------------------------------------&lt;BR /&gt;
// This is command 'CHECKDIMS, by  [3/27/2003], , &lt;BR /&gt;
void AMSIMiscellaneousUtilitiesCheckDims()&lt;BR /&gt;
{&lt;BR /&gt;
#ifdef OARXWIZDEBUG&lt;BR /&gt;
	acutPrintf ("\nOARXWIZDEBUG - AMSIMiscellaneousUtilitiesCheckDims() called.");&lt;BR /&gt;
#endif // OARXWIZDEBUG&lt;BR /&gt;
	&lt;BR /&gt;
	// TODO: Implement the command&lt;BR /&gt;
	char modulePath[512];&lt;BR /&gt;
	char statement[] = "The full path of the executing program is: ";&lt;BR /&gt;
	::GetModuleFileName(_hdllInstance, modulePath, 512);&lt;BR /&gt;
	acutPrintf (strcat(statement,modulePath));&lt;BR /&gt;
	acedCommand (RTSTR, "_-vbarun", RTSTR, "D:\\AMS\\Development\\Clients\\PS&amp;amp;S\\Utilities\\AmsUtilities.dvb!Module1.CheckForOverRiddenDimensions", 0);&lt;BR /&gt;
}&lt;BR /&gt;
&lt;/PRE&gt;&lt;BR /&gt;
&lt;BR /&gt;
I want to take the variable modulePath and get just the folder name that the ARX module is currently located in so that I can concatenate the folder path with the .DVB file. I've tried using #include &lt;STRING&gt;, #include &lt;CSTRING&gt; and any other variations without success, VC keeps stating that string is undefined.&lt;BR /&gt;
&lt;BR /&gt;
I know that I could use a LISP file, but I am trying to package a program for distro. that can be added to registry and will work in all profiles...ARX!&lt;BR /&gt;
&lt;BR /&gt;
Thanks Again for any info!&lt;/CSTRING&gt;&lt;/STRING&gt;</description>
      <pubDate>Mon, 31 Mar 2003 10:32:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317994#M36909</guid>
      <dc:creator>RonnieWilkins</dc:creator>
      <dc:date>2003-03-31T10:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: VB'er making the leap!</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317995#M36910</link>
      <description>&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;Here's one way&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;// To load the VBA project&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;ads_command(RTSTR, "-vbaload", RTSTR, "your project &lt;BR /&gt;
path", RTNONE);&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;// To run the macro&lt;BR /&gt;ads_command(RTSTR, &lt;BR /&gt;
"-vbarun", RTSTR, "your macro name", RTNONE);&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;BLOCKQUOTE dir="ltr"&gt;&lt;BR /&gt;
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"&amp;gt;&lt;BR /&gt;
  &lt;DIV&gt;"rwilkins" &amp;lt;&lt;A&gt;&lt;BR /&gt;
  href="mailto:rwilkins@amsystems.com"&amp;gt;rwilkins@amsystems.com&lt;/A&gt;&amp;gt; wrote in &lt;BR /&gt;
  message &lt;A&gt;&lt;BR /&gt;
  href="news:f153d73.-1@WebX.maYIadrTaRb"&amp;gt;news:f153d73.-1@WebX.maYIadrTaRb&lt;/A&gt;...&lt;/DIV&gt;First &lt;BR /&gt;
  off let me thank you a head of time, THANKS! &lt;BR /&gt;
  &lt;P&gt;Okay as the header says I'm a VB programmer making the leap to C++/ARX &lt;BR /&gt;
  programming. In other words NEWBIE. &lt;BR /&gt;
  &lt;/P&gt;&lt;P&gt;Basically all I really want to do is create an ARX file that registers &lt;BR /&gt;
  commands in AutoCAD that run VBA macros. I currently have a working version &lt;BR /&gt;
  using acedCommand function. &lt;BR /&gt;
  &lt;/P&gt;&lt;P&gt;&lt;PRE&gt; &lt;BR /&gt;
//----------------------------------------------------------------------------- &lt;BR /&gt;
// This is command 'CHECKDIMS, by  [3/27/2003], ,  &lt;BR /&gt;
void AMSIMiscellaneousUtilitiesCheckDims() &lt;BR /&gt;
{ &lt;BR /&gt;
#ifdef OARXWIZDEBUG &lt;BR /&gt;
	acutPrintf ("\nOARXWIZDEBUG - AMSIMiscellaneousUtilitiesCheckDims() called."); &lt;BR /&gt;
#endif // OARXWIZDEBUG &lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;	// TODO: Implement the command &lt;BR /&gt;
	char modulePath[512]; &lt;BR /&gt;
	char statement[] = "The full path of the executing program is: "; &lt;BR /&gt;
	::GetModuleFileName(_hdllInstance, modulePath, 512); &lt;BR /&gt;
	acutPrintf (strcat(statement,modulePath)); &lt;BR /&gt;
	acedCommand (RTSTR, "_-vbarun", RTSTR, "D:\\AMS\\Development\\Clients\\PS&amp;amp;S\\Utilities\\AmsUtilities.dvb!Module1.CheckForOverRiddenDimensions", 0); &lt;BR /&gt;
} &lt;BR /&gt;
&lt;/P&gt;&lt;BR /&gt;
  &lt;P&gt;I want to take the variable modulePath and get just the folder name that &lt;BR /&gt;
  the ARX module is currently located in so that I can concatenate the folder &lt;BR /&gt;
  path with the .DVB file. I've tried using #include &amp;lt;string&amp;gt;, #include &lt;BR /&gt;
  &amp;lt;cstring&amp;gt; and any other variations without success, VC keeps stating &lt;BR /&gt;
  that string is undefined. &lt;BR /&gt;
  &lt;/P&gt;&lt;P&gt;I know that I could use a LISP file, but I am trying to package a program &lt;BR /&gt;
  for distro. that can be added to registry and will work in all profiles...ARX! &lt;BR /&gt;
&lt;BR /&gt;
  &lt;/P&gt;&lt;P&gt;Thanks Again for any info!&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 31 Mar 2003 11:07:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317995#M36910</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-03-31T11:07:48Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317996#M36911</link>
      <description>&lt;PRE&gt;&lt;BR /&gt;
Gary,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the info, but what I am trying to do is take the value from 'modulePath' variable that will contains the path including file name of the current ARX file. What I can't seem to grasp is how to get a substring from this variable that will be only the folder 'C:\Test\', not 'C:\Test\file.ARX'. What I really need is a function that will reverse find in the modulPath variable '\'. In VB I could do this instinctively, but C++ is driving me crazy.&lt;BR /&gt;
&lt;BR /&gt;
In a console application I can say #include &lt;STRING&gt; and have the functionality I need through the string object. But for some reason if I try to use a string object VC keeps saying "'string' : undeclared identifier"&lt;BR /&gt;
&lt;BR /&gt;
Here is an updated code snippet with a closer idea of what I'm trying to do:&lt;BR /&gt;
&lt;BR /&gt;
//Begin code&lt;BR /&gt;
//&lt;BR /&gt;
// ObjectARX defined commands, created by  [3/27/2003], , &lt;BR /&gt;
#include "StdAfx.h"&lt;BR /&gt;
#include "StdArx.h"&lt;BR /&gt;
#include &lt;STRING&gt;&lt;BR /&gt;
&lt;BR /&gt;
char GetFolder(char *path);&lt;BR /&gt;
&lt;BR /&gt;
//-----------------------------------------------------------------------------&lt;BR /&gt;
// This is command 'CHECKDIMS, by  [3/27/2003], , &lt;BR /&gt;
void AMSIMiscellaneousUtilitiesCheckDims()&lt;BR /&gt;
{&lt;BR /&gt;
#ifdef OARXWIZDEBUG&lt;BR /&gt;
	acutPrintf ("\nOARXWIZDEBUG - AMSIMiscellaneousUtilitiesCheckDims() called.");&lt;BR /&gt;
#endif // OARXWIZDEBUG&lt;BR /&gt;
	&lt;BR /&gt;
	// TODO: Implement the command&lt;BR /&gt;
	char modulePath[512];&lt;BR /&gt;
	char statement[] = "The full path of the executing program is: ";&lt;BR /&gt;
	::GetModuleFileName(_hdllInstance, modulePath, 512);&lt;BR /&gt;
	acutPrintf (strcat(statement,modulePath));&lt;BR /&gt;
&lt;BR /&gt;
	/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;BR /&gt;
	The following line works great as is, but is hard coded. I need this to be flexible thus a strcat with a variable&lt;BR /&gt;
	acedCommand (RTSTR, "_-vbarun", RTSTR, "D:\\AMS\\Development\\Clients\\PS&amp;amp;S\\Utilities\\AmsUtilities.dvb!Module1.CheckForOverRiddenDimensions", 0);&lt;BR /&gt;
	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/&lt;BR /&gt;
	&lt;BR /&gt;
	//string t; //If I try to compile this line states that 'string' is undeclared.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
	//The following two lines are what I am wanting to work...just doesn't, yet!&lt;BR /&gt;
	char FolderLocation = GetFolder(modulePath);&lt;BR /&gt;
	acedCommand (RTSTR, "_-vbarun", RTSTR, strcat(FolderLocation , "AmsUtilities.dvb!Module1.CheckForOverRiddenDimensions"), 0);&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
char GetFolder(char *path)&lt;BR /&gt;
{&lt;BR /&gt;
	char *pdest;&lt;BR /&gt;
	int result;&lt;BR /&gt;
	int ch = '\\';&lt;BR /&gt;
	pdest = strrchr(path,ch);&lt;BR /&gt;
	&lt;BR /&gt;
	result = pdest - path + 1; //Now that I have the location of the last "\", I'm dumb founded.&lt;BR /&gt;
	&lt;BR /&gt;
	char temp;&lt;BR /&gt;
	new temp[result];&lt;BR /&gt;
	//char newpath = path[0,pdest];&lt;BR /&gt;
	//return newpath;&lt;BR /&gt;
	return temp;&lt;BR /&gt;
}&lt;BR /&gt;
//End Code&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;/STRING&gt;&lt;/STRING&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Mar 2003 11:26:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317996#M36911</guid>
      <dc:creator>RonnieWilkins</dc:creator>
      <dc:date>2003-03-31T11:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: VB'er making the leap!</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317997#M36912</link>
      <description>I'm not sure I follow, but it sounds like you want to use a variable of type&lt;BR /&gt;
"string" in your program.  If this is the case, then #include &lt;STRING&gt; is&lt;BR /&gt;
correct.  However you need to declare your variable like this:&lt;BR /&gt;
&lt;BR /&gt;
std::string strVar;&lt;BR /&gt;
&lt;BR /&gt;
This is because the "string" type resides in the "std" namespace.&lt;BR /&gt;
Alternatively, you could put the following after your #includes:&lt;BR /&gt;
&lt;BR /&gt;
using namespace std;&lt;BR /&gt;
&lt;BR /&gt;
Then you don't to prefix types from the "std" namespace with std::&lt;BR /&gt;
&lt;BR /&gt;
Am I even close to understanding what you are after?&lt;BR /&gt;
&lt;BR /&gt;
Chuck&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"rwilkins" &lt;RWILKINS&gt; wrote in message&lt;BR /&gt;
news:f153d73.-1@WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; First off let me thank you a head of time, THANKS!&lt;BR /&gt;
&amp;gt; Okay as the header says I'm a VB programmer making the leap to C++/ARX&lt;BR /&gt;
programming. In other words NEWBIE.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Basically all I really want to do is create an ARX file that registers&lt;BR /&gt;
commands in AutoCAD that run VBA macros. I currently have a working version&lt;BR /&gt;
using acedCommand function.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
//-----------------------------------------------------------------------------&lt;BR /&gt;
&amp;gt; // This is command 'CHECKDIMS, by  [3/27/2003], ,&lt;BR /&gt;
&amp;gt; void AMSIMiscellaneousUtilitiesCheckDims()&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt; #ifdef OARXWIZDEBUG&lt;BR /&gt;
&amp;gt; acutPrintf ("\nOARXWIZDEBUG - AMSIMiscellaneousUtilitiesCheckDims() called.");&lt;BR /&gt;
&amp;gt; #endif // OARXWIZDEBUG // TODO: Implement the command&lt;BR /&gt;
&amp;gt; char modulePath[512];&lt;BR /&gt;
&amp;gt; char statement[] = "The full path of the executing program is: ";&lt;BR /&gt;
&amp;gt; ::GetModuleFileName(_hdllInstance, modulePath, 512);&lt;BR /&gt;
&amp;gt; acutPrintf (strcat(statement,modulePath));&lt;BR /&gt;
&amp;gt; acedCommand (RTSTR, "_-vbarun", RTSTR,&lt;BR /&gt;
"D:\\AMS\\Development\\Clients\\PS&amp;amp;S\\Utilities\\AmsUtilities.dvb!Module1.CheckF&lt;BR /&gt;
orOverRiddenDimensions", 0);&lt;BR /&gt;
&amp;gt; }&lt;BR /&gt;
&amp;gt; I want to take the variable modulePath and get just the folder name that the&lt;BR /&gt;
ARX module is currently located in so that I can concatenate the folder path&lt;BR /&gt;
with the .DVB file. I've tried using #include &lt;STRING&gt;, #include &lt;CSTRING&gt; and&lt;BR /&gt;
any other variations without success, VC keeps stating that string is undefined.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I know that I could use a LISP file, but I am trying to package a program for&lt;BR /&gt;
distro. that can be added to registry and will work in all profiles...ARX!&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks Again for any info!&lt;BR /&gt;
&amp;gt;&lt;/CSTRING&gt;&lt;/STRING&gt;&lt;/RWILKINS&gt;&lt;/STRING&gt;</description>
      <pubDate>Mon, 31 Mar 2003 12:04:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317997#M36912</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-03-31T12:04:37Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317998#M36913</link>
      <description>Chuck,&lt;BR /&gt;
&lt;BR /&gt;
You have the idea, but for some reason when I try and compile even with the statement "std::string" VC says that string is not in namespace std.&lt;BR /&gt;
&lt;BR /&gt;
I'm currently just using c-style strings (char variables) due to the VC spitting back at me with the string variable non-sense.&lt;BR /&gt;
&lt;BR /&gt;
If I try and do this in a console application I have no problems but something inside this arx workspace is throwing things offs...atleast I guess.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Ron</description>
      <pubDate>Mon, 31 Mar 2003 12:10:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317998#M36913</guid>
      <dc:creator>RonnieWilkins</dc:creator>
      <dc:date>2003-03-31T12:10:17Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317999#M36914</link>
      <description>&lt;DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;I use MFC, so I would use CString, also this is a &lt;BR /&gt;
better way of getting the path of your ARX&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;// This gives you the full path of you ARX&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;char* pPath = acedGetAppName();&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;F.Y.I. You can E-mail me directly if you &lt;BR /&gt;
like&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;BLOCKQUOTE dir="ltr"&gt;&lt;BR /&gt;
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"&amp;gt;&lt;BR /&gt;
  &lt;DIV&gt;"rwilkins" &amp;lt;&lt;A&gt;&lt;BR /&gt;
  href="mailto:rwilkins@amsystems.com"&amp;gt;rwilkins@amsystems.com&lt;/A&gt;&amp;gt; wrote in &lt;BR /&gt;
  message &lt;A&gt;&lt;BR /&gt;
  href="news:f153d73.1@WebX.maYIadrTaRb"&amp;gt;news:f153d73.1@WebX.maYIadrTaRb&lt;/A&gt;...&lt;/DIV&gt;&lt;PRE&gt; &lt;BR /&gt;
Gary, &lt;P&gt;Thanks for the info, but what I am trying to do is take the value from 'modulePath' variable that will contains the path including file name of the current ARX file. What I can't seem to grasp is how to get a substring from this variable that will be only the folder 'C:\Test\', not 'C:\Test\file.ARX'. What I really need is a function that will reverse find in the modulPath variable '\'. In VB I could do this instinctively, but C++ is driving me crazy. &lt;/P&gt;&lt;P&gt;In a console application I can say #include &amp;lt;string&amp;gt; and have the functionality I need through the string object. But for some reason if I try to use a string object VC keeps saying "'string' : undeclared identifier" &lt;/P&gt;&lt;P&gt;Here is an updated code snippet with a closer idea of what I'm trying to do: &lt;/P&gt;&lt;P&gt;//Begin code &lt;BR /&gt;
// &lt;BR /&gt;
// ObjectARX defined commands, created by  [3/27/2003], ,  &lt;BR /&gt;
#include "StdAfx.h" &lt;BR /&gt;
#include "StdArx.h" &lt;BR /&gt;
#include &amp;lt;string&amp;gt; &lt;/P&gt;&lt;P&gt;char GetFolder(char *path); &lt;/P&gt;&lt;P&gt;//----------------------------------------------------------------------------- &lt;BR /&gt;
// This is command 'CHECKDIMS, by  [3/27/2003], ,  &lt;BR /&gt;
void AMSIMiscellaneousUtilitiesCheckDims() &lt;BR /&gt;
{ &lt;BR /&gt;
#ifdef OARXWIZDEBUG &lt;BR /&gt;
	acutPrintf ("\nOARXWIZDEBUG - AMSIMiscellaneousUtilitiesCheckDims() called."); &lt;BR /&gt;
#endif // OARXWIZDEBUG &lt;/P&gt;&lt;P&gt;	// TODO: Implement the command &lt;BR /&gt;
	char modulePath[512]; &lt;BR /&gt;
	char statement[] = "The full path of the executing program is: "; &lt;BR /&gt;
	::GetModuleFileName(_hdllInstance, modulePath, 512); &lt;BR /&gt;
	acutPrintf (strcat(statement,modulePath)); &lt;/P&gt;&lt;P&gt;	/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ &lt;BR /&gt;
	The following line works great as is, but is hard coded. I need this to be flexible thus a strcat with a variable &lt;BR /&gt;
	acedCommand (RTSTR, "_-vbarun", RTSTR, "D:\\AMS\\Development\\Clients\\PS&amp;amp;S\\Utilities\\AmsUtilities.dvb!Module1.CheckForOverRiddenDimensions", 0); &lt;BR /&gt;
	++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ &lt;/P&gt;&lt;P&gt;	//string t; //If I try to compile this line states that 'string' is undeclared. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	//The following two lines are what I am wanting to work...just doesn't, yet! &lt;BR /&gt;
	char FolderLocation = GetFolder(modulePath); &lt;BR /&gt;
	acedCommand (RTSTR, "_-vbarun", RTSTR, strcat(FolderLocation , "AmsUtilities.dvb!Module1.CheckForOverRiddenDimensions"), 0); &lt;BR /&gt;
} &lt;/P&gt;&lt;P&gt;char GetFolder(char *path) &lt;BR /&gt;
{ &lt;BR /&gt;
	char *pdest; &lt;BR /&gt;
	int result; &lt;BR /&gt;
	int ch = '\\'; &lt;BR /&gt;
	pdest = strrchr(path,ch); &lt;/P&gt;&lt;P&gt;	result = pdest - path + 1; //Now that I have the location of the last "\", I'm dumb founded. &lt;/P&gt;&lt;P&gt;	char temp; &lt;BR /&gt;
	new temp[result]; &lt;BR /&gt;
	//char newpath = path[0,pdest]; &lt;BR /&gt;
	//return newpath; &lt;BR /&gt;
	return temp; &lt;BR /&gt;
} &lt;BR /&gt;
//End Code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 31 Mar 2003 12:31:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/317999#M36914</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-03-31T12:31:49Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/318000#M36915</link>
      <description>&lt;PRE&gt;&lt;BR /&gt;
Ok guys, got a working version that does what I need. If&lt;BR /&gt;
you would please take a look and see if I have anything&lt;BR /&gt;
that could cause issues. Again I'm new to the C++ side and&lt;BR /&gt;
am very greatful for all your help.&lt;BR /&gt;
&lt;BR /&gt;
//&lt;BR /&gt;
// ObjectARX defined commands, created by  [3/27/2003], , &lt;BR /&gt;
#include "StdAfx.h"&lt;BR /&gt;
#include "StdArx.h"&lt;BR /&gt;
&lt;BR /&gt;
void GetFolder(char *path);&lt;BR /&gt;
&lt;BR /&gt;
//-----------------------------------------------------------------------------&lt;BR /&gt;
// This is command 'CHECKDIMS, by  [3/27/2003], , &lt;BR /&gt;
void AMSIMiscellaneousUtilitiesCheckDims()&lt;BR /&gt;
{&lt;BR /&gt;
#ifdef OARXWIZDEBUG&lt;BR /&gt;
	acutPrintf ("\nOARXWIZDEBUG - AMSIMiscellaneousUtilitiesCheckDims() called.");&lt;BR /&gt;
#endif // OARXWIZDEBUG&lt;BR /&gt;
	&lt;BR /&gt;
	// TODO: Implement the command&lt;BR /&gt;
	char modulePath[512];&lt;BR /&gt;
	char vbastatement[1000];&lt;BR /&gt;
	GetModuleFileName(_hdllInstance, modulePath, 512);&lt;BR /&gt;
	&lt;BR /&gt;
	GetFolder(modulePath);&lt;BR /&gt;
	vbastatement[0]='\"';&lt;BR /&gt;
&lt;BR /&gt;
	strcat(modulePath , "AmsUtilities.dvb!Module1.CheckForOverRiddenDimensions");&lt;BR /&gt;
&lt;BR /&gt;
	int MAX = strlen(modulePath);&lt;BR /&gt;
&lt;BR /&gt;
	for (int i = 0; i &amp;lt;= MAX; i++)&lt;BR /&gt;
	{&lt;BR /&gt;
		vbastatement[i+1] = modulePath&lt;I&gt;;&lt;BR /&gt;
	}&lt;BR /&gt;
	&lt;BR /&gt;
	MAX = strlen(vbastatement)-1;&lt;BR /&gt;
&lt;BR /&gt;
	vbastatement[MAX+1] = '\"';&lt;BR /&gt;
	vbastatement[MAX+2]=0;&lt;BR /&gt;
&lt;BR /&gt;
	//acutPrintf (vbastatement);&lt;BR /&gt;
	acedCommand (RTSTR, "_-vbarun", RTSTR, vbastatement, 0);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
void GetFolder(char *path)&lt;BR /&gt;
{&lt;BR /&gt;
	char *pdest;&lt;BR /&gt;
	int result;&lt;BR /&gt;
	int ch = '\\';&lt;BR /&gt;
	pdest = strrchr(path,ch);&lt;BR /&gt;
	&lt;BR /&gt;
	result = pdest - path + 1;&lt;BR /&gt;
	&lt;BR /&gt;
	path[result]=0;&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
&lt;/I&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Mar 2003 13:30:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/318000#M36915</guid>
      <dc:creator>RonnieWilkins</dc:creator>
      <dc:date>2003-03-31T13:30:02Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/318001#M36916</link>
      <description>"rwilkins" &lt;RWILKINS&gt; wrote in message news:f153d73.5@WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Ok guys, got a working version that does what I need. If&lt;BR /&gt;
&amp;gt; you would please take a look and see if I have anything&lt;BR /&gt;
&amp;gt; that could cause issues. Again I'm new to the C++ side and&lt;BR /&gt;
&amp;gt; am very greatful for all your help. //&lt;BR /&gt;
&lt;BR /&gt;
Sure thing. My guess is that you're in for a few surprises.&lt;BR /&gt;
&lt;BR /&gt;
First, the VBARUN command executes VBA macros in the&lt;BR /&gt;
application context.&lt;BR /&gt;
&lt;BR /&gt;
If you try to display a dialog, I think you'll find that&lt;BR /&gt;
there will be problems. You could register the ARX command&lt;BR /&gt;
to run in the Application context as well, but that would&lt;BR /&gt;
prevent you from using acedCommand().&lt;BR /&gt;
&lt;BR /&gt;
In short, how you're doing this is amounts to a kludge&lt;BR /&gt;
that will probably create more problems than it solves,&lt;BR /&gt;
and that may only become apparent once you try doing&lt;BR /&gt;
other things in VBA code that's run from this thing.&lt;BR /&gt;
&lt;BR /&gt;
The correct way to do this is to implement a COM server in&lt;BR /&gt;
ARX, which can fire an event at a connected VBA client, when&lt;BR /&gt;
the commands it registers are issued. If you do that, the&lt;BR /&gt;
command executes in the document context, and the VBA event&lt;BR /&gt;
handler also does. So, you can use acedCommand() and so&lt;BR /&gt;
can the VBA macro (provided you expose a method allowing&lt;BR /&gt;
acedCommand() to be called from VBA).&lt;BR /&gt;
&lt;BR /&gt;
You can see that exact menthod in the AcadXEditorCommand&lt;BR /&gt;
class in AcadX.arx (http://www.caddzone.com/acadx).&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; // ObjectARX defined commands, created by  [3/27/2003], ,&lt;BR /&gt;
&amp;gt; #include "StdAfx.h"&lt;BR /&gt;
&amp;gt; #include "StdArx.h" void GetFolder(char *path);&lt;BR /&gt;
//-----------------------------------------------------------------------------&lt;BR /&gt;
&amp;gt; // This is command 'CHECKDIMS, by  [3/27/2003], ,&lt;BR /&gt;
&amp;gt; void AMSIMiscellaneousUtilitiesCheckDims()&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt; #ifdef OARXWIZDEBUG&lt;BR /&gt;
&amp;gt; acutPrintf ("\nOARXWIZDEBUG - AMSIMiscellaneousUtilitiesCheckDims() called.");&lt;BR /&gt;
&amp;gt; #endif // OARXWIZDEBUG // TODO: Implement the command&lt;BR /&gt;
&amp;gt; char modulePath[512];&lt;BR /&gt;
&amp;gt; char vbastatement[1000];&lt;BR /&gt;
&amp;gt; GetModuleFileName(_hdllInstance, modulePath, 512); GetFolder(modulePath);&lt;BR /&gt;
&amp;gt; vbastatement[0]='\"'; strcat(modulePath , "AmsUtilities.dvb!Module1.CheckForOverRiddenDimensions"); int MAX =&lt;BR /&gt;
strlen(modulePath); for (int i = 0; i &amp;lt;= MAX; i++)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt; vbastatement[i+1] = modulePath&lt;I&gt;;&lt;BR /&gt;
&amp;gt; } MAX = strlen(vbastatement)-1; vbastatement[MAX+1] = '\"';&lt;BR /&gt;
&amp;gt; vbastatement[MAX+2]=0; //acutPrintf (vbastatement);&lt;BR /&gt;
&amp;gt; acedCommand (RTSTR, "_-vbarun", RTSTR, vbastatement, 0); } void GetFolder(char *path)&lt;BR /&gt;
&amp;gt; {&lt;BR /&gt;
&amp;gt; char *pdest;&lt;BR /&gt;
&amp;gt; int result;&lt;BR /&gt;
&amp;gt; int ch = '\\';&lt;BR /&gt;
&amp;gt; pdest = strrchr(path,ch); result = pdest - path + 1; path[result]=0;&lt;BR /&gt;
&amp;gt; }&lt;/I&gt;&lt;/RWILKINS&gt;</description>
      <pubDate>Wed, 02 Apr 2003 21:47:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/318001#M36916</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-04-02T21:47:17Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/318002#M36917</link>
      <description>This is what I do in Acad Map5 with VC++. I create an ActiveX toolbar and register a command for each button. In the void that the command calls I have almost exactly what "rwilkins" does. It works great. I have all kinds of DVB and Lisp files in a single folder out on our network the .arx is there also. The users include my .arx in their startup suite and I only have to manage that one .arx and all my tools get managed with no distribution issues. My unload events take the commands a toolbar away so I don't leave garbage behind if they unload it. Basically the .arx ends up acting as a server to manage the .dvb's and Lisp routines. I'm not sure if that is what Tony is talking about or not, but I haven't run into any issues this way and I use a lot of dialogs on the VB side.</description>
      <pubDate>Fri, 04 Apr 2003 06:34:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/318002#M36917</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-04-04T06:34:51Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/318003#M36918</link>
      <description>&lt;P&gt;&lt;BR /&gt;
Oops I take that back I just realized you are doing a VBARUN&lt;BR /&gt;
I do a VBA load and then the buttons have the -_vbarun statement in them as there command. This is probably why I haven't run into problems doing it this way.&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2003 08:26:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/vb-er-making-the-leap/m-p/318003#M36918</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-04-04T08:26:30Z</dc:date>
    </item>
  </channel>
</rss>

