Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

I am using the ExtUse example w/ Extension example from v101 in v314 and that works ok. I put everything from the Net Diagnostics example in v314 into the extension. It was a long fun project. I eventually got the Extension compiled & running perfectly. It still does that. I am trying to use one of the functions on event app start from the Extension in Extuse. Both Extuse and Extension compile perfectly, but when I try to run the program in the simulator, the simulator crashes.

Like:
void (*ND_DisplaySplashScreen)(IExtensionCls * po); in QINTERFACE
and
#define IEXTCLS_ND_DisplaySplashScreen(p) GET_PVTBL(p,IExtensionCls)->ND_DisplaySplashScreen(p)

are defined etc...

Also, the pointers are in the function like:

static void ND_DisplaySplashScreen(IExtensionCls* po)
{
ExtensionCls* pApp = (ExtensionCls*) po;
IImage* pSplash = NULL;
AEEImageInfo rImageInfo;

if((pSplash = ISHELL_LoadResImage( pApp->m_pIShell, NETDIAGNOSTICS_RES_FILE, IDB_SPLASH)) != NULL)
{
// Get image information
IIMAGE_GetInfo(pSplash, &rImageInfo);

// Clear Device screen
IDISPLAY_ClearScreen(pApp->m_pIDisplay);

// Draw the image in the center of the screen
IIMAGE_Draw(pSplash, (pApp->m_rc.dx/2) - (rImageInfo.cx/2), (pApp->m_rc.dy/2) - (rImageInfo.cy/2));

// The image is no longer needed so release it
IIMAGE_Release(pSplash);

// Set the callback timer
ISHELL_SetTimer( pApp->m_pIShell, SPLASH_TIMER_DURATION, (PFNNOTIFY)ND_DisplaySplashScreenCB, pApp);

// Update Display
IDISPLAY_Update(pApp->m_pIDisplay);

return;
}
else
{
ND_GoTo( po, JUMP_MAIN );
}

....as you can see....

and all the variables are in the extension class like:

typedef struct _ExtensionCls
{
// Declare our VTable
// by doing so, we have placed function pointers
// in the begininng of this structure
DECLARE_VTBL(IExtensionCls)

// Class member variables
//AC->
AEERect m_rc;
int m_cntHistory;
char * m_ppszHistory[MAX_HIST];
PFNCLEANUP m_pfnViewCleanup;
IFileMgr * m_pFileMgr;
flg m_bRS:1;
flg m_bRT:1;
flg m_bTCP:1;
char * m_pszHost;
char * m_pszURL;
char * m_pszMsg;
char * m_pszFormData;
uint16 m_nDataLength;
AEECallback m_cb;
WebAction m_awa[1];
IWeb * m_pIWeb;
uint32 m_nTotalTime;
uint32 m_nSendTime; // Time to Send Data
uint32 m_nReceiveTime; // Time to Receive Data
AEEDNSResult m_dnsr; // DNS Result
uint16 m_nTCPIdx; // Index used for sending TCP data

uint32 m_nRefs; // References to us
IShell * m_pIShell; // copy of Shell pointer
IDisplay * m_pIDisplay; // Display interface pointer
IModule * m_pIModule; // IModule interface pointer
IStatic * m_pIStatic;

and all other Net Diagnostics functions are added to the extension properly like the extension example does with the DrawSmiley & DrawHello.

One attempt I had to conquer this problem was to make instances of all the classes. I am doing this to get Net Diagnostics functions to work in Extension.

I did it like:

//AC-Start->
if( ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_EXTENSION_CLS, (void **)&pExtCls) )
return FALSE;

//Undo the interface
// Create each of the controls used by the application.
if((ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_FILEMGR, (void**)(&pExtCls->m_pFileMgr)) != SUCCESS) ||
(ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_HTML, (void**)(&pExtCls->m_pIHTMLViewer)) != SUCCESS) ||
(ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_NET, (void**)(&pExtCls->m_pINetMgr)) != SUCCESS) ||
(ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_WEB, (void **)(&pExtCls->m_pIWeb)) != SUCCESS))
{
IAPPLET_Release((IApplet*)pMe);
return FALSE;
}

