当前位置: 首页>>代码示例>>C++>>正文


C++ GetCommand函数代码示例

本文整理汇总了C++中GetCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCommand函数的具体用法?C++ GetCommand怎么用?C++ GetCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetCommand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RunScript

void RunScript()
{
    char pstrCommand[MAX_COMMAD_SIZE];
    char pstrStringParam[MAX_PARAM_SIZE];

    for (g_iCurrScriptLine=0; g_iCurrScriptLine < g_iScriptSize; g_iCurrScriptLine++)
    {
        g_iCurrentLineChar = 0;

        GetCommand(pstrCommand);

        if (strcmp(pstrCommand, COMMAND_PRINTSTRING) == 0)
        {
            GetStringParam(pstrStringParam);
            printf("\t%s\n", pstrStringParam);
        }

        else if (strcmp(pstrCommand, COMMAND_PRINTSTRINGLOOP) == 0)
        {
            GetStringParam(pstrStringParam);
            int iLoopCount = GetIntParam();

            for (int i=0; i < iLoopCount; i++)
                printf("\t%d: %s\n", i, pstrStringParam);
        }

        else if (strcmp(pstrCommand, COMMAND_NEWLINE) == 0)
        {
            printf("\n");
        }

        else 
        {
            printf("\tError: Invalid Command.\n");
            break;
        }
    }
}
开发者ID:Who828,项目名称:command-based-language,代码行数:38,代码来源:command_language.c

示例2: assert

bool CRegisteredCommands::AddCommand(CLuaMain* pLuaMain, const char* szKey, const CLuaFunctionRef& iLuaFunction, bool bRestricted, bool bCaseSensitive)
{
    assert(pLuaMain);
    assert(szKey);

    // Check if we already have this key and handler
    SCommand* pCommand = GetCommand(szKey, pLuaMain);

    if (pCommand && iLuaFunction == pCommand->iLuaFunction)
        return false;

    // Create the entry
    pCommand = new SCommand;
    pCommand->pLuaMain = pLuaMain;
    pCommand->strKey.AssignLeft(szKey, MAX_REGISTERED_COMMAND_LENGTH);
    pCommand->iLuaFunction = iLuaFunction;
    pCommand->bRestricted = bRestricted;
    pCommand->bCaseSensitive = bCaseSensitive;

    // Add it to our list
    m_Commands.push_back(pCommand);

    return true;
}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:24,代码来源:CRegisteredCommands.cpp

示例3: GetCommand

BOOL Cx179App::InitInstance()
{
	CWinApp::InitInstance();
	
	CString cmd = GetCommand();

	OutputDebugStringA(cmd);

	//cmd = L"xxx caihong 123456 room 100001";

	if(cmd.Find("caihong") >= 0)
	{
		ProcessCaihongCmd(cmd);
		return TRUE;
	}

	if(cmd.Find("://") > 0)
	{
		ProcessWebCmd(cmd);
		return TRUE;
	}
		
	return TRUE;
}
开发者ID:mengskysama,项目名称:V8,代码行数:24,代码来源:x179.cpp

示例4: GetMailcapEntry

