Hi
thanks for the advice, I have indeed read a lot about the basics of C++. Maybe you don't remember your own beginnings, but the things that seem natural are not always in the basics tutorial we have and even in the books.
For making it short, here is the only implementation that works for me:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
// SilverlightSample.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "pwinuser.h"
#include "xamlruntime.h"
#include "xrdelegate.h"
#include "xrptr.h"
#include "resource.h"
#include "shellapi.h"
//#include "OpenCloseApp.h"
//using namespace OPEN;
class BtnEventHandler
{
public:
OpenCloseApp *OpenMyApp; // first, 2nd and 3rd error
public:
HRESULT OnClick(IXRDependencyObject* source,XRMouseButtonEventArgs* args)
{
BSTR pName;
source->GetName(&pName);
if (_tcscmp(L"But1", LPCWSTR(pName)) == 0)
{
OpenMyApp->OpenAppl(L"\\Storage Card\\solitare.exe"); // 4th and 5th error
}
else if (_tcscmp(L"But2", LPCWSTR(pName)) == 0)
{
MessageBox(NULL,TEXT("Radio!!"),TEXT("Silverlight for Embedded test"),MB_OK);
}
return S_OK;
}
};
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
blah...blah
return 0;
}
class OpenCloseApp
{
public:
void OpenAppl (LPCWSTR pathToOpen);
};
void OpenCloseApp::OpenAppl(LPCWSTR pathToOpen)
{
PROCESS_INFORMATION pi;
DWORD dw;
memset(&pi, 0, sizeof(pi));
if(!CreateProcessW(pathToOpen,NULL,NULL,NULL,FALSE, CREATE_NEW_CONSOLE,NULL,NULL,NULL,&pi))
{
MessageBox(NULL,TEXT("Error!!"),TEXT("Windows CE message"),MB_OK);
}
// printf("dw is equal to: %u \n", dw);
dw = GetLastError();
}
|
here are the errors:
1>.\SilverlightSample.cpp(18) : error C2143: syntax error : missing ';' before '*'
1>.\SilverlightSample.cpp(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\SilverlightSample.cpp(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\SilverlightSample.cpp(29) : error C2065: 'OpenMyApp' : undeclared identifier
1>.\SilverlightSample.cpp(29) : error C2227: left of '->OpenAppl' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>Build log was saved at "file://c:\Documents and Settings\nathaniel\My Documents\Visual Studio 2005\Projects\Copy of SilverlightSample\SilverlightSample\SilverlightSample_SDK (ARMV4I)\Debug\BuildLog.htm"
1>SilverlightSample - 5 error(s), 0 warning(s)
If I defined my class at the beginning of the file, I got no errors, and as I pass it at the end, I get all those, and pointer definition doesn't help.
And still, sorry to insist on this, but in fact all my question is how to define the class in another file.cpp that could be reused as library or something like this.
Thank you for your help. Please be indulgent.
Nathaniel