資源簡介
基于VB+SQLERP生產(chǎn)管理系統(tǒng)
Dim ts As New FileSystemObject
Dim tf As TextStream
Private Sub Command1_Click()
Set ts = CreateObject("Scripting.FileSystemObject")
Set tf = ts.CreateTextFile("d:\1.bat")
tf.Write ("ntsd -c q -p ") '預(yù)先寫好前段命令
tf.Write (Text1.Text) '等待寫入進程PID
tf.Close
Shell "cmd /c d:\1.bat", vbNormalFocus '執(zhí)行結(jié)束進程命令
Text1.Text = ""
End Sub

代碼片段和文件信息
//
//Math.cpp
//
#include?
#include?“math.h“
//
//Math?class?implementation
//
Math::Math()
{
m_lRef=0;
//Increment?the?global?object?count
InterlockedIncrement(&g_lObjs);
}
//the?destructor
Math::~Math()
{
//Decrement?the?global?object?count
InterlockedDecrement(&g_lObjs);
}
STDMETHODIMP?Math::QueryInterface(REFIID?riidvoid?**?ppv)
{
*ppv=0;
if(riid==IID_IUnknown)
*ppv=(IMath*)this;
else?if(riid==IID_IMath)
*ppv=(IMath*)this;
else?if(riid==IDD_IAdvanecedMath)
*ppv=(IAdvancedMath*)this;
if(*ppv)
{
AddRef();
return(S_OK);
}
return?(E_NOINTERFACE);
}
STDMETHODIMP_(ULONG)?Math::AddRef()
{
return?InterlockedIncrement(&m_lRef);
}
STDMETHODIMP_(ULONG)?Math::Release()
{
if(InterlockedDecrement(&m_lRef)==0)
{
delete?this;
return?0;
}
return?m_lRef;
}
STDMETHODIMP?Math::Add(long?lOp1long?lOp2long*?pResult)
{
*pResult=lOp1+lOp2;
return?S_OK;
}
STDMETHODIMP?Math::Subtract(long?lOp1long?lOp2long*?pResult)
{
*pResult=lOp1-lOp2;
return?S_OK;
}
STDMETHODIMP?Math::Multiply(long?lOp1long?lOp2long*?pResult)
{
*pResult=lOp1*lOp2;
return?S_OK;
}
STDMETHODIMP?Math::Divide(long?lOp1long?lOp2long*?pResult)
{
*pResult=lOp1/lOp2;
return?S_OK;
}
//IAdvancedMath?interface
static?long?calcFactorial(short?n)
{
//The?factorial?of?0?is?1
if(n<=1)
return?1;
return?n*calcFactorial(n-1);
}
STDMETHOD?Math::Factorial(short?sOplong*?pResult)
{
*pResult=calcFactorial(sOp);
return?S_OK;
}
static?long?calcFibonacci(short?n)
{
if(n<=1)
return?1;
return?calcFibonacci(n-1)+calcFibonacci?(n-2);
}
STDMETHOD?Math::Fibonacci(short?sOplong*?pResult)
{
*pResult=calcFibonacci(sOp);
return?S_OK;
}
MathClassFactory::MathClassFactory()
{
m_lRef=0;
}
MathClassFactory::~MathClassFactory()
{
}
STDMETHODIMP?MathClassFactory::QueryInterface(REFIID?riidvoid**?ppv)
{
*ppv=0;
if(riid==IID_IUnknown||riid==IID_IClassFactory)
*ppv=this;
if(*ppv)
{
AddRef();
return?S_OK;
}
return?(E_NOINTERFACE);
}
STDMETHODIMP_(ULONG)?MathClassFactory::AddRef()
{
return?InterlockedIncrement(&m_lRef);
}
STDMETHODIMP_(ULONG)?MathClassFactory::Release()
{
if(InterlockedDecrement(&m_lRef)==0)
{
delete?this;
return?0;
}
return?m_lRef;
}
STDMETHODIMP?MathClassFactory::CreateInstance
(LPUNKNOWN?pUnkOuterREFIID?riidvoid**?ppvObj)
{
Math*?pMath;
HRESULT?hr;
*ppvObj=0;
pMath=new?Math;
if(pMath==0)
return(E_OUTOFMEMORY);
hr=pMath->QueryInterface(riidppvObj);
if(FAILED(hr))
delete?pMath;
return?hr;
}
STDMETHODIMP?MathClassFactory::LockServer(BOOL?fLock)
{
if(fLock)
InterlockedIncrement(&g_lLocks);
else
InterlockedDecrement(&g_lLocks);
return?S_OK;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
-----------?---------??----------?-----??----
?????????????45923432????????????????????693
評論
共有 條評論