應用程序唯一性

程序啟動后,如果再次啟動程序,不會出現2個程序,或者實現如Notepad++已打開一個文件,再打開另外一個文件,則追加在Notepad++界面上。

使用codeproject上別人編寫的一個類,加在程序啟動時即可。

?

sinstance.h

/*
Module : SINSTANCE.H
Purpose: Defines the interface for an MFC wrapper class to do instance checking
Created: PJN / 29-07-1998Copyright (c) 1996 - 2008 by PJ Naughter (Web: www.naughter.com, Email: pjna@naughter.com)All rights reserved.Copyright / Usage Details:You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise) 
when your product is released in binary form. You are allowed to modify the source code in any way you want 
except you cannot modify the copyright details at the top of each module. If you want to distribute source 
code with your application, then you are only allowed to distribute versions released by the author. This is 
to maintain a single distribution point for the source code. *//// Macros / Defines //#pragma once#ifndef __SINSTANCE_H__
#define __SINSTANCE_H__#ifndef CSINGLEINSTANCE_EXT_CLASS
#define CSINGLEINSTANCE_EXT_CLASS
#endif#ifndef CSINGLEINSTANCE_EXT_API
#define CSINGLEINSTANCE_EXT_API
#endifIncludes /#ifndef __AFXMT_H__
#pragma message("To avoid this message, please put afxmt.h in your pre compiled header (normally stdafx.h)")
#include <afxmt.h>
#endifClasses //class CSINGLEINSTANCE_EXT_CLASS CInstanceChecker
{
public:
//Constructors / DestructorsCInstanceChecker(const CString& sUniqueName);virtual ~CInstanceChecker();//General functionsvoid ActivateChecker();BOOL TrackFirstInstanceRunning();BOOL PreviousInstanceRunning();HWND ActivatePreviousInstance(LPCTSTR lpCmdLine = NULL, ULONG_PTR dwCopyDataItemData = 0, DWORD dwTimeout = 30000); void QuitPreviousInstance(int nExitCode = 0);protected:
//Virtual methodsvirtual CString GetMMFFilename();virtual HWND GetWindowToTrack();//Standard non-virtual methodsvoid ReleaseLock();//DataCMutex       m_instanceDataMutex;CMutex       m_executeMutex;CSingleLock* m_pExecuteLock;CString      m_sName;
};#endif //__SINSTANCE_H__

  sinstance.cpp

