Exemplo n.º 1
0
/////////////////////////////////////////////////////////////////////////////
// ObjectARX EntryPoint
extern "C" AcRx::AppRetCode 
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
{
	AcRxDynamicLinker *pLinker = acrxDynamicLinker;
	switch (msg) {
	case AcRx::kInitAppMsg:
		// Comment out the following line if your
		// application should be locked into memory
		pLinker->unlockApplication(pkt);
		pLinker->registerAppMDIAware(pkt);
		// check if the arx app is loaded or not.
		// if not, load it as UI so that we won't have
		// proxy if this dll is unloaded by OS
		if (!isModuleLoaded("AsdkSmileyDb.dbx"))
		{
			if (!pLinker->loadModule("AsdkSmileyDb.dbx", false, true))
				return AcRx::kRetError;
		}
		// bump the reference count 
		pLinker->loadModule("AsdkSmileyDb.dbx", false, false);
		InitApplication();
		break;
	case AcRx::kUnloadAppMsg:
		pLinker->unloadModule("AsdkSmileyDb.dbx");
		UnloadApplication();
		break;
	}
	return AcRx::kRetOK;
}
Exemplo n.º 2
0
BOOL WinParent::Init(HINSTANCE hInstance, int nCmdShow)
{
	// Save the application-instance handle. 
	m_hInstance = hInstance;

	return ( InitApplication() && InitInstance(nCmdShow) );
}
Exemplo n.º 3
0
/////////////////////////////////////////////////////////////////////////////
// ObjectARX EntryPoint
extern "C" AcRx::AppRetCode 
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
{
	switch (msg) {
	case AcRx::kInitAppMsg:
		// Comment out the following line if your
		// application should be locked into memory
		acrxDynamicLinker->unlockApplication(pkt);
		acrxDynamicLinker->registerAppMDIAware(pkt);
		InitApplication();
		break;
	case AcRx::kUnloadAppMsg:
		UnloadApplication();
		break;

		// add or remove items to/from document status 
		// bar here because all databases are active at this point. 
	case AcRx::kLoadDwgMsg:
		//CreateDocumentWorkspace(curDoc());
		break;
	case AcRx::kUnloadDwgMsg:
		//DestroyDocumentWorkspace(curDoc());
		break;
	}
	return AcRx::kRetOK;
}
Exemplo n.º 4
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    MSG msg;

//	if (CheckAvailableIOCP())
//	{
		if (!InitApplication(hInstance))
			return (FALSE);

		if (!InitInstance(hInstance, nCmdShow))
			return (FALSE);

		while (GetMessage(&msg, NULL, 0, 0))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
