コード例 #1
0
// -----------------------------------------------------------------------
// Initialize Form
int CALLBACK FRMRegsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    int i = 0;

    switch(uMsg)
    {
        case WM_SYSCOLORCHANGE:
            ListViewSetBackColor(FRMRegsListview, GetSysColor(COLOR_WINDOW));
            break;
        case WM_INITDIALOG:
            ControlSetText(hwndDlg, "Register files extensions");
            FRMRegsCmdRegister = CreateButton(256, 1, 77, 23, hwndDlg, "Register", 1, 0, 0, 0, BS_DEFPUSHBUTTON | WS_TABSTOP | WS_GROUP, Buttons_StaticEdge);
            FRMRegsCmdUnRegister = CreateButton(256, 25, 77, 23, hwndDlg, "Unregister", 3, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMRegsCmdCancel = CreateButton(256, 49, 77, 23, hwndDlg, "Cancel", 2, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMRegsCmdSelAll = CreateButton(256, 75, 77, 23, hwndDlg, "Select all", 4, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMRegsCmdUnSelAll = CreateButton(256, 99, 77, 23, hwndDlg, "Unselect all", 5, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMRegsListview = CreateListView(2, 1, 251, 211, hwndDlg, 6, 0, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_LABELTIP, LVS_REPORT | LVS_SINGLESEL | WS_TABSTOP | LVS_NOSORTHEADER, WS_EX_STATICEDGE);
            ListViewAddCol(FRMRegsListview, "Language", 145, 1);
            ListViewAddCol(FRMRegsListview, "Extension", 83, 0);
            FillExtLanguage();
            SetFocus(FRMRegsListview);
            return(0);
        case WM_NOTIFY:
            if(ControlGetNotifiedhWnd(lParam) == FRMRegsListview)
            {
                switch(ControlGetNotifiedMsg(lParam))
                {
                    case NM_DBLCLK:
                        ListViewCheckBoxItemDoubleClick(FRMRegsListview);
                        return(0);
                }
            }
            break;
        case WM_COMMAND:
            if((HWND) lParam == FRMRegsCmdSelAll)
            {
                for(i = 0; i <= (long) ListViewItemCount(FRMRegsListview) - 1; i++)
                {
                    ListViewSetItemCheckbox(FRMRegsListview, i, 1);
                }
                return(0);
            }
            else if((HWND) lParam == FRMRegsCmdUnSelAll)
            {
                for(i = 0; i <= (long) ListViewItemCount(FRMRegsListview) - 1; i++)
                {
                    ListViewSetItemCheckbox(FRMRegsListview, i, 0);
                }
                return(0);
            }
            else if((HWND) lParam == FRMRegsCmdRegister)
            {
                RegisterExtensions();
                SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSHNOWAIT, NULL, NULL);
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMRegsCmdUnRegister)
            {
                UnRegisterExtensions();
                SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSHNOWAIT, NULL, NULL);
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMRegsCmdCancel)
            {
                ControlClose(hwndDlg);
                return(0);
            }
            break;
        case WM_CLOSE:
            EndDialog(hwndDlg, 0);
            break;
    }
    return(0);
}
コード例 #2
0
ファイル: tk_main.cpp プロジェクト: jpbsilva/tk2000
//===========================================================================
int APIENTRY WinMain (HINSTANCE passinstance,
					  HINSTANCE previnstance,
					  LPSTR     lpCmdLine,
					  int       nCmdShow)
{
#ifdef CPUDEBUG
	char nomearq[MAX_PATH];
#endif

	char imagefilename[MAX_PATH];

	// DO ONE-TIME INITIALIZATION
	instance = passinstance;

	// Initialize COM
	CoInitialize( NULL );

	GdiSetBatchLimit(512);
	GetProgramDirectory();
	RegisterExtensions();
	FrameRegisterClass();
	Inicializar1();

	strcpy(imagefilename, progdir);
	strcat(imagefilename, NOMEARQTKDOS);

	if (lpCmdLine[0] != '\0')
	{
		CharLowerBuff(&lpCmdLine[strlen(lpCmdLine)-3],3);
		strcpy(imagefilename, lpCmdLine);
	}

#ifdef CPUDEBUG
	strcpy(nomearq, progdir);
	strcat(nomearq, "debugCPU.txt");
	DeleteFile(nomearq);
	arquivocpu = fopen(nomearq, "wb");
#endif


	do
	{
		// DO INITIALIZATION THAT MUST BE REPEATED FOR A RESTART
		restart = 0;
		mode    = MODE_LOGO;
		LoadConfiguration();
		DebugInitialize();
		JoyInitialize();
		MemInitialize();
		VideoInitialize();
		Timer_InitTimer();

		FrameCreateWindow();
		MemAtualizaSlotAux();

		if (imagefilename[0] != '\0')
		{
			DiskInsert(0, imagefilename, FALSE, FALSE);
			imagefilename[0] = '\0';
		}

		// ENTER THE MAIN MESSAGE LOOP
		EnterMessageLoop();
	}
	while (restart);

#ifdef CPUDEBUG
	//CloseHandle(arquivocpu);
	fclose(arquivocpu);
#endif

	// Release COM
	CoUninitialize();

	return 0;
}
コード例 #3
0
ファイル: AppMain.c プロジェクト: concord-consortium/teemss
/***********************************************************************
 *
 * FUNCTION:		PilotMain
 *
 * DESCRIPTION:	This function is the equivalent of a main() function
 *						in standard ÒCÓ.  It is called by the Emulator to begin
 *						execution of this application.
 *
 * PARAMETERS:		cmd - command specifying how to launch the application.
 *						cmdPBP - parameter block for the command.
 *						launchFlags - flags used to configure the launch.			
 *
 * RETURNED:		Any applicable error code.
 *
 ***********************************************************************/
UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
	UInt32 err = 0;
	

	// Check for a normal launch.
	if (cmd == sysAppLaunchCmdNormalLaunch){
		// process the passed in parameters
		char * args = cmdPBP;

		int startChar = 0;
		int argc = 0;
		int i=0;

		BeamParamsPtr pBP;
		MemHandle memHandle;
		
		// If we were not launched as a subroutine, i.e. we were launched from the application launcher
		// then we must return (exit - do not run)
		if (cmdPBP == NULL){
			FrmAlert (2000);
			return(err);
		}

		memHandle = MemHandleNew(sizeof(BeamParamsType));		
	
		// check for out of memory problem
		if(memHandle == 0) return (err);

		pBP = (BeamParamsPtr)MemHandleLock(memHandle);
		
		// Create exgSocket structure
		MemSet(pBP, sizeof(BeamParamsType), 0);

		pBP->cardNo = 0;

		while(true){
			if(args[i] == ',' || args[i] == 0){
				int len = i-startChar;

				switch(argc){
				case 0: 
					parseArgs(pBP->inName, args, startChar, len, 32);
					break;					
				case 1:
					parseArgs(pBP->outName, args, startChar, len, 32);
					break;
				case 2:
					parseArgs(pBP->appName, args, startChar, len, 32);
					break;					
				case 3:
					parseArgs(pBP->description, args, startChar, len, 256);
					break;
				}
				startChar = i+1;
				argc++;
			}
			if(args[i] == 0){
				break;
			}
			i++;
		} 

		SendDatabase(pBP);
	}

	else if (cmd == sysAppLaunchCmdSyncNotify)
		{
		// register our extension on syncNotify so we do not need to
		// be run before we can receive data.
		RegisterExtensions();
		}

	else if (cmd == sysAppLaunchCmdExgReceiveData)
		{
		err = ReceiveDatabase((ExgSocketPtr)cmdPBP);
		}
	
	return(err);
}