델파이 참고예제는 많은데 C++예제는 찾기 힘들어 델파이 예제와 C++예제를 짜 맞추었습니다.
RAD 특히 C++로 앱하나 완성하기가 쉬우면서도 쉽지 않는 부분들이 산재하네요.
이틀 동안 고생을 해서 이런 고생은 다른 사람은 안 했으면해서.....
먼저, 폼 생성시점에 파란색 코드를 그냥 복사하면 됩니다.
void __fastcall TTeleManForm::FormCreate(TObject *Sender)
{
TGUID guid = StringToGUID("{F3AAF11A-1678-4CC6-A5BF-721A24A676FD}"); // GUID
IInterface *AEventSvc;
if (TPlatformServices::Current->SupportsPlatformService(guid)) {
AEventSvc = TPlatformServices::Current->GetPlatformService(guid);
IFMXApplicationEventService *EventSvc;
AEventSvc->QueryInterface(guid,(void**)(&EventSvc));
EventSvc-> SetApplicationEventHandler( AppEventHandler);
EventSvc->Release();
}
// Ur Code!
}
이벤트 받을 함수.....
// ---------------------------------------------------------------------------
bool __fastcall TTeleManForm::AppEventHandler(TApplicationEvent AAppEvent,TObject *AContext)
{
// 앱상태가 바뀌면 AAppEvent에서 앱의 상태를 받을 수 있습니다.
return(true);
}
|