IDISPLAY_ClearScreen(pMe->m_pIDisplay);
IEXTCLS_ND_DisplaySplashScreen(pExtCls);

//AC-Over<-

I know that it is a problem with the instances of the interfaces that I need. I think that I am not instantiating them in the right place or something like that????
But the errors for Extuse compile with the above code are:

c:\program files\brew v3_1_4\sdk\examples\extuse\extuse.c(223) : error C2039: 'm_pFileMgr' : is not a member of '_IExtensionCls'
c:\program files\brew v3_1_4\sdk\examples\extension\extension.h(37) : see declaration of '_IExtensionCls'
c:\program files\brew v3_1_4\sdk\examples\extuse\extuse.c(223) : error C2198: 'function through pointer' : too few actual parameters
c:\program files\brew v3_1_4\sdk\examples\extuse\extuse.c(224) : error C2039: 'm_pIHTMLViewer' : is not a member of '_IExtensionCls'
c:\program files\brew v3_1_4\sdk\examples\extension\extension.h(37) : see declaration of '_IExtensionCls'
c:\program files\brew v3_1_4\sdk\examples\extuse\extuse.c(224) : error C2198: 'function through pointer' : too few actual parameters
c:\program files\brew v3_1_4\sdk\examples\extuse\extuse.c(225) : error C2039: 'm_pINetMgr' : is not a member of '_IExtensionCls'
c:\program files\brew v3_1_4\sdk\examples\extension\extension.h(37) : see declaration of '_IExtensionCls'
c:\program files\brew v3_1_4\sdk\examples\extuse\extuse.c(225) : error C2198: 'function through pointer' : too few actual parameters
c:\program files\brew v3_1_4\sdk\examples\extuse\extuse.c(226) : error C2039: 'm_pIWeb' : is not a member of '_IExtensionCls'
c:\program files\brew v3_1_4\sdk\examples\extension\extension.h(37) : see declaration of '_IExtensionCls'
c:\program files\brew v3_1_4\sdk\examples\extuse\extuse.c(226) : error C2198: 'function through pointer' : too few actual parameters

I was getting these errors in Extension also, but I could cast _IExtensionCls into _ExtensionCls like ExtensionCls * pMe = (ExtensionCls*) po; po is an IExtensionCls*....this would get rid of any warnings & errors in extension.

So, if anyone has any ideas, it would be great because I am completely lost at this point and am not sure what to try next.

I am a senior @ UMass Dartmouth & I am doing this project for school & the company I work at. Net Diagnostics has all the functionality I need in the extension. I would appreciate any help on this issue. I know it has something to do with the pointer to the extension and extension interface or applet pointer from the extuse, but I am not exactly sure.

Thanks,
Adam :)

I was wondering why there are no practical examples for extensions. There are tons of programs and those are a great place to start making a new program, but there are no extensions examples that use much of anything except displaying hello on the screen. Maybe there are some practical extension examples but I have no found them. Does anyone know where to find any?
Thanks,
Adam :eek:

I was wondering why there are no practical examples for extensions. There are tons of programs and those are a great place to start making a new program, but there are no extensions examples that use much of anything except displaying hello on the screen. Maybe there are some practical extension examples but I have no found them. Does anyone know where to find any?
Thanks,
Adam :eek:

When I try to access one of the functions from Extension in Extuse like:
case AVK_3:
if( ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_EXTENSION_CLS, (void **)&pExtCls) )
return FALSE;
IDISPLAY_ClearScreen(pMe->m_pIDisplay);
IEXTCLS_ND_DisplaySplashScreen(pExtCls);
IDISPLAY_Update(pMe->m_pIDisplay);
IEXTCLS_Release(pExtCls);
return TRUE;
It compiles great and I have it so it happens when the 3 button is pressed. It is the IEXTCLS_ND_DisplaySplashScreen(pExtCls); function. During execution when I press the 3 button, I am getting the Debug information:
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\BREW_Simulator.exe', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\BREWResCore.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\urlmon.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\BREWEncoding.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\GPSServer.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\msvcr71.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\MFC71u.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shell32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\msvcp71.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\winmm.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2_32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2help.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msctf.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\camera.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msacm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\clbcatq.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comres.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\BREW_SimulatorRes.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\mslbui.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\BREW_Tones.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msxml3.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\winhttp.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\mlang.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\Modules\ISmsWmsCdmaSimulation.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\Modules\VirtualIJoystickExtension.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msimg32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\Modules\WiFiSimulation.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comdlg32.dll', no matching symbolic information found.
Loaded symbols for 'C:\Program Files\BREW v3_1_4\sdk\examples\Extuse\ExtUse.dll'
Loaded symbols for 'C:\Program Files\BREW v3_1_4\sdk\examples\Extension\Extension.dll'
Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
The thread 0xEAC has exited with code 0 (0x0).
The thread 0xF48 has exited with code -1073741819 (0xC0000005).
The thread 0x9F4 has exited with code -1073741819 (0xC0000005).
The thread 0x33C has exited with code -1073741819 (0xC0000005).
The thread 0xF20 has exited with code -1073741819 (0xC0000005).
The program 'C:\Program Files\BREW v3_1_4\sdk\bin\BREW_Simulator.exe' has exited with code -1073741819 (0xC0000005).
Inside of the Extension, the function is like:
static void ND_DisplaySplashScreen(IExtensionCls* po)
{
ExtensionCls* pApp = (ExtensionCls*) po;
IImage* pSplash = NULL;
AEEImageInfo rImageInfo;
if((pSplash = ISHELL_LoadResImage( pApp->m_pIShell, NETDIAGNOSTICS_RES_FILE, IDB_SPLASH)) != NULL)
{
// Get image information
IIMAGE_GetInfo(pSplash, &rImageInfo);
// Clear Device screen
IDISPLAY_ClearScreen(pApp->m_pIDisplay);
// Draw the image in the center of the screen
IIMAGE_Draw(pSplash, (pApp->m_rc.dx/2) - (rImageInfo.cx/2), (pApp->m_rc.dy/2) - (rImageInfo.cy/2));
// The image is no longer needed so release it
IIMAGE_Release(pSplash);
// Set the callback timer
ISHELL_SetTimer( pApp->m_pIShell, SPLASH_TIMER_DURATION, (PFNNOTIFY)ND_DisplaySplashScreenCB, pApp);
// Update Display
IDISPLAY_Update(pApp->m_pIDisplay);
return;
}
else
{
ND_GoTo( po, JUMP_MAIN );
}

I know that this function is expecting an IExtensionCls pointer, but I can not make that in Extuse. The function is all setup to work & everything with declared inside of the:
QINTERFACE(IExtensionCls)
{
DECLARE_IBASE(IExtensionCls)
void (*ND_DisplaySplashScreen)(IExtensionCls * po);

And I got the function linked like:
#define IEXTCLS_ND_DisplaySplashScreen(p) GET_PVTBL(p,IExtensionCls)->ND_DisplaySplashScreen(p)
Also, I try to cast the ExtCls* into an IExtCls* like:
case AVK_3:
if( ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_EXTENSION_CLS, (void **)&pExtCls) )
return FALSE;
IDISPLAY_ClearScreen(pMe->m_pIDisplay);
IEXTCLS_ND_DisplaySplashScreen((IExtensionCls*)pExtCls);
IDISPLAY_Update(pMe->m_pIDisplay);
IEXTCLS_Release(pExtCls);
return TRUE;
But, that does not do much help for me. If anyone got any suggestions or insults, I would gladly appreciate it.
Thanks,
Adam

When I try to access one of the functions from Extension in Extuse like:
case AVK_3:
if( ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_EXTENSION_CLS, (void **)&pExtCls) )
return FALSE;
IDISPLAY_ClearScreen(pMe->m_pIDisplay);
IEXTCLS_ND_DisplaySplashScreen(pExtCls);
IDISPLAY_Update(pMe->m_pIDisplay);
IEXTCLS_Release(pExtCls);
return TRUE;
It compiles great and I have it so it happens when the 3 button is pressed. It is the IEXTCLS_ND_DisplaySplashScreen(pExtCls); function. During execution when I press the 3 button, I am getting the Debug information:
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\BREW_Simulator.exe', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\BREWResCore.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\urlmon.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\BREWEncoding.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\GPSServer.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\msvcr71.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\MFC71u.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shell32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\msvcp71.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\winmm.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2_32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2help.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msctf.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\camera.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msacm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\clbcatq.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comres.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\BREW_SimulatorRes.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\mslbui.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\BREW_Tones.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msxml3.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\winhttp.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\mlang.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\Modules\ISmsWmsCdmaSimulation.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\Modules\VirtualIJoystickExtension.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msimg32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\BREW v3_1_4\sdk\bin\Modules\WiFiSimulation.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comdlg32.dll', no matching symbolic information found.
Loaded symbols for 'C:\Program Files\BREW v3_1_4\sdk\examples\Extuse\ExtUse.dll'
Loaded symbols for 'C:\Program Files\BREW v3_1_4\sdk\examples\Extension\Extension.dll'
Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
The thread 0xEAC has exited with code 0 (0x0).
The thread 0xF48 has exited with code -1073741819 (0xC0000005).
The thread 0x9F4 has exited with code -1073741819 (0xC0000005).
The thread 0x33C has exited with code -1073741819 (0xC0000005).
The thread 0xF20 has exited with code -1073741819 (0xC0000005).
The program 'C:\Program Files\BREW v3_1_4\sdk\bin\BREW_Simulator.exe' has exited with code -1073741819 (0xC0000005).
Inside of the Extension, the function is like:
static void ND_DisplaySplashScreen(IExtensionCls* po)
{
ExtensionCls* pApp = (ExtensionCls*) po;
IImage* pSplash = NULL;
AEEImageInfo rImageInfo;
if((pSplash = ISHELL_LoadResImage( pApp->m_pIShell, NETDIAGNOSTICS_RES_FILE, IDB_SPLASH)) != NULL)
{
// Get image information
IIMAGE_GetInfo(pSplash, &rImageInfo);
// Clear Device screen
IDISPLAY_ClearScreen(pApp->m_pIDisplay);
// Draw the image in the center of the screen
IIMAGE_Draw(pSplash, (pApp->m_rc.dx/2) - (rImageInfo.cx/2), (pApp->m_rc.dy/2) - (rImageInfo.cy/2));
// The image is no longer needed so release it
IIMAGE_Release(pSplash);
// Set the callback timer
ISHELL_SetTimer( pApp->m_pIShell, SPLASH_TIMER_DURATION, (PFNNOTIFY)ND_DisplaySplashScreenCB, pApp);
// Update Display
IDISPLAY_Update(pApp->m_pIDisplay);
return;
}
else
{
ND_GoTo( po, JUMP_MAIN );
}

I know that this function is expecting an IExtensionCls pointer, but I can not make that in Extuse. The function is all setup to work & everything with declared inside of the:
QINTERFACE(IExtensionCls)
{
DECLARE_IBASE(IExtensionCls)
void (*ND_DisplaySplashScreen)(IExtensionCls * po);

And I got the function linked like:
#define IEXTCLS_ND_DisplaySplashScreen(p) GET_PVTBL(p,IExtensionCls)->ND_DisplaySplashScreen(p)
Also, I try to cast the ExtCls* into an IExtCls* like:
case AVK_3:
if( ISHELL_CreateInstance(pMe->m_pIShell, AEECLSID_EXTENSION_CLS, (void **)&pExtCls) )
return FALSE;
IDISPLAY_ClearScreen(pMe->m_pIDisplay);
IEXTCLS_ND_DisplaySplashScreen((IExtensionCls*)pExtCls);
IDISPLAY_Update(pMe->m_pIDisplay);
IEXTCLS_Release(pExtCls);
return TRUE;
But, that does not do much help for me. If anyone got any suggestions or insults, I would gladly appreciate it.
Thanks,
Adam

UnDeCrYpToNiZeD wrote:I was wondering why there are no practical examples for extensions. There are tons of programs and those are a great place to start making a new program, but there are no extensions examples that use much of anything except displaying hello on the screen. Maybe there are some practical extension examples but I have no found them. Does anyone know where to find any?
Thanks,
Adam :eek:
There is really not that much to it. Once you have the skeleton set
up like the SDK example you simply add the functions you need.
There are also lots of comments in the sample code itself about
setting up the functions.

UnDeCrYpToNiZeD wrote:I was wondering why there are no practical examples for extensions. There are tons of programs and those are a great place to start making a new program, but there are no extensions examples that use much of anything except displaying hello on the screen. Maybe there are some practical extension examples but I have no found them. Does anyone know where to find any?
Thanks,
Adam :eek:
There is really not that much to it. Once you have the skeleton set
up like the SDK example you simply add the functions you need.
There are also lots of comments in the sample code itself about
setting up the functions.

jmiller2 wrote:There is really not that much to it. Once you have the skeleton set
up like the SDK example you simply add the functions you need.
There are also lots of comments in the sample code itself about
setting up the functions.
True. I figured most of it out.
Say, that I need an instance of the IWeb or IFile. Where am I supposed to make it? Am I supposed to instantiate them in the Extuse and pass a pointers to them into the Extuse functions? Or, do I instantiate them in the Extension itself?
Thanks

jmiller2 wrote:There is really not that much to it. Once you have the skeleton set
up like the SDK example you simply add the functions you need.
There are also lots of comments in the sample code itself about
setting up the functions.
True. I figured most of it out.
Say, that I need an instance of the IWeb or IFile. Where am I supposed to make it? Am I supposed to instantiate them in the Extuse and pass a pointers to them into the Extuse functions? Or, do I instantiate them in the Extension itself?
Thanks

Aha... I did it!!!! I just made all the instances of the interfaces like IFile, IWeb, etc... inside of the Extuse and made a create(pExtCls, pIFile, pIWeb) inside of Extension that assigns pExtCls->pIFile=pIFile, pExtCls->pIWeb=pIWeb.
Does anyone know where the interfaces will be freed? Should I free the interface pIFile inside of the Extuse or free pExtCls->pIFile inside of the extension?
Thanks for your wisdom JMiller :D
Best,
Adam

Aha... I did it!!!! I just made all the instances of the interfaces like IFile, IWeb, etc... inside of the Extuse and made a create(pExtCls, pIFile, pIWeb) inside of Extension that assigns pExtCls->pIFile=pIFile, pExtCls->pIWeb=pIWeb.
Does anyone know where the interfaces will be freed? Should I free the interface pIFile inside of the Extuse or free pExtCls->pIFile inside of the extension?
Thanks for your wisdom JMiller :D
Best,
Adam

UnDeCrYpToNiZeD wrote:Aha... I did it!!!! I just made all the instances of the interfaces like IFile, IWeb, etc... inside of the Extuse and made a create(pExtCls, pIFile, pIWeb) inside of Extension that assigns pExtCls->pIFile=pIFile, pExtCls->pIWeb=pIWeb.
Does anyone know where the interfaces will be freed? Should I free the interface pIFile inside of the Extuse or free pExtCls->pIFile inside of the extension?
Thanks for your wisdom JMiller :D
Best,
Adam
You are welcome.
It depends when you think the user of the extension will want them freed.
I free mine in the Release function of the Interface. If you think about
how the existing BREW interfaces work, it will give you an idea of
what to do in yours. In general, if you allocate it, then you will want to
free it. And you will want to pay attention to the order the user calls
your methods, so that memory is not fragmented. (In my case I offered to let
the user allocate any large buffers themself as that gives them
total control over using any buffers they set up earlier).
You should note that your extension runs in
the context of the using app, so things like FileIO will go on in the using
apps directory. Also the using app needs to have the correct permissions
(File, Web, etc) or it will not work with your extension.

UnDeCrYpToNiZeD wrote:Aha... I did it!!!! I just made all the instances of the interfaces like IFile, IWeb, etc... inside of the Extuse and made a create(pExtCls, pIFile, pIWeb) inside of Extension that assigns pExtCls->pIFile=pIFile, pExtCls->pIWeb=pIWeb.
Does anyone know where the interfaces will be freed? Should I free the interface pIFile inside of the Extuse or free pExtCls->pIFile inside of the extension?
Thanks for your wisdom JMiller :D
Best,
Adam
You are welcome.
It depends when you think the user of the extension will want them freed.
I free mine in the Release function of the Interface. If you think about
how the existing BREW interfaces work, it will give you an idea of
what to do in yours. In general, if you allocate it, then you will want to
free it. And you will want to pay attention to the order the user calls
your methods, so that memory is not fragmented. (In my case I offered to let
the user allocate any large buffers themself as that gives them
total control over using any buffers they set up earlier).
You should note that your extension runs in
the context of the using app, so things like FileIO will go on in the using
apps directory. Also the using app needs to have the correct permissions
(File, Web, etc) or it will not work with your extension.

Hey, thanks again for the help above. I got the freeing memory issue solved. This file business ain't working out so good though.
OK, I checked the Extuse MIF file & I have FILE permission on.
I have a test.txt inside of the extuse. The program compiles with 0 errors/warnings. The IFileMgr was instantiated appropriately. I don't believe that I can instantions the IFile. I did it like this:
//This is in extension
static int assignObjectPointers(IExtensionCls * po, IFile * pIFile, IFileMgr * pIFileMgr)
{
ExtensionCls * pMe = (ExtensionCls *) po;
if( !pMe || !pMe->m_pIDisplay )
return EFAILED;
if( !(pMe->m_pIFile = pIFile) )
return EFAILED;
if( !(pMe->m_pIFileMgr = pIFileMgr) )
return EFAILED;
return AEE_SUCCESS;
}
//This is in Extuse
EXT_assignObjectPointers(pExtCls, pIFile, pIFileMgr);
But, when I try to open a file from within a function in the extension while using Extuse like:
if ( NULL == (pMe->m_pIFile = IFILEMGR_OpenFile( pMe->m_pIFileMgr, "data.txt", _OFM_READ ) ) )
return EFAILED;
the emulator crashes :confused: .
In the Debugger, it says that the value of pMe->m_pIFileMgr = 0x00000000 and the same for pMe->m_pIFile. Does this mean that pMe->m_pIFileMgr in Extension is not getting assigned the value of pIFileMgr from Extuse?
It defianetely is the Extension class values getting assigned the values correctly because the:
if ( NULL == (pIFile = IFILEMGR_OpenFile( pIFileMgr, "data.txt", _OFM_READ ) ) )
return EFAILED;
works perfect from inside of Extuse.
Thanks,
Adam

Hey, thanks again for the help above. I got the freeing memory issue solved. This file business ain't working out so good though.
OK, I checked the Extuse MIF file & I have FILE permission on.
I have a test.txt inside of the extuse. The program compiles with 0 errors/warnings. The IFileMgr was instantiated appropriately. I don't believe that I can instantions the IFile. I did it like this:
//This is in extension
static int assignObjectPointers(IExtensionCls * po, IFile * pIFile, IFileMgr * pIFileMgr)
{
ExtensionCls * pMe = (ExtensionCls *) po;
if( !pMe || !pMe->m_pIDisplay )
return EFAILED;
if( !(pMe->m_pIFile = pIFile) )
return EFAILED;
if( !(pMe->m_pIFileMgr = pIFileMgr) )
return EFAILED;
return AEE_SUCCESS;
}
//This is in Extuse
EXT_assignObjectPointers(pExtCls, pIFile, pIFileMgr);
But, when I try to open a file from within a function in the extension while using Extuse like:
if ( NULL == (pMe->m_pIFile = IFILEMGR_OpenFile( pMe->m_pIFileMgr, "data.txt", _OFM_READ ) ) )
return EFAILED;
the emulator crashes :confused: .
In the Debugger, it says that the value of pMe->m_pIFileMgr = 0x00000000 and the same for pMe->m_pIFile. Does this mean that pMe->m_pIFileMgr in Extension is not getting assigned the value of pIFileMgr from Extuse?
It defianetely is the Extension class values getting assigned the values correctly because the:
if ( NULL == (pIFile = IFILEMGR_OpenFile( pIFileMgr, "data.txt", _OFM_READ ) ) )
return EFAILED;
works perfect from inside of Extuse.
Thanks,
Adam

UnDeCrYpToNiZeD wrote:In the Debugger, it says that the value of pMe->m_pIFileMgr = 0x00000000 and the same for pMe->m_pIFile. Does this mean that pMe->m_pIFileMgr in Extension is not getting assigned the value of pIFileMgr from Extuse?
My guess is you are getting your pMe pointers confused.
I am confused about what you are trying to accomplish here.
The file manager and file interfaces should be instantiated in
the extension if the extension is using them internally only.
It looks like you are trying to instantiate them in the extension and
then use them in the use applet. I can't think why one would want to
do that. Its not a good design (no offense). If the extension is
going to operate on a file then it should instantiate the interfaces,
open the file(s), operate on them, close the file(s) and release the interfaces.
It is best to instantiate the extension's needed interfaces in the New
funtion, that is called by the extensions AEEClsCreateInstance,
unless the interface is only needed short term.

UnDeCrYpToNiZeD wrote:In the Debugger, it says that the value of pMe->m_pIFileMgr = 0x00000000 and the same for pMe->m_pIFile. Does this mean that pMe->m_pIFileMgr in Extension is not getting assigned the value of pIFileMgr from Extuse?
My guess is you are getting your pMe pointers confused.
I am confused about what you are trying to accomplish here.
The file manager and file interfaces should be instantiated in
the extension if the extension is using them internally only.
It looks like you are trying to instantiate them in the extension and
then use them in the use applet. I can't think why one would want to
do that. Its not a good design (no offense). If the extension is
going to operate on a file then it should instantiate the interfaces,
open the file(s), operate on them, close the file(s) and release the interfaces.
It is best to instantiate the extension's needed interfaces in the New
funtion, that is called by the extensions AEEClsCreateInstance,
unless the interface is only needed short term.

Ok,
I figured it out & it is working. I am instantiating the interfaces in the Extuse for now and pointing the extension class pointers to it and it is working well. I think that I have to do it in the Extuse because I have several functions that will be working with the same interface.
So, I think that I am good for now. All I have to do is fill in the guts for the 40 functions that I am making for this API that I am creating. The ND functions are working in a seperate extension that I made for reference.
It was tough at first, but it is actually really simple after figuring it out. BREW is actually a very nice programming environment!
Thanks,
Adam

Ok,
I figured it out & it is working. I am instantiating the interfaces in the Extuse for now and pointing the extension class pointers to it and it is working well. I think that I have to do it in the Extuse because I have several functions that will be working with the same interface.
So, I think that I am good for now. All I have to do is fill in the guts for the 40 functions that I am making for this API that I am creating. The ND functions are working in a seperate extension that I made for reference.
It was tough at first, but it is actually really simple after figuring it out. BREW is actually a very nice programming environment!
Thanks,
Adam