/*
Module : SINSTANCE.CPP
Purpose: Defines the implementation for an MFC wrapper classeto do instance checking
Created: PJN / 29-07-1998
History: PJN / 25-03-2000 Neville Franks made the following changes. Contact nevf@getsoft.com, www.getsoft.com1. Changed #pragma error to #pragma message. Former wouldn't compile under VC62. Replaced above #pragma with #include3. Added TrackFirstInstanceRunning(), MakeMMFFilename()PJN / 27-03-2000 1. Fixed a potential handle leak where the file handle m_hPrevInstance was not beingclosed under certain circumstances.Neville Franks made the following changes. Contact nevf@getsoft.com, www.getsoft.com2. Split PreviousInstanceRunning() up into separate functions so wecan call it without needing the MainFrame window.3. Changed ActivatePreviousInstance() to return hWnd.PJN / 15-05-2000 1. Serialized access to all of the CSingleInstance class to prevent race conditionswhich can occur when you app is programatically spawned.PJN / 17-05-2000 1. Updated sample to show how the code can be used for dialog based apps.PJN / 01-01-2001 1. Added a number of asserts to CInstanceChecker::ActivatePreviousInstance2. Now includes copyright message in the source code and documentation.PJN / 15-01-2001 1. Now allows multiple calls to PreviousInstanceRunning without ASSERTing2. Removed some unnecessary VERIFY's from ActivatePreviousInstance3. Made the MMF filename used modifiable via a virtual function GetMMFFilename 4. Made the window to track modifiable via a virtual function GetWindowToTrack5. Made destructor virtual since the introduction of other virtual functions in the class6. Removed a number of unnecessary verifies7. Changed the meaning of the return value from TrackFirstInstanceRunningPJN / 17-06-2001 1. Moved most of the code from CInstanceChecker::CInstanceChecker to CInstanceChecker::ActivateChecker. This allows client code to turn on or off the instancechecking code easily. Thanks to Anders Rundegren for this addition.PJN / 31-08-2001 1. made the name of the mutex which the class uses to serialize access to itself a paramterto the constructor. That way multiple independent apps do not block each other whilethey are calling into the CSingleInstance class. Thanks to Eugene Shmelyov for spottingthis problem.PJN / 23-03-2002 1. Provided a QuitPreviousInstance method. Thanks to Jon Bennett for providing this.PJN / 30-10-2002 1. The name of the internal memory mapped file is now based on the Mutex name rather thanthe application name. An example: a client was writing a webcam application and wanted it to run with multiple configuration for multiple camera support. So the app can run multiple times as long as a special configuration is given on the command line. But for that configuration only one instance is allowed. Using the application name for the memory mapped file was tying the single instance to the app rather than the unique mutex name. Thanks to Frank Fesevur for this nice update.PJN / 06-02-2003 1. Was missing a call to ReleaseLock in CInstanceChecker::ActivatePreviousInstance. Thanks to Pierrick Ingels for reporting this problem.PJN / 09-05-2004 1. Updated the copyright details.2. Extended CInstanceChecker::ActivatePreviousInstance to now allow the command line of thesecond app to be passed to the original app. By default the parameter is NULL, meaning that you get the original behaviour which just activates the previous instance. To respond to thisinformation you should add the following to your mainfrm module:mainfrm.hafx_msg LRESULT OnCopyData(WPARAM, LPARAM);mainfrm.cppLRESULT CMyFrameWnd::OnCopyData(WPARAM wParam, LPARAM lParam){COPYDATASTRUCT* pCDS = reinterpret_cast<COPYDATASTRUCT*>(lParam);TCHAR* pszCmdLine = static_cast<TCHAR*>(pCDS->lpData);if (pszCmdLine){//DO SOMETHING with pszCmdLine here such as call AfxGetApp()->OpenDocumentFile(pszCmdLine);}return TRUE;}Also hook up your onCopyData to the windows message map usingON_MESSAGE(WM_COPYDATA, OnCopyData)Thanks to Ingo H. de Boer for providing this nice update.3. Following a discussion on the Codeproject.com discussion forum for CSingleInstance on whatexactly a single instance app means (See http://www.codeproject.com/cpp/csingleinst.asp?msg=766108#xx1103xx),Daniel Lohmann has produced a simple function called CreateUniqueName which given a number of settings as flags, will produce a name which is unique. This code can be downloaded at http://www.losoft.de/code/SingleInstance.zip. You can then use this name in the constructor forCInstanceChecker. The concept of a single instance app is complicated by the concept of Window stationsand desktops as used by NT Services and Windows Terminal Services. In addition you might want to allow yourprogram to be run once per user. PJN / 30-05-2005 1. Fix for a crash where CWnd::GetLastActivePopup can sometimes return a NULL pointer. Thanks to Dominik Reichl for reporting this bug.PJN / 07-07-2006 1. Updated copyright details.2. Addition of CSINGLEINSTANCE_EXT_CLASS and CSINGLEINSTANCE_EXT_API which allows the class to be easily usedin an extension DLL.3. Removed derivation from CObject as it was not really needed.4. Updated the documentation to use the same style as the web site.5. Code now uses newer C++ style casts instead of C style casts.6. Fixed a number of level 4 warnings in the sample app.7. Updated code to compile cleanly using VC 2005.PJN / 17-03-2007 1. Updated copyright details.2. Optimized _INSTANCE_DATA constructor code3. Reworked how the method CInstanceChecker::GetMMFFilename creates the name of the memory mapped filenamethe code requires for sharing. Now the main instance name appears before the hard coded string. Thisensures that the CInstanceChecker class works correctly for terminal sessions i.e. kernel objects prefixedwith the value "Local\". Thanks to Mathias Berchtold for reporting this issue.4. Updated the sample app code to clean compile on VC 20055. QuitPreviousInstance now uses GetLastActivePopup API to ensure it posts the WM_QUIT message to the correct window of the previous instance.PJN / 02-02-2008 1. Updated copyright details2. Removed VC 6 style classwizard comments from the sample apps code3. Updated ActivatePreviousInstance method to support Win64 compliant data4. ActivatePreviousInstance now takes a "dwTimeout" parameter which it now uses internally as the timeout whencalling SendMessageTimeout instead of SendMessage. The code now uses SendMessageTimeout instead of SendMessage to ensure we do not hang if the previous instance itself is hung. Thanks to Paul Shore for suggesting this update.5. Updated the sample apps to clean compile on VC 2008Copyright (c) 1996 - 2008 by PJ Naughter (Web: www.naughter.com, Email: pjna@naughter.com)All rights reserved.Copyright / Usage Details:You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise) 
when your product is released in binary form. You are allowed to modify the source code in any way you want 
except you cannot modify the copyright details at the top of each module. If you want to distribute source 
code with your application, then you are only allowed to distribute versions released by the author. This is 
to maintain a single distribution point for the source code. *//  Includes  //#include "stdafx.h"
#include "sinstance.h"/// Defines / Macros //#ifdef _DEBUG
#define new DEBUG_NEW
#endif/ Implementation ////struct which is put into shared memory
struct CWindowInstance
{HWND hMainWnd;
};//Class which is used as a static to ensure that we
//only close the file mapping at the very last chance
class _SINSTANCE_DATA
{
public:
//Constructors / Destructors_SINSTANCE_DATA();~_SINSTANCE_DATA();protected:
//Member variablesHANDLE hInstanceData;friend class CInstanceChecker;
};_SINSTANCE_DATA::_SINSTANCE_DATA() : hInstanceData(NULL)
{
}_SINSTANCE_DATA::~_SINSTANCE_DATA()
{if (hInstanceData != NULL){::CloseHandle(hInstanceData);hInstanceData = NULL;}
}static _SINSTANCE_DATA g_sinstanceData;CInstanceChecker::CInstanceChecker(const CString& sUniqueName) : m_executeMutex(FALSE, sUniqueName)
{//Hive away the unique name as we will also be using it for the name of the memory mapped filem_sName = sUniqueName;//Only one object of type CInstanceChecker should be createdASSERT(g_sinstanceData.hInstanceData == NULL);m_pExecuteLock = NULL;
}void CInstanceChecker::ActivateChecker()
{ASSERT(m_pExecuteLock == NULL);//Ensure there is only ever one CInstanceChecker instance //active at any one time throughout the systemm_pExecuteLock = new CSingleLock(&m_executeMutex, TRUE);
}CInstanceChecker::~CInstanceChecker()
{//Free up the instance lockReleaseLock();
}void CInstanceChecker::ReleaseLock()
{if (m_pExecuteLock){delete m_pExecuteLock;m_pExecuteLock = NULL;}  
}//Track the first instance of our App.
//return TRUE on success, else FALSE
BOOL CInstanceChecker::TrackFirstInstanceRunning()
{//If a previous instance is running, just return prematurelyif (PreviousInstanceRunning())return FALSE;//If this is the first instance then copy in our info into the shared memory//First create the MMFint nMMFSize = sizeof(CWindowInstance);g_sinstanceData.hInstanceData = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, nMMFSize, GetMMFFilename());if (g_sinstanceData.hInstanceData == NULL){TRACE(_T("Failed to create the MMF even though this is the first instance, you might want to consider overriding GetMMFFilename()\n"));return FALSE;}//Open the MMFCWindowInstance* pInstanceData = static_cast<CWindowInstance*>(MapViewOfFile(g_sinstanceData.hInstanceData, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, nMMFSize));ASSERT(pInstanceData != NULL);   //Opening the MMF should work//Lock the data prior to updating itCSingleLock dataLock(&m_instanceDataMutex, TRUE);pInstanceData->hMainWnd = GetWindowToTrack();UnmapViewOfFile(pInstanceData);//Since this will be the last function that will be called //when this is the first instance we can release the lockReleaseLock();return TRUE;
}// Returns TRUE if a previous instance of the App is running.
BOOL CInstanceChecker::PreviousInstanceRunning()
{//Try to open the MMF first to see if we are the second instanceHANDLE hPrevInstance = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, GetMMFFilename());BOOL bPreviousInstance = (hPrevInstance != NULL);if (hPrevInstance)CloseHandle(hPrevInstance);return bPreviousInstance;
}CString CInstanceChecker::GetMMFFilename()
{CString sMMF(m_sName);sMMF += _T("_CInstanceChecker_MMF");return sMMF;
}HWND CInstanceChecker::GetWindowToTrack()
{//By default the window tracked will be the standard AfxGetMainWnd()ASSERT(AfxGetMainWnd() != NULL); //Did you forget to set up the mainfrm in InitInstance ?return AfxGetMainWnd()->GetSafeHwnd();
}//Activate the Previous Instance of our Application.
HWND CInstanceChecker::ActivatePreviousInstance(LPCTSTR lpCmdLine, ULONG_PTR dwCopyDataItemData, DWORD dwTimeout)
{//What will be the return value from this function (assume the worst)HWND hWindow = NULL;//Try to open the previous instances MMFHANDLE hPrevInstance = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, GetMMFFilename());if (hPrevInstance){//Open up the MMFint nMMFSize = sizeof(CWindowInstance);CWindowInstance* pInstanceData = static_cast<CWindowInstance*>(MapViewOfFile(hPrevInstance, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, nMMFSize));if (pInstanceData) //Opening the MMF should work{//Lock the data prior to reading from itCSingleLock dataLock(&m_instanceDataMutex, TRUE);//activate the old windowASSERT(pInstanceData->hMainWnd); //Something gone wrong with the MMFhWindow = pInstanceData->hMainWnd;if (hWindow){CWnd wndPrev;wndPrev.Attach(hWindow);CWnd* pWndChild = wndPrev.GetLastActivePopup();//Restore the focus to the previous instance and bring it to the foregroundif (wndPrev.IsIconic())wndPrev.ShowWindow(SW_RESTORE);if (pWndChild)pWndChild->SetForegroundWindow();if (lpCmdLine){  //Send the current apps command line to the previous instance using WM_COPYDATACOPYDATASTRUCT cds;cds.dwData = dwCopyDataItemData;DWORD dwCmdLength = static_cast<DWORD>(_tcslen(lpCmdLine) + 1);cds.cbData = dwCmdLength * sizeof(TCHAR); TCHAR* pszLocalCmdLine = new TCHAR[dwCmdLength]; //We use a local buffer so that we can specify a constant parameter//to this function#if (_MSC_VER >= 1400)_tcscpy_s(pszLocalCmdLine, dwCmdLength, lpCmdLine);#else                                                 _tcscpy(pszLocalCmdLine, lpCmdLine);#endifcds.lpData = pszLocalCmdLine;CWnd* pMainWindow = AfxGetMainWnd();HWND hSender = NULL;if (pMainWindow)hSender = pMainWindow->GetSafeHwnd();//Send the message to the previous instance. Use SendMessageTimeout instead of SendMessage to ensure we //do not hang if the previous instance itself is hungDWORD_PTR dwResult = 0;if (SendMessageTimeout(hWindow, WM_COPYDATA, reinterpret_cast<WPARAM>(hSender), reinterpret_cast<LPARAM>(&cds),SMTO_ABORTIFHUNG, dwTimeout, &dwResult) == 0){//Previous instance is not responding to messageshWindow = NULL;}//Tidy up the heap memory we have useddelete [] pszLocalCmdLine;}//Detach the CWnd we were usingwndPrev.Detach();}//Unmap the MMF we were usingUnmapViewOfFile(pInstanceData);}//Close the file handle now that we CloseHandle(hPrevInstance);//When we have activate the previous instance, we can release the lockReleaseLock();}return hWindow;
}void CInstanceChecker::QuitPreviousInstance(int nExitCode)
{//Try to open the previous instances MMFHANDLE hPrevInstance = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, GetMMFFilename());if (hPrevInstance){// Open up the MMFint nMMFSize = sizeof(CWindowInstance);CWindowInstance* pInstanceData = static_cast<CWindowInstance*>(MapViewOfFile(hPrevInstance, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, nMMFSize));if (pInstanceData != NULL) //Opening the MMF should work{// Lock the data prior to reading from itCSingleLock dataLock(&m_instanceDataMutex, TRUE);//activate the old windowASSERT(pInstanceData->hMainWnd); //Something gone wrong with the MMF?HWND hWnd = pInstanceData->hMainWnd;//Ask it to exitHWND hChildWnd = GetLastActivePopup(hWnd);PostMessage(hChildWnd, WM_QUIT, nExitCode, 0);}//Close the file handle now that we CloseHandle(hPrevInstance);}
}

  windows MFC下使用方法:

在InitInstance()中添加:
//Check for the previous instance as soon as possibleCInstanceChecker instanceChecker(_T("CInstanceChecker Example FrameWnd App"));instanceChecker.ActivateChecker(); if (instanceChecker.PreviousInstanceRunning()){CCommandLineInfo cmdInfo;ParseCommandLine(cmdInfo);AfxMessageBox(_T("Previous version detected, will now restore it"), MB_OK); instanceChecker.ActivatePreviousInstance(cmdInfo.m_strFileName);return FALSE;}...//Standard MFC stuff, create the mainframeCFrameWnd* pMainFrm = new CMyFrameWnd();if (!pMainFrm->Create(NULL, m_pszAppName))return FALSE;pMainFrm->ShowWindow(SW_SHOW);m_pMainWnd = pMainFrm;// If this is the first instance of our App then track it so any other instances can find usinstanceChecker.TrackFirstInstanceRunning();

  如需實現像Notepad++追加在程序后面的效果,可在CFrameWnd中添加:

添加WM_COPYDATA消息響應

LRESULT CMyFrameWnd::OnCopyData(WPARAM /*wParam*/, LPARAM lParam)
{COPYDATASTRUCT* pCDS = reinterpret_cast<COPYDATASTRUCT*>(lParam);TCHAR* pszCmdLine = static_cast<TCHAR*>(pCDS->lpData);if (pszCmdLine){CString sMsg;sMsg.Format(_T("Another instance passed us the command line: %s"), pszCmdLine);AfxMessageBox(sMsg);}return TRUE;
}