int
GetMailcapEntry(FILE *fp)
/* Parse a mailcap entry
 *   On entry-
 *     fp=mailcap file being read
 *   If a valid mailcap entry is found then on exit-
 *     GetMailcapEntry=1
 *     mc holds the decoded entry
 *   Else on exit-
 *     GetMailcapEntry=0
 *     The content of mc is undefined
 ***/
{ int rawentryalloc = 2000, len;
  char *rawentry, *s, *t, *LineBuf;

  LineBuf = malloc(LINE_BUF_SIZE);
  if (!LineBuf) ExitWithError(nomem);
  rawentry = malloc(1 + rawentryalloc);
  if (!rawentry) ExitWithError(nomem);
  *rawentry = 0;
  while (fgets(LineBuf, LINE_BUF_SIZE, fp)) {
    if (LineBuf[0] == '#') continue;
    len = strlen(LineBuf);
    if (len == 0) continue;
    if (LineBuf[len-1] == '\n') LineBuf[--len] = 0;
    if ((len + strlen(rawentry)) > rawentryalloc) {
      rawentryalloc += 2000;
      rawentry = realloc(rawentry, rawentryalloc+1);
      if (!rawentry) ExitWithError(nomem);
    }
    if (LineBuf[len-1] == '\\') {
      LineBuf[len-1] = 0;
      strcat(rawentry, LineBuf);
    } else {
      strcat(rawentry, LineBuf);
      break;
    }
  }
  free(LineBuf);
  for (s=rawentry; *s && isspace((unsigned char) *s); ++s) ;
  if (!*s) { /* totally blank entry -- quietly ignore */
    free(rawentry);
    return(0);
  }
  s = index(rawentry, ';');
  if (!s) { /* ignore invalid entries unless debugging */
    if (DoDebug)
      fprintf(stderr, "Invalid mailcap entry: %s\n", rawentry);
    free(rawentry);
    return(0);
  }
  *s++ = 0;	/* Terminate the content type and point to the remainder */

  mc.needsterminal = 0;
  mc.copiousoutput = 0;
  mc.testcommand = NULL;
  mc.label = NULL;
  mc.printcommand = NULL;

  StripTrailingSpace(rawentry);
  mc.contenttype = malloc(1+strlen(rawentry));
  if (!mc.contenttype) ExitWithError(nomem);
  strcpy(mc.contenttype, rawentry);

  t = GetCommand(s, &mc.command);
  if (!t) { /* There are no parameters */
    free(rawentry);
    return(1);
  }
  s = t;
  while (s) {
    char *arg, *eq;

    t = GetCommand(s, &arg);
    eq = index(arg, '=');
    if (eq) *eq++ = 0;
    if (*arg) {
      arg = Cleanse(arg);
      if (!strcmp(arg, "needsterminal")) {
	mc.needsterminal = 1;
      } else if (!strcmp(arg, "copiousoutput")) {
	mc.copiousoutput = 1;
      } else if (eq && !strcmp(arg, "test")) {
	mc.testcommand = eq;
      } else if (eq && !strcmp(arg, "description")) {
	mc.label = eq;
      } else if (eq && !strcmp(arg, "label")) { 
	mc.label = eq; /* bogus old name for description */
      } else if (eq && !strcmp(arg, "print")) {
	mc.printcommand = eq;
      } else if (eq && !strcmp(arg, "textualnewlines")) {
	/* ExceptionalNewline(mc.contenttype, atoi(eq)); */
      } else if (strcmp(arg, "notes")) { /* IGNORE notes field */
      } else if (*arg && DoDebug) {
        fprintf(stderr, "ignoring mailcap flag: %s\n", arg);
      }
    }
    s = t;
  }
  free(rawentry);
//.........这里部分代码省略.........
开发者ID:LukeMeszar,项目名称:CAS,代码行数:101,代码来源:search.c

示例5: c_main

void c_main()
{
	int		i;
	bool	autoboot=true;
	char	cmd[128];
	long	timeout;
	int		argc=0;
	char	*argv[MAX_ARGS];
	CMD_TBL	*cptr;
	 
	// initiate status.
	status.terminalSpeed = SERIAL_SPEED;
	status.downloadSpeed = SERIAL_DOWNLOAD_SPEED;

	/* initiate serial and timer */
	// serial and timer init.
	SerialInit(status.terminalSpeed);
         printf("\n\nFFUART has been initiated");

	TimerInit();

	//// printf the required GPL string. //////////////////////////////////////
	printf("\n\n");
	//printf(" "PACKAGE "-" VERSION "\n Copyright 2005 Embedded Group at [email protected]\n");
	//printf(" Support:[email protected]\n");
	printf("\n");

	//MemCpy((char *)KERNEL_DRAM_BASE, (char *)KERNEL_SRAM_BASE, KERNEL_MAX_SIZE);	// kernel image reload

	EthInit();
        //sendtest();

	///// wait 10 seconds before starting autoboot. ///////////////////////////
	printf("Autoboot in progress, press any key to stop ");

	for (i=0; i<3; i++){
		timeout = GetTime()+1;	// 1ÃÊ°£ Delay

		printf(".");
		while (GetTime()<timeout){
			if ((FFLSR & 0x00000001)){	// Serial
				FFRBR;
				autoboot = false;
				break;
			}
		}
		if (autoboot==false) break;
	}


	/* No key was pressed, so proceed booting the kernel. */
	if (autoboot)
	{
		printf("Autoboot started.\n");
		for (cptr=cmdTbl; cptr->cmd; cptr++){
			if (!StrCmp(cptr->cmd, "boot")) break;
		}
		DoBootKernel(cptr, 1, 0);
	}


	/* Key was pressed, so proceed command mode. */
	printf("\nAutoboot aborted\n");
	printf("Type \"help\" to get a list of commands\n");

	// the command loop. endless, of course.
	for(;;) {
		DisplayPrompt("bootloader>");

		// wait an hour to get a command.
		GetCommand(cmd, 128, 3600);
		if (!cmd || !cmd[0]) continue;
		
		argc = GetArgs(cmd, argv);
		for (cptr=cmdTbl; cptr->cmd; cptr++){
			if (!StrCmp(argv[0], cptr->cmd)){
				(cptr->run)(cptr, argc, argv);
				break;
			}
		}
		if (!StrCmp(argv[0], "help") || !StrCmp(argv[0], "?")){
			DoPrintfHelp(argc, argv);
		} else if (!(cptr->cmd)){
			printf("\tUnknown command : %s\n", argv[0]);
		}
	}
} // CMain.
开发者ID:csl,项目名称:bootloader-for-practicing,代码行数:87,代码来源:main.c

示例6: GetCommand

QString CommandService::GetHelpContextId(const QString& commandId) const
{
  Command::Pointer command = GetCommand(commandId);
  return commandManager->GetHelpContextId(command);
}
开发者ID:paulcm,项目名称:MITK,代码行数:5,代码来源:berryCommandService.cpp

示例7: switch


//.........这里部分代码省略.........

	int icon=IconAtPos(x,y);

//	(*info) << x << " " << y << " " << mouse->lastx << " " << mouse->lasty << "\n";

	if (button == SDL_BUTTON_RIGHT && icon==-1) { // right click -> default cmd
		inCommand=defaultCmdMemory;//GetDefaultCommand(x,y);
		defaultCmdMemory=0;
	} 

	if(icon>=0 && icon<commands.size()){
		if(showingMetal){
			showingMetal=false;
			groundDrawer->SetExtraTexture(0,0,false);
		}
		switch(commands[icon].type){
			case CMDTYPE_ICON:{
				Command c;
				c.id=commands[icon].id;
				CreateOptions(c,(button==SDL_BUTTON_LEFT?0:1));
				selectedUnits.GiveCommand(c);
				inCommand=-1;
				break;}
			case CMDTYPE_ICON_MODE:{
				int newMode=atoi(commands[icon].params[0].c_str())+1;
				if(newMode>commands[icon].params.size()-2)
					newMode=0;

				char t[10];
				SNPRINTF(t, 10, "%d", newMode);
				commands[icon].params[0]=t;

				Command c;
				c.id=commands[icon].id;
				c.params.push_back(newMode);
				CreateOptions(c,(button==SDL_BUTTON_LEFT?0:1));
				selectedUnits.GiveCommand(c);
				inCommand=-1;
				break;}
			case CMDTYPE_ICON_MAP:
			case CMDTYPE_ICON_AREA:
			case CMDTYPE_ICON_UNIT:
			case CMDTYPE_ICON_UNIT_OR_MAP:
			case CMDTYPE_ICON_FRONT:
			case CMDTYPE_ICON_UNIT_OR_AREA:
			case CMDTYPE_ICON_UNIT_FEATURE_OR_AREA:
				inCommand=icon;
				break;

			case CMDTYPE_ICON_BUILDING:{
				UnitDef* ud=unitDefHandler->GetUnitByID(-commands[icon].id);
				if(ud->extractsMetal>0 && !groundDrawer->drawMetalMap && autoShowMetal){
					groundDrawer->SetMetalTexture(readmap->metalMap->metalMap,readmap->metalMap->extractionMap,readmap->metalMap->metalPal,false);
					showingMetal=true;
				}
				inCommand=icon;
				break;}

			case CMDTYPE_COMBO_BOX:
				{
					inCommand=icon;
					CommandDescription& cd=commands[icon];
					list=new CglList(cd.name.c_str(),MenuSelection);
					for(vector<string>::iterator pi=++cd.params.begin();pi!=cd.params.end();++pi)
						list->AddItem(pi->c_str(),"");
					list->place=atoi(cd.params[0].c_str());
					game->showList=list;
					return;
				}
				inCommand=-1;
				break;
			case CMDTYPE_NEXT:
				{
					++activePage;
					if(activePage>maxPages)
						activePage=0;
				}
				selectedUnits.SetCommandPage(activePage);
				inCommand=-1;
				break;

			case CMDTYPE_PREV:
				{
					--activePage;
					if(activePage<0)
						activePage=maxPages;
				}
				selectedUnits.SetCommandPage(activePage);
				inCommand=-1;
				break;
		}
		return;
	}

	Command c=GetCommand(x,y,button,false);

	if(c.id!=CMD_STOP)	//if cmd_stop is returned it indicates that no good command could be found
	selectedUnits.GiveCommand(c);
	FinishCommand(button);
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:101,代码来源:GuiHandler.cpp

示例8: QString


//.........这里部分代码省略.........
            {
                si.hStdOutput = p_stdout[1];
                si.dwFlags |= STARTF_USESTDHANDLES;
            }
        }
    }

    if( GetSetting("UseStderr") )
    {
        if (!CreatePipe(&p_stderr[0], &p_stderr[1], &saAttr, 0)) 
        {
            VERBOSE(VB_IMPORTANT|VB_SYSTEM,
                            (LOC_ERR + "stderr pipe() failed"));
            SetStatus( GENERIC_EXIT_NOT_OK );
        }
        else
        {
            // Ensure the read handle to the pipe for STDERR is not inherited.
            if (!SetHandleInformation(p_stderr[0], HANDLE_FLAG_INHERIT, 0))
            {
                VERBOSE(VB_IMPORTANT|VB_SYSTEM,
                            (LOC_ERR + "stderr inheritance error"));
                SetStatus( GENERIC_EXIT_NOT_OK );
            }
            else
            {
                si.hStdError = p_stderr[2];
                si.dwFlags |= STARTF_USESTDHANDLES;
            }
        }
    }

    // set up command args
    QString cmd = GetCommand() + " " + GetArgs().join(" ");
    if (GetSetting("UseShell"))
        cmd.prepend("cmd.exe /c ");

    SetCommand( cmd );

    QByteArray cmdUTF8 = GetCommand().toUtf8();
    TCHAR *command = TEXT((char *)cmdUTF8.constData());

    const char *directory = NULL;
    QString dir = GetDirectory();
    if (GetSetting("SetDirectory") && !dir.isEmpty())
        directory = strdup(dir.toUtf8().constData());

    PROCESS_INFORMATION pi;
    ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));

    m_timeout = timeout;
    if( timeout )
        m_timeout += time(NULL);

    bool success = CreateProcess(NULL, 
                    command,       // command line 
                    NULL,          // process security attributes 
                    NULL,          // primary thread security attributes 
                    TRUE,          // handles are inherited 
                    0,             // creation flags 
                    NULL,          // use parent's environment 
                    directory,     // use parent's current directory 
                   &si,            // STARTUPINFO pointer 
                   &pi);           // receives PROCESS_INFORMATION 

    if (!success)
开发者ID:DocOnDev,项目名称:mythtv,代码行数:67,代码来源:system-windows.cpp

示例9: LanTask

void LanTask (void)
{
   uint16_t plen, dat_p = 0;
   bool send;
   
   while (1)
   {
      plen = Enc28j60PacketReceive(BUFFER_SIZE, buf);
         /*plen will unequal to zero if there is a valid packet (without crc error) */
      if (plen == 0) return;

      // arp is broadcast if unknown but a host may also verify the mac address by sending it to a unicast address.
      if (Eth_type_is_arp_and_my_ip(buf, plen))
      {
         Make_arp_answer_from_request(buf);
         continue;
      }
      // check if the ip packet is for us:
      if (Eth_type_is_ip_and_my_ip(buf, plen) == 0)
      {
         continue;
      }
      // ping
      if((buf[IP_PROTO_P] == IP_PROTO_ICMP_V) && (buf[ICMP_TYPE_P] == ICMP_TYPE_ECHOREQUEST_V))
      {
         Make_echo_reply_from_request(buf, plen);
         continue;
      }

      // tcp port www start, compare only the lower byte
      if ((buf[IP_PROTO_P] == IP_PROTO_TCP_V) && (buf[TCP_DST_PORT_H_P] == 0) && (buf[TCP_DST_PORT_L_P] == mywwwport))
      {
         if (buf[TCP_FLAGS_P] & TCP_FLAGS_SYN_V)
         {
            Make_tcp_synack_from_syn(buf); // make_tcp_synack_from_syn does already send the syn,ack
            continue;
         }
         if (buf[TCP_FLAGS_P] & TCP_FLAGS_ACK_V)
         {
            Init_len_info(buf); // init some data structures
            dat_p = Get_tcp_data_pointer();
            if (dat_p == 0)
            { 
               // we can possibly have no data, just ack:
               if (buf[TCP_FLAGS_P] & TCP_FLAGS_FIN_V)
               {
                  Make_tcp_ack_from_any(buf);
               }
               continue;
            }
         }
         send = false;
         if (strncmp("GET ",(char *) & (buf[dat_p]), 4) != 0)
         {
          	// head, post and other methods for possible status codes see:
            // http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
            plen = Fill_tcp_data_p(buf, 0, PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<h1>200 OK</h1>"));
            send = true;
         }

	      if (!send)
         {
            char *p;
            p = (char*) &(buf[dat_p+4]);  // start of incomming payload
            switch (GetCommand(p))
            {
               case 0:
                  break;
               case 1:
                  countUp0 = false;
                  break;
			   case 2:
                  countUp0 = true;
                  break;
            }
			
            plen = PrintWebpage(buf);
            send = true;
         }

         Make_tcp_ack_from_any(buf); // send ack for http get
         Make_tcp_ack_with_data(buf, plen); // send data
		 continue;       
      }


		// udp interface:
        if (buf[IP_PROTO_P]==IP_PROTO_UDP_V)
		{
        	uint8_t payloadlen=buf[UDP_LEN_L_P]-UDP_HEADER_LEN;
            // the received command has to start with t and be 4 char long
            // e.g "test\0"
            if(payloadlen)
			{
				char msg1[]="Hello";
				Make_udp_reply_from_request(buf,msg1,sizeof(msg1),MYUDPPORT);
			}
         }// End udp interface.

   }// End while(1)
//.........这里部分代码省略.........
开发者ID:IvanOrfanidi,项目名称:AVR-Tests-Project,代码行数:101,代码来源:main.c

示例10: TCL_EvalScilabCmd

/*--------------------------------------------------------------------------*/
int TCL_EvalScilabCmd(ClientData clientData,Tcl_Interp * theinterp,int objc,CONST char ** argv)
{
  int ierr = 0,seq = 0;
  char *command;

  char *comm[arbitrary_max_queued_callbacks];
  int   seqf[arbitrary_max_queued_callbacks];
  int nc,ncomm=-1;

  if (C2F(iop).ddt==-1)
    {
      /* trace for debugging */
      int argc=1;
      char *msg=_("TCL_EvalScilabCmd %s");

      sciprint_full(msg,argv[1]);

      while (argv[++argc]) sciprint(" %s",argv[argc]);
      sciprint("\n");

     }

  if (argv[1] != (char *)0)
    {
       command = strdup(argv[1]);
      if (command == (char *) 0)
	{
	  sciprint(_("%s: No more memory.\n"),"TCL_EvalScilabCmd");
	  return TCL_ERROR;
	}


      if ( (argv[2] != (char *)0) && (strncmp(argv[2],"sync",4)==0) )
	{
	  /* sync or sync seq
	   * TODO : Scilab is supposed to be busy there. Add mutex lock...
	   * C2F(tksynchro)(&c_n1);
	   * set sciprompt to -1 (scilab busy)
	   */
	  seq= ( (argv[3] != (char *)0) && (strncmp(argv[3],"seq",3)==0) );

	  if (C2F(iop).ddt==-1)
	    {
	      char *msg=_("Execution starts for %s");
	      sciprint_full(msg,command);
	      sciprint("\n");
	    }

	  /*
      int ns=(int)strlen(command);
	  Was : syncexec(command,&ns,&ierr,&seq,ns);
	  So far as Tcl has it's own thread now mixing global values
	  and threads within parse makes Scilab crash often.
	  */
	  StorePrioritaryCommandWithFlag(command, seq);
	  ierr = 0;

	  if (C2F(iop).ddt==-1)
	    {
	      char *msg=_("Execution ends for %s");
	      sciprint_full(msg,command);
	      sciprint("\n");
	    }
	  // TODO : Scilab is supposed to be busy there. Add mutex lock...
	  // C2F(tksynchro)(&C2F(recu).paus);
	  if (ierr != 0) return TCL_ERROR;
	}
      else if (strncmp(command,"flush",5)==0)
	{
	  /* flush */
	  if (C2F(iop).ddt==-1) sciprint(_(" Flushing starts for queued commands.\n"));
	  while (ismenu() && ncomm<arbitrary_max_queued_callbacks-1)
	    {
	      ncomm++;
	      comm[ncomm] = (char *) MALLOC (bsiz+1);
	      if (comm[ncomm] == (char *) 0)
		{
		  sciprint(_("%s: No more memory.\n"),"TCL_EvalScilabCmd");
		  return TCL_ERROR;
		}
	      seqf[ncomm]=GetCommand (comm[ncomm]);
	    }
	  if (ismenu()) sciprint(_("Warning: Too many callbacks in queue!\n"));
	  for (nc = 0 ; nc <= ncomm ; nc++ )
	    {
	      // TODO : Scilab is supposed to be busy there. Add mutex lock...
	      // C2F(tksynchro)(&c_n1);  // set sciprompt to -1 (scilab busy)
	      if (C2F(iop).ddt==-1)
		{
		  if (seqf[nc]==0)
		    {
		      char *msg=_("Flushed execution starts for %s - No option");
		      sciprint_full(msg,comm[nc]);
		      sciprint("\n");
		    }
		  else
		    {
		      char *msg=_("Flushed execution starts for %s - seq");
		      sciprint_full(msg,comm[nc]);
//.........这里部分代码省略.........
开发者ID:vinayrajchoudhary,项目名称:scilab,代码行数:101,代码来源:ScilabEval.c

示例11: fFile

#include "OperationPathList.h"
#include "InputOutput.h"
#include "Functions.h"

#include <fstream>
#include <iostream>
#include <locale>
#include <codecvt>

ClassFactory<OperationPathList> * OperationPathList::RegisteredFactory =
new ClassFactory<OperationPathList>(GetCommand());

OperationPathList::OperationPathList(std::queue<std::wstring> & oArgList) : Operation(oArgList)
{
	// exit if there are not enough arguments to parse
	std::vector<std::wstring> sSubArgs = ProcessAndCheckArgs(1, oArgList, L"\\0");

	// open the file
	std::wifstream fFile(sSubArgs[0].c_str());

	// adapt the stream to read windows unicode files
	(void) fFile.imbue(std::locale(fFile.getloc(), new std::codecvt_utf8<wchar_t,
		0x10ffff, std::consume_header>));

	// read the file line-by-line
	std::wstring sLine;
	while (std::getline(fFile, sLine))
	{
		// sometimes a carriage return appears in the input stream so adding 
		// it here ensures it is stripped from the very end
		std::vector<std::wstring> oLineItems = SplitArgs(sLine, L"\r");
开发者ID:NoMoreFood,项目名称:Repacls,代码行数:31,代码来源:OperationPathList.cpp

示例12: Invoke179App

void Invoke179App(HANDLE hMutex)
{
	//客户端已经打开
	if(WAIT_OBJECT_0 == ::WaitForSingleObject(hMutex, INFINITE))
	{
		HANDLE hMapFile = ::OpenFileMapping(FILE_MAP_READ, FALSE, _T("Local\\51KTVMainFileMap"));
		if(hMapFile == NULL)
		{
			ReleaseMutex(hMutex);
			CloseHandle(hMutex);
			return;
		}

		ShareMemInfo* pMemInfo = (ShareMemInfo*)MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, sizeof(ShareMemInfo));
		if(pMemInfo == NULL)
		{
			CloseHandle(hMapFile);
			ReleaseMutex(hMutex);
			CloseHandle(hMutex);
			return;
		}

		if(pMemInfo->unVersion == SHARE_MEMORY_INFO_VERSION)
		{
			if(::IsWindowEnabled(pMemInfo->hwndHall))
			{
				if(::IsIconic(pMemInfo->hwndHall))
				{
					::SendMessage(pMemInfo->hwndHall,WM_SYSCOMMAND, SC_RESTORE, 0);
				}
				else
				{
					::SetForegroundWindow(pMemInfo->hwndHall);	
				}
			}
			else if(::IsIconic(pMemInfo->hwndHall))
			{
				::EnableWindow(pMemInfo->hwndHall, TRUE);						
				::SendMessage(pMemInfo->hwndHall, WM_SYSCOMMAND, SC_RESTORE, 0);
				::SendMessage(pMemInfo->hwndLogin, WM_SYSCOMMAND, SC_RESTORE, 0);
				::EnableWindow(pMemInfo->hwndHall, FALSE);
			}

			CString strCommand = GetCommand();			
			if(!strCommand.IsEmpty())
			{
				HGLOBAL hGlobal = ::GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, strCommand.GetLength()+1);
				char* pDst = (char*)::GlobalLock(hGlobal);
				strcpy(pDst, strCommand.GetBuffer());
				::GlobalUnlock(hGlobal);
				::OpenClipboard(::GetDesktopWindow());
				::SetClipboardData(RegisterClipboardFormat(WEBPLUGIN_DATA_FORMAT), hGlobal);
				::CloseClipboard();
				::SendMessage(pMemInfo->hwndLogin, WM_WEBPLUGIN_MESSAGE, 0, 0);
				::GlobalFree(hGlobal);
			}
		}

		UnmapViewOfFile(pMemInfo);
		CloseHandle(hMapFile);
		ReleaseMutex(hMutex);
		CloseHandle(hMutex);
	}
}
开发者ID:mengskysama,项目名称:V8,代码行数:64,代码来源:x179.cpp

示例13: Operation

#include "OperationWhatIf.h"
#include "InputOutput.h"

ClassFactory<OperationWhatIf> * OperationWhatIf::RegisteredFactory =
new ClassFactory<OperationWhatIf>(GetCommand());

OperationWhatIf::OperationWhatIf(std::queue<std::wstring> & oArgList) : Operation(oArgList)
{
	InputOutput::InWhatIfMode() = true;
}
开发者ID:NoMoreFood,项目名称:Repacls,代码行数:10,代码来源:OperationWhatIf.cpp

示例14: main


//.........这里部分代码省略.........
int main()
{
	DWORD_VAL delay;

	//Setup bootloader entry delay
	sourceAddr.Val = DELAY_TIME_ADDR;	//bootloader timer address
	delay.Val = ReadLatch(sourceAddr.word.HW, sourceAddr.word.LW); //read BL timeout
	
	//Setup user reset vector
	sourceAddr.Val = USER_PROG_RESET;
	userReset.Val = ReadLatch(sourceAddr.word.HW, sourceAddr.word.LW);

	//Prevent bootloader lockout - if no user reset vector, reset to BL start
	if(userReset.Val == 0xFFFFFF){
		userReset.Val = BOOT_ADDR_LOW;	
	}
	userResetRead = 0;


	//If timeout is zero, check reset state.
	if(delay.v[0] == 0){

		//If device is returning from reset, BL is disabled call user code
		//otherwise assume the BL was called from use code and enter BL
		if(RCON & 0xFED3){
			//If bootloader disabled, go to user code
			ResetDevice(userReset.Val); 
		}else{
			delay.Val = 0xFF;
		}
	}


	T2CONbits.TON = 0;
	T2CONbits.T32 = 1; // Setup Timer 2/3 as 32 bit timer incrementing every clock
	IFS0bits.T3IF = 0; // Clear the Timer3 Interrupt Flag 
	IEC0bits.T3IE = 0; // Disable Timer3 Interrupt Service Routine 

	//Enable timer if not in always-BL mode
	if((delay.Val & 0x000000FF) != 0xFF){
		//Convert seconds into timer count value 
		delay.Val = ((DWORD)(FCY)) * ((DWORD)(delay.v[0])); 

		PR3 = delay.word.HW; //setup timer timeout value
		PR2 = delay.word.LW;

		TMR2 = 0;
		TMR3 = 0;
		T2CONbits.TON=1;  //enable timer
	}


	//If using a part with PPS, map the UART I/O
	#ifdef DEV_HAS_PPS
		ioMap();
	#endif

	
	//Configure UART pins to be digital I/O.
	#ifdef UTX_ANA
		UTX_ANA = 1;
	#endif
	#ifdef URX_ANA
		URX_ANA = 1;
	#endif


	// SETUP UART COMMS: No parity, one stop bit, autobaud, polled
	UxMODEbits.UARTEN = 1;		//enable uart
    #ifdef USE_AUTOBAUD
	    UxMODEbits.ABAUD = 1;		//use autobaud
    #else
        UxBRG = BAUDRATEREG;
    #endif
	#ifdef USE_HI_SPEED_BRG
		UxMODEbits.BRGH = 1;	//use high speed mode
	#endif
	UxSTA = 0x0400;  //Enable TX

	while(1){

		#ifdef USE_RUNAWAY_PROTECT
			writeKey1 = 0xFFFF;	// Modify keys to ensure proper program flow
			writeKey2 = 0x5555;
		#endif

		GetCommand();		//Get full AN851 command from UART

		#ifdef USE_RUNAWAY_PROTECT
			writeKey1 += 10;	// Modify keys to ensure proper program flow
			writeKey2 += 42;
		#endif

		HandleCommand();	//Handle the command

		PutResponse(responseBytes);		//Respond to sent command

	}//end while(1)

}//end main(void)
开发者ID:garyStofer,项目名称:wifi_wx_station,代码行数:101,代码来源:boot.c

示例15: strprintf

std::string CInv::ToString() const
{
    return strprintf("%s %s", GetCommand(), hash.ToString());
}
开发者ID:KendrickBitz,项目名称:cryptotarget,代码行数:4,代码来源:protocol.cpp


注:本文中的GetCommand函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。