/*	}
	else
	{
		TCHAR szMsg[1024];

		LoadString(hInstance, IDS_NOTWINNT, szMsg, sizeof(szMsg));
		MessageBox(NULL, szMsg, _LOGINGATE_SERVER_TITLE, MB_OK|MB_ICONINFORMATION);
		
		return -1;
	}
*/
    return (msg.wParam);
}
Exemplo n.º 5
0
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                     LPSTR lpCmdLine, int nCmdShow)
{
    MSG msg;
    HANDLE hAccelTable;

    if (!InitApplication(hInstance))
    {
        return (FALSE);
    }

    if (!InitInstance(hInstance, nCmdShow))
    {
        return (FALSE);
    }

    StartTimer();

    hAccelTable = LoadAccelerators (hInstance, MAKEINTRESOURCE(IDR_GENERIC));

    while (GetMessage(&msg, NULL, 0, 0))
    {
        if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    StopTimer();

    return (msg.wParam); /* Returns the value from PostQuitMessage */
}
Exemplo n.º 6
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInst*/, LPSTR /*lpszCmdParam*/, int nCmdShow) 
{
	MSG msg;
	HACCEL hAccel = AtlLoadAccelerators(IDR_ACCELERATOR1);
	if (!LoadLibrary("RICHED32.DLL"))
	{
		MessageBox(nullptr, "Could not load RICHED32.DLL", nullptr, MB_OK);
		return (FALSE);
	}

	if (!InitApplication(hInstance)) 
	{
		MessageBox(nullptr, "Could not initialize application", nullptr, MB_OK);
		return (FALSE);
	}

	if (!InitInstance(hInstance, nCmdShow)) 
	{
		MessageBox(nullptr, "Could not create window", nullptr, MB_OK);
		return (FALSE);
	}

	// message loop
	while (GetMessage(&msg, nullptr, 0, 0))
	{
		if (!TranslateAccelerator(hwnd_main,hAccel,&msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	} // while(GetMessage...
	
	return static_cast<int>(msg.wParam);
} // WinMain
Exemplo n.º 7
0
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
    MSG msg;
    HANDLE hAccelTable;
   
    if(!hPrevInst)
    {
        if(!InitApplication(hInst))
            return FALSE;
    }

    if(!InitInstance(hInst, nCmdShow))
        return FALSE;

    hAccelTable = LoadAcceleratorsW(hInst, MAKEINTRESOURCEW(IDA_OLEVIEW));

    while(GetMessageW(&msg, NULL, 0, 0))
    {
        if(TranslateAcceleratorW(globals.hMainWnd, hAccelTable, &msg)) continue;

        TranslateMessage(&msg);
        DispatchMessageW(&msg);
    }

    return msg.wParam;
}
/* ************************************
* WinMain
* 功能 程序入口点,调用InitApplication,InitInstance
* 消息循环
* 参数 hinstance,应用程序本次运行实例
* hPrevInstance,应用程序之前的实例,始终为NULL
* lpCmdLine,命令行参数
* nCmdShow,如果窗口,SW_SHOW
* 返回值 失败返回FALSE
**************************************/
int WINAPI WinMain(
				   HINSTANCE hinstance,
				   HINSTANCE hPrevInstance,
				   LPSTR lpCmdLine,
				   int nCmdShow)
{
	MSG msg;
	BOOL fGotMessage;
	// InitApplication
	if (!InitApplication(hinstance))
	{
		return FALSE;
	}
	// InitInstance
	if (!InitInstance(hinstance, nCmdShow))
	{
		return FALSE;
	}
	// 消息循环
	while ((fGotMessage = GetMessage(&msg, (HWND) NULL, 0, 0)) != 0 && fGotMessage != -1)
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return msg.wParam;
	UNREFERENCED_PARAMETER(lpCmdLine);
}
/*************************************
* WinMain
**************************************/
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
				   LPSTR lpCmdLine, int nCmdShow)
{
	MSG msg;
	BOOL fGotMessage;
	if (!InitApplication(hinstance))
		return 1;

	if (!InitInstance(hinstance, nCmdShow))
		return 1;

	if(!DoRegisterDeviceInterface( GUID_DEVINTERFACE_DISK, &hDevNotify ))
		// GUID_DEVINTERFACE_MEDIUMCHANGER
		// GUID_DEVINTERFACE_VOLUME
		// GUID_DEVINTERFACE_STORAGEPORT
		// ……

	{
		return 1;
	}

	while ((fGotMessage = GetMessage(&msg, (HWND) NULL, 0, 0)) != 0 && fGotMessage != -1)
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return msg.wParam;
	UNREFERENCED_PARAMETER(lpCmdLine);
}
Exemplo n.º 10
0
int PASCAL WinMain(HANDLE hInstance,       /* current instance  */
               HANDLE hPrevInstance,       /* current instance  */
               LPSTR  lpCmdLine,           /* command line             */
               int    nCmdShow)        /* show-window type (open/icon) */
{
    MSG msg;                     /* message              */

    if (!hPrevInstance)          /* Other instances of app running? */
       if (!InitApplication(hInstance)) /* Initialize shared things */
          return (FALSE);      /* Exits if unable to initialize     */

    /* Perform initializations that apply to a specific instance
     */

    if (!InitInstance(hInstance, lpCmdLine, nCmdShow))
        return (FALSE);

    /* Acquire and dispatch messages until a WM_QUIT message is received.
     */

    while (GetMessage(&msg,    /* message structure              */
        (HWND) NULL,   /* handle of window receiving the message */
        0,             /* lowest message to examine          */
        0))            /* highest message to examine         */
    {
       TranslateMessage(&msg);    /* Translates virtual key codes    */
       DispatchMessage(&msg);     /* Dispatches message to window    */
    }

    return (msg.wParam);       /* Returns the value from PostQuitMessage */
} // WinMain
Exemplo n.º 11
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
	MSG msg;
//	HANDLE hAccelTable;
    BOOL fActivated;

	SetUnhandledExceptionFilter(&MyExceptionFilter);

	hInst = hInstance;
    if(FAILED(ActivatePreviousInstance(szAppName, NULL, &fActivated)) || fActivated)
        return 0;

	InitCommonControls();

	if (!InitApplication())
		return 0;