?

轉載于:https://www.cnblogs.com/sylar-liang/p/4553502.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/257217.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/257217.shtml
英文地址,請注明出處:http://en.pswp.cn/news/257217.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

php的GC機制

在php5.3版本之前, php變量的回收機制只是簡單的通過計數來處理(當refcount0時&#xff0c;會回收內存),但這樣會出現一個問題 $aarray("str"); $a[]&$a; unset($a); 執行unset之前,$a的refcount 為2,執行unset之后,$a的refcout為1,因為是1不等于0,不能被回收內存…

Spring 框架的JDBC模板技術

1. 概述 Spring 框架提供了很多持久層的模板類來簡化編程;Spring 框架提供的JDBC模板類: JdbcTemplate 類;Spring 框架提供的整合 Hibernate 框架的模板類: HibernateTemplate 類2. 環境搭建 2.1 創建數據庫表結構 CREATE TABLE t_account(id INT PRIMARY KEY AUTO_INCREMENT,…

BZOJ 1692: [Usaco2007 Dec]隊列變換( 貪心 )

數據 n < 30000 , 然后 O( n ) 的貪心也過了..... USACO 數據是有多弱啊 ( ps : BZOJ 1640 和此題一模一樣 , 雙倍經驗 ) --------------------------------------------------------------------------------------#include<cstdio>#include<cstring>#include…

數據說話,88000條數據繪制北京市地圖

偶獲得一批數據&#xff0c;本著好玩的態度繪制下來看看到底是什么鬼&#xff0c;繪制的結果如下&#xff1a; 呵呵&#xff0c;什么都不像。而且中間最重要的部分因數據量過大繪制的已經看不清楚了。于是乎&#xff0c;縮小繪制范圍&#xff0c;去除周圍沒有用的數據。重新繪制…

我的第一個python web開發框架(11)——工具函數包說明(二)

db_helper.py是數據庫操作包&#xff0c;主要有兩個函數&#xff0c;分別是read()數據庫讀操作函數和write()數據庫寫操作函數。這個包的代碼是從小戴同學分享的博文改造過來的。 1 #!/usr/bin/env python2 # codingutf-83 4 import psycopg25 from common import log_helper6 …

ASP.NET:在一般處理程序中通過 Session 保存驗證碼卻無法顯示圖片?

1 using System.Drawing;2 using System.Web;3 using System.Web.SessionState;4 5 /// <summary>6 /// CaptchaHandler 的摘要說明7 /// </summary>8 public class CaptchaHandler : IHttpHandler, IRequiresSessionState  //簡記&#xff1a;我需要Session9 { …

[LINK]用Python計算昨天、今天和明天的日期時間

用Python計算昨天、今天和明天的日期時間 轉載于:https://www.cnblogs.com/Athrun/p/5477651.html

Windows系統下oracle數據庫每天定時備份

第一步&#xff1a;建立備份腳本oraclebackup.bat 首先建立一個備份bat文件&#xff0c;在D盤下新建備份目錄oraclebackup&#xff0c;將oracle安裝目錄下的EXP.EXE復制到此目錄下&#xff0c;再新建一個文本文件oraclebackup.txt&#xff0c;內容如下&#xff1a; echo off ec…

面試題3:二維數組查找

1 bool Find(const int *matrix, int rows, int columns, int number)2 {3 int key;4 int indexRow;5 int indexCol;6 7 /*合法性檢查*/8 if((NULL matrix)||(rows < 0)||(columns <0))9 { 10 return false; 11 } 12 13 /*提升…

linux crontab 命令

#method 1 crontab -e crontab -u root -e #不同用戶自己的任務計劃 crontab -l#method 2 vim /etc/crontab# Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .--…

[譯] RNN 循環神經網絡系列 2:文本分類

原文地址&#xff1a;RECURRENT NEURAL NETWORKS (RNN) – PART 2: TEXT CLASSIFICATION原文作者&#xff1a;GokuMohandas譯文出自&#xff1a;掘金翻譯計劃本文永久鏈接&#xff1a;github.com/xitu/gold-m…譯者&#xff1a;Changkun Ou校對者&#xff1a;yanqiangmiffy, To…

[置頂] Android開發者官方網站文檔 - 國內踏得網鏡像

Mark 一下&#xff1a; 鏡像地址&#xff1a;http://wear.techbrood.com/index.html Android DevelopTools: http://www.androiddevtools.cn/ 轉載于:https://www.cnblogs.com/superle/p/4561856.html

Java實現選擇排序

選擇排序思想就是選出最小或最大的數與第一個數交換&#xff0c;然后在剩下的數列中重復完成該動作。 package Sort;import java.util.Arrays;public class SelectionSort {public static int selectMinKey(int[] list, int beginIdx) {int idx beginIdx;int temp list[begin…

ASP.NET MVC中ViewData、ViewBag和TempData

1.ViewData 1.1 ViewData繼承了IDictionary<string, object>,因此在設置ViewData屬性時,傳入key必須要字符串型別,value可以是任意類型。 1.2 ViewData它只會存在這次的HTTP要求而已,而不像Session可以將數據帶到下HTTP要求。 public class TestController : Controller{…

java 正則表達式驗證郵箱格式是否合規 以及 正則表達式元字符

package com.ykmimi.testtest; /*** 測試郵箱地址是否合規* author ukyor**/ public class EmailTest {public static void main(String[] args) {//定義要匹配的Email地址的正則表達式//其中\w代表可用作標識符的字符,不包括$. \w表示多個// \\.\\w表示點.后面有\w 括號{2,3}…

鏡頭選型

景深&#xff1a; 光圈越大&#xff0c;光圈值越小&#xff0c;景深越小 光圈越小&#xff0c;光圈值越大&#xff0c;景深越深 焦距越長&#xff0c;視角越小&#xff0c;主體像越大&#xff0c;景深越小 主體越近&#xff0c;景深越小

迅雷賬號

賬號 jiangchnangli:1 密碼 892812 網址 http://www.s8song.net/read-htm-tid-4906661.html漫晴xydcq7681轉載于:https://www.cnblogs.com/wlzhang/p/4563118.html

【Swift學習】Swift編程之旅---ARC(二十)

Swift使用自動引用計數(ARC)來跟蹤并管理應用使用的內存。大部分情況下&#xff0c;這意味著在Swift語言中&#xff0c;內存管理"仍然工作"&#xff0c;不需要自己去考慮內存管理的事情。當實例不再被使用時&#xff0c;ARC會自動釋放這些類的實例所占用的內存。然而…

像元大小及精度

說完了光學系統的分辨率之后我們來看看相機的圖像分辨率。圖像分辨率比較好理解&#xff0c;就是單位距離內的像用多少個像素來顯示。以我們的ORCA-Flash4.0為例&#xff0c;芯片的像元大小為 6.5 μm&#xff0c;在 40X物鏡的放大倍率下&#xff0c;1 μm的物經光學系統放大為…

轉:傳入的表格格式數據流(TDS)遠程過程調用(RPC)協議流不正確 .

近期在做淘寶客的項目&#xff0c;大家都知道&#xff0c;淘寶的商品詳細描述字符長度很大&#xff0c;所以就導致了今天出現了一個問題 VS的報錯是這樣子的 ” 傳入的表格格式數據流(TDS)遠程過程調用(RPC)協議流不正確“ 還說某個desricption 過長之類的話 直覺告訴我&#…