//	hAccelTable = LoadAccelerators(hInst,MAKEINTRESOURCE(IDACCEL));
	if ((hwndMain = CreateboxworldWndClassWnd()) == (HWND)0)
		return 0;
	ShowWindow(hwndMain, nCmdShow);
	UpdateWindow(hwndMain);
	while (GetMessage(&msg,NULL,0,0)) {
//		if (!TranslateAccelerator(msg.hwnd,hAccelTable,&msg)) {
			TranslateMessage(&msg);
			DispatchMessage(&msg);
//		}
	}
	return msg.wParam;
}
Exemplo n.º 12
0
	// ----- zhfzhftool._dttk command (do not rename)
	static void zhfzhftool_dttk(void)
	{
		// Add your code for command zhfzhftool._dttk here
		if (g_bIsTukuFirst)
		{
			InitApplication() ;
		}
		else
		{
			CMDIFrameWnd* pAcadFrame  = acedGetAcadFrame();

			if (g_pArrayZhfPaletteSet.GetCount()>1)
			{
				CZhfPaletteSet* pSet = g_pArrayZhfPaletteSet.GetAt(1) ;
				if (pSet->IsWindowVisible())
				{
					pAcadFrame->ShowControlBar(pSet, FALSE, FALSE);
				}
				else
				{
					pAcadFrame->ShowControlBar(pSet, TRUE, FALSE);
				}	
			}
			else
			{
				acutPrintf(_T("\n图库面板没有创建或创建失败,无法显示!")) ;
			}
		}
	}
/****************************************************************************
*
*     FUNCTION: WinMain
*
*     PURPOSE:  Main entry point for this app
*
*     PARAMS:   HANDLE hInstance     - This instance
*               HANDLE hPrevInstance - Previous instance
*               LPSTR  lpszCmdLine   - Command Line
*               int    nCmdShow      - Desired window status
*
*     RETURNS:  int - return code
*
* History:
*                July '95 - Created
*
\****************************************************************************/
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
    MSG msg;

    // standard init stuff
    if( ! hPrevInstance )
    {
        if( ! InitApplication( hInstance ) )
        {
            return FALSE;
        }
    }
    if( ! InitInstance( hInstance, nCmdShow ) )
    {
        return FALSE;
    }

    // Standard message loop
    while (GetMessage(&msg, (HWND) NULL, 0, 0)) 
    {
        if( !TranslateMDISysAccel(hMDIClientWnd, &msg) )
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
    return msg.wParam;
}
Exemplo n.º 14
0
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
    MSG msg;

    /* Other instances of app running? */
    if (!hPrevInstance)
    {
      /* stuff to be done once */
      if (!InitApplication(hInstance))
      {
        return FALSE;      /* exit */
      }
    }

    /* stuff to be done every time */
    if (!InitInstance(hInstance, nCmdShow))
    {
      return FALSE;
    }

    HandleCommandLine(lpCmdLine);

    /* Main loop */
    /* Acquire and dispatch messages until a WM_QUIT message is received */
    while (GetMessageW(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessageW(&msg);
    }

    return msg.wParam;
}
Exemplo n.º 15
0
int CreateWindows()
{ 
    if (!InitApplication(NULL)) 
        return FALSE; 
 
    if (!InitInstance(NULL, TRUE)) 
        return FALSE; 
 
    // register the video window class
    WNDCLASSEX wcx; 
 
    wcx.cbSize = sizeof(wcx);          // size of structure 
    wcx.style = 0;                     // redraw if size changes 
    wcx.lpfnWndProc = MainWndProc;     // points to window procedure 
    wcx.cbClsExtra = 0;                // no extra class memory 
    wcx.cbWndExtra = 0;                // no extra window memory 
    wcx.hInstance = NULL;              // handle to instance 
    wcx.hIcon = LoadIcon(NULL, 
        IDI_APPLICATION);              // predefined app. icon 
    wcx.hCursor = LoadCursor(NULL, 
        IDC_ARROW);                    // predefined arrow 
    wcx.hbrBackground = (HBRUSH)GetStockObject( 
        BLACK_BRUSH);                  // black background brush 
    wcx.lpszMenuName =  NULL;          // name of menu resource 
    wcx.lpszClassName = "PlaceCallVideoClass";  // name of window class 
    wcx.hIconSm = NULL;
    ATOM x = RegisterClassEx(&wcx);
    // create the Preview Window and the Video Window
    HWND hPreview = createPreviewWindow(hMain);
    HWND hVideo = createVideoWindow(hMain);
        
    return 0; 
} 
Exemplo n.º 16
0
bool init_gui(HINSTANCE hInstance, HINSTANCE hPrevInstance, int nShowCmd) {
  if (!InitApplication(hInstance)) {
    return false;
  }
  if (!InitInstance(hInstance, nShowCmd)) {
    return false;
  }
  return true;
}
Exemplo n.º 17
0
static BOOL init_windows(HINSTANCE hInstance, int nShowCmd) {
    if (!InitApplication(hInstance)) {
        return FALSE;
    }
    if (!InitInstance(hInstance, nShowCmd)) {
        return FALSE;
    }
    return TRUE;
}
Exemplo n.º 18
0
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
                     LPSTR /*lpCmdLine*/, int nCmdShow) {
    sprintf(szAppClass, "GameServer%d", (int) hInstance);
    if (!InitApplication(hInstance)) return (false);
    if (!InitInstance(hInstance, nCmdShow)) return (false);

    Initialize();
    EventLoop();
    return 0;
}
Exemplo n.º 19
0
BOOL AppInit (HINSTANCE hInstance,
				  HINSTANCE hPrevInstance,
				  int nCmdShow)
{
  if (!hPrevInstance) {
	 if (!InitApplication (hInstance, szAppName, szChildName))
		return FALSE;
  }
  return InitInstance (hInstance, szAppName, nCmdShow);
}
Exemplo n.º 20
0
main(int argc, char *argv[], char *envp[])
{
  HAB hab;
  HMQ hmq;
  QMSG qmsg;
  char  szBuf[MAX_BUF];
  ATOM atom;

  hab = WinInitialize( 0 );
  hmq = WinCreateMsgQueue( hab, 0 );

  atom = WinAddAtom(WinQuerySystemAtomTable(), CLASS_NAME);

  if(Initialize(0, argv[0]))
  {
    WinPostQueueMsg(0, WM_QUIT, 1, 0);
  }
  else if(!InitApplication(0))
  {
    char szEFailed[MAX_BUF];

    if(NS_LoadString(0, IDS_ERROR_FAILED, szEFailed, MAX_BUF) == WIZ_OK)
    {
      sprintf(szBuf, szEFailed, "InitApplication().");
      PrintError(szBuf, ERROR_CODE_SHOW);
    }
    WinPostQueueMsg(0, WM_QUIT, 1, 0);
  }
  else if(ParseUninstallIni(argc, argv))
  {
    WinPostQueueMsg(0, WM_QUIT, 1, 0);
  }
  else if(ugUninstall.bUninstallFiles == TRUE)
  {
    if(diUninstall.bShowDialog == TRUE)
      hDlgUninstall = InstantiateDialog(hWndMain, DLG_UNINSTALL, diUninstall.szTitle, DlgProcUninstall);
    else
      ParseAllUninstallLogs();
  }

  if((ugUninstall.bUninstallFiles == TRUE) && (diUninstall.bShowDialog == TRUE))
  {
    while ( WinGetMsg( hab, &qmsg, NULLHANDLE, 0, 0 ) )
      WinDispatchMsg( hab, &qmsg );
  }

  /* Do clean up before exiting from the application */
  DeInitialize();

  WinDeleteAtom(WinQuerySystemAtomTable(), atom);

  WinDestroyMsgQueue( hmq );
  WinTerminate( hab ); 

}
Exemplo n.º 21
0
/* Initializes instances, creating and displaying their main window
   (calls InitApplication for the first executing instance; calls
   InitInstance for all instances).Runs the application. Enters message
   loop if initialization was successful. */
void TApplication::Run()
{
  if ( !hPrevInstance )
    InitApplication();
  if (Status == 0 )
    InitInstance();
  if (Status == 0)
    MessageLoop();
  else
    Error(Status);
}
Exemplo n.º 22
0
/*------------------------------------------------------------------------
Procedure:     Setup ID:1
Purpose:       Handles GUI initialization (Fonts, brushes, colors,
etc)
Input:
Output:
Errors:
------------------------------------------------------------------------*/
static int Setup(HANDLE *phAccelTable)
{
	if (!InitApplication())
		return 0;
	ProgramParams.hFont = CreationCourier(1);
	ProgramParams.TextColor = RGB(0,0,0);
	GetObject(ProgramParams.hFont,sizeof(LOGFONT),&CurrentFont);
	BackgroundBrush = CreateSolidBrush(BackColor);
	*phAccelTable = LoadAccelerators(hInst,MAKEINTRESOURCE(IDACCEL));
	return 1;
}
Exemplo n.º 23
0
int APIENTRY WinMain(
               HINSTANCE hInstance,
               HINSTANCE hPrevInstance,
               LPSTR lpCmdLine,
               int nCmdShow
               )
{
   MSG msg;
   HANDLE hAccelTable;

   // Other instances of app running?
   if (!hPrevInstance) {
      // Initialize shared things
      if (!InitApplication(hInstance)) {
         return (FALSE);               // Exits if unable to initialize
      }
   }

   // Perform initializations that apply to a specific instance
   if (!InitInstance(hInstance, nCmdShow)) {
      return (FALSE);
   }

//****************** NEW CODE START *********

   Sample_Init ( );

//****************** NEW CODE END *********

   hAccelTable = LoadAccelerators (hInstance, szAppName);

   // Acquire and dispatch messages until a WM_QUIT message is received.
   while (GetMessage(&msg,   // message structure
                     NULL,   // handle of window receiving the message
                     0,      // lowest message to examine
                     0)){    // highest message to examine
       if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg)) {
         TranslateMessage(&msg);// Translates virtual key codes
         DispatchMessage(&msg); // Dispatches message to window
       }
   }

//****************** NEW CODE START *********

   Sample_Shutdown ( );

//****************** NEW CODE END *********

   // Returns the value from PostQuitMessage
   return (msg.wParam);

   // This will prevent 'unused formal parameter' warnings
   lpCmdLine;
}
Exemplo n.º 24
0
BOOL AppInit (HINSTANCE hInstance,
				  HINSTANCE hPrevInstance,
				  int nCmdShow)
{
  static char szAppName [] = "Clover";

  if (!hPrevInstance) {
	 if (!InitApplication (hInstance, szAppName))
		return FALSE;
  }
  return InitInstance (hInstance, szAppName, nCmdShow);
}
Exemplo n.º 25
0
//=============================================================================
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
               LPSTR lpCmdLine, int nCmdShow )
{
	LogMsg.CurMsg = MAXLOGMSGS-1;
	sprintf( szAppClass, "GameServer%d", hInstance);
	if (!InitApplication( hInstance))		return (FALSE);
    if (!InitInstance(hInstance, nCmdShow)) return (FALSE);

	Initialize();
	EventLoop();
    return 0;
}
Exemplo n.º 26
0
/*----------------------------------------------------------------------------------------------
 * 函数:    InitFamesOS()
 *
 * 说明:    初始化FamesOS
 *
 * 备注:    下面3个函数都由main()函数调用, 应用程序不可调用
**--------------------------------------------------------------------------------------------*/
void apical InitFamesOS(void)
{
    CALLED_ONLY_ONCE();
    FamesOSStarted=NO;
    InitializeOnExit(); /* should call this before others */
    InitMemService();
    InitIrqManager();
    InitTasks(); 
    InitSwitch();
    InitTimeTick();
    InitApplication();
}
Exemplo n.º 27
0
extern "C" int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR pszCmdLineA, int nCmdShow)
{
   LPTSTR pszCmdLine = AnsiToString (pszCmdLineA);

   if (InitApplication (hInst, pszCmdLine, nCmdShow))
      {
      AfsAppLib_MainPump();
      }
   ExitApplication();

   FreeString (pszCmdLine, pszCmdLineA);
   return g.rc;
}
Exemplo n.º 28
0
int APIENTRY WinMain (HINSTANCE hInstance,
	HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
	if (! hPrevInstance)
		if (! InitApplication (hInstance))
			return 0;
	if (! InitInstance (hInstance, nCmdShow))
		return 0;
	MSG msg = {0};
	while (GetMessage (&msg, NULL, 0, 0)) {
		TranslateMessage (&msg);
		DispatchMessage (&msg);
	}
	return msg.wParam;
}
Exemplo n.º 29
0
void Java_com_dava_framework_JNIApplication_OnCreateApplication(JNIEnv* env, jobject classthis, jstring path, jstring apppath, jstring logTag, jstring packageName)
{
	bool retCreateLogTag = CreateStringFromJni(env, logTag, androidLogTag);
//	LOGI("___ OnCreateApplication __ %d", classthis);

	bool retCreatedDocuments = CreateStringFromJni(env, path, documentsFolderPath);
	bool retCreatedAssets = CreateStringFromJni(env, apppath, assetsFolderPath);
	bool retCreatePackageName = CreateStringFromJni(env, packageName, androidPackageName);

	InitApplication(env);
	if(androidDelegate)
	{
		androidDelegate->SetApplication(classthis, androidPackageName);
	}
}
Exemplo n.º 30
0
int main(int argc, char * argv[])
{
	uv_signal_t signals;
	uv_signal_init(uv_default_loop(), &signals);
	uv_signal_start(&signals, &_SignalFunc, SIGINT);
	int hInstance = 0; // TODO: getpid?
	sprintf( szAppClass, "Gate-Server%d", hInstance);
	if (!InitApplication( hInstance))		return (false);
    if (!InitInstance()) return (false);
	
	Initialize();
	EventLoop();

    return 0;
}