|
i can use the API "EnumProcess" for get all identifiers for each process object in the system. but how do i can get the full path for the particularly process?
thanks for your help!!!!!!!!!!
My english is poor, please pardon.
|
|
|
|
|
|
thanks! i can do it, now
My english is poor, please pardon.
|
|
|
|
|
Hi,
When you sort columns in Windows explorer on win XP, it highlights the column being sorted. Any idea about “how to” for this?
Thanks
|
|
|
|
|
Maybe that's a built-in feature of the v6 common controls? But if not, you can do it yourself with custom draw.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
It is not built in feature of commctrl 6. any other options beside custom draw?
|
|
|
|
|
Custom draw is perfect for customized drawing like that. The alertnative is owner draw, which is overkill for what you want to do.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I am using this component to retrieve disconnected recordsets to an ASP or VB client. I pass in a SQL Statement and return the disconnected Recordset.
Under COM+ Component Services, I created and application and set the following properties: Object Pooling, IObjectConstruction, JITA, Transactions are set to NOT Supported. I do not plan on using transactions in my project.
The Example I followed (Alan Gordon's) to build this DID NOT include the IObjectControl Interface.
I added, you can see that its references are commented out. (The component runs fine with and w/o the IObjectControl declares.
The component appears to function properly. Of course it has not really been stress tested.
My question to you is??? Is this properly coded?? I read in Tim Ewald's Transactional COM+, that you must use IObjectControl if you are using ObjectPooling and JITA.
Is this true? Could you take a quick look over this and give me your opinion? How would you code this differently to ensure that IObjectControl is being used properly with ObjectPooling and JITA. If you need to see the whole project, I can send it to you zipped.
Happy Holidays !!
Sincerely,
Peter J. Santiago
www.whiteknightinc.com
// Book.cpp : Implementation of CBook
#include "stdafx.h"
#include "Articleproject.h"
#include "Book.h"
const E_CONFIGURATION=MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200+108);
const E_CONFLICTS_FOUND=MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200+109);
const int conTitleFieldLength=80;
#undef EOF
/////////////////////////////////////////////////////////////////////////////
// CBook
//HRESULT CBook::Activate()
//{
// HRESULT hr = GetObjectContext(&m_spObjectContext);
// if (SUCCEEDED(hr))
// return S_OK;
//return hr;
//}
//BOOL CBook::CanBePooled()
//{
// return TRUE;
//}
//void CBook::Deactivate()
//{
// m_spObjectContext.Release();
//}
STDMETHODIMP CBook::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* arr[] =
{
&IID_IBook
};
for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
{
if (::ATL::InlineIsEqualGUID(*arr[i],riid)) // pjs added
return S_OK;
}
return S_FALSE;
}
STDMETHODIMP CBook::RetrieveByID(BSTR id, _Recordset **rs)
{
_bstr_t strDescription;
HRESULT hRetval;
_ConnectionPtr pConn;
_RecordsetPtr pRS;
IContextState *pContextState=NULL;
if (0==mConnectionString.length())
{
hRetval=E_CONFIGURATION;
strDescription=L"You must configure a connection string";
goto exit_cleanup;
}
hRetval=CoGetObjectContext(IID_IContextState,(void **)&pContextState);
if (SUCCEEDED(hRetval))
{
// NEW WAY PJS 12/8/2001 TO PASS IN SQL STMT AND CREATE AN DISCONN RECORDSET
_bstr_t sql(id);
try
{
// Create and Open the Connection PJS
pConn.CreateInstance( __uuidof(Connection));
pConn->Open(mConnectionString, "", "",-1);
// Create and Open the Recordset PJS
pRS.CreateInstance( __uuidof(Recordset));
pRS->CursorLocation=adUseClient;
pRS->Open(sql,pConn.GetInterfacePtr(),adOpenStatic,adLockBatchOptimistic,-1);
pRS->AddRef();
*rs=pRS;
pRS->PutRefActiveConnection(NULL);
}
catch ( _com_error err)
{
strDescription=err.Description();
// PJS
hRetval=err.Error();
}
}
else
{
_com_error err(hRetval);
strDescription=
L"Your component may not be" \
L" configured";
}
// Exit and cleanup code
exit_cleanup:
if (NULL != pContextState)
{
if (SUCCEEDED(hRetval))
pContextState->SetMyTransactionVote(TxCommit);
else
pContextState->SetMyTransactionVote(TxAbort);
pContextState->SetDeactivateOnReturn(VARIANT_TRUE);
pContextState->Release();
}
if (NULL != pConn)
{
if (adStateOpen==pConn->GetState())
pConn->Close();
pConn=NULL;
}
if (SUCCEEDED(hRetval))
return hRetval;
else
return Error((LPOLESTR)strDescription,IID_IBook,hRetval);
}
// Book.h : Declaration of the CBook
#ifndef __BOOK_H_
#define __BOOK_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CBook
class ATL_NO_VTABLE CBook :
public CComObjectRootEx<ccommultithreadmodel>,
public CComCoClass<cbook, &clsid_book="">,
// public IObjectControl,
public ISupportErrorInfo,
public IDispatchImpl<ibook, &iid_ibook,="" &libid_articleprojectlib="">,
public IObjectConstruct
{
public:
CBook()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_BOOK)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CBook)
COM_INTERFACE_ENTRY(IBook)
COM_INTERFACE_ENTRY(IObjectConstruct)
// COM_INTERFACE_ENTRY(IObjectControl)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
// IObjectControl
// public:
// STDMETHOD(Activate)();
// STDMETHOD_(BOOL, CanBePooled)();
// STDMETHOD_(void, Deactivate)();
// CComPtr<iobjectcontext> m_spObjectContext;
// IBook
public:
STDMETHOD(xStr)(/*[out, retval]*/ BSTR* returnval);
STDMETHOD(RetrieveByID)(/*[in]*/ BSTR id,/*[out,retval]*/ _Recordset** rs);
STDMETHOD(Construct) (IDispatch *pCtorObj)
{
_bstr_t strDescription;
HRESULT hRetval;
IObjectConstructString *pStr;
BSTR strConstruct;
if (pCtorObj != NULL)
{
hRetval=pCtorObj->QueryInterface(IID_IObjectConstructString,(void **)&pStr);
if (SUCCEEDED(hRetval))
{
hRetval=pStr->get_ConstructString(&strConstruct);
if (SUCCEEDED(hRetval))
{
mConnectionString=strConstruct;
SysFreeString(strConstruct);
}
pStr->Release();
}
elsentabitab pConn->Open(mConnectionStri pConn->Open(mConnection
{
_com_error err(hRetval);
strDescription=err.Description();
ATLTRACE(err.ErrorMessage());
}
}
else
{
hRetval=E_POINTER;
strDescription=L"An invalid pointer was passed to Construct";
}
if (S_OK==hRetval)
return hRetval;
else
return Error((LPOLESTR)strDescription,IID_IBook,hRetval);
}
private:
_bstr_t mConnectionString;
};
#endif //__BOOK_H_
|
|
|
|
|
hiyaz, will anyone tell me how to make the code in a post look orange like that??? it'd be handy and flashy
Kuniva
|
|
|
|
|
Enclose it in <code> tags, like this <code>some code</code>. If you have lots of code and not just keywords, do this;
<pre>
int main() {
printf("hello\n");
}
</pre>
Simon
<i>Hey, it looks like you're writing a letter!</i>
<font color="b30000">Sonork ID 100.10024</font>
|
|
|
|
|
heyyy cool, lolz
:laugh:
thanks
Kuniva
Want, take, have.
(oh btw, best way of learning some language is by looking at examples, start large!) :p
|
|
|
|
|
Can I use sql string?
whoi can show me how to do with it?
thank you for your help!
|
|
|
|
|
Hi there,
It depends how much data and what database you're using. With most databases there is support for a RAW type of data that lets you store huge amount of binary data in a record.
Usually strings (or VARCHAR in most cases) would not be such a good idea for more than a couple of kilo-bytes (limitations depend on the database vendor and the middleware used to access it)
HTH
Cheers,
Pierre
|
|
|
|
|
I use ACCESS,the data ia about 5~8M
|
|
|
|
|
ACCESS... Arggh
There is not much support for big chunks of Data with Access. Text is a no-no as it is limited to a stupid 255 characters.
There is the memo type but that's no good either as if I remember correctly it is limited to 64k
I think the only type you can use is OLE (which, if I remember correctly can store up to a Gig of data). Not sure if that's supported by all versions of Access, though.
HTH
Cheers,
Pierre
|
|
|
|
|
Pierre Heler-Caruel wrote:
With most databases there is support for a RAW type of data that lets you store huge amount of binary data in a record.
Some databases call the type for binary data "BLOB" (Binary Large OBject) instead of "RAW".
Pierre Heler-Caruel wrote:
Usually strings (or VARCHAR in most cases) would not be such a good idea for more than a couple of kilo-bytes
Strings are unsuitable for binary data independent of size, because the DBMS may do character-set conversions etc. if it thinks the data is a text string, and mangle your binary data.
|
|
|
|
|
Hi,
Has anyone any ideas why LineScroll() does not work in a subclassed edit box?
When inserting text and trying to scroll to the end, a carriage return is added to the top of the text and the caret goes to the second line.
It looks pretty much like this:
<snip>
CString Container("");
int nLines;
GetWindowText(Container);
Container += "\r\n" + strText;
SetWindowText(Container);
nLines = GetLineCount();
LineScroll(nLines);
<snip>
Cheers,
/Fredrik
Do you Sonork? I do! 100.11430 PhatBoy
|
|
|
|
|
Hmmm... Will LineScroll(...) work of you do not have a scrollbar visible? If you are trying to "get to the end" of the text, why not use SetSel(...) to move the caret to the end of the text?
Or am I just missing what you are trying to do?
BTW: try not to use "" to represent an empty string with dealing with CStrings, use afxEmptyString instead. And, you do not need to initialize a CString with an empty string. It constructs to an empty string by default. (Initializing it with an empty string just wastes time.)
-=- James.
|
|
|
|
|
Well, the scrollbar is visible, and I am indeed trying to scroll to the last line of the box. I tried to use SetSel(), but then the text disappears... Using LineScroll() works with a non-subclassed edit box.
I have written handlers for OnChar(), OnKeyDown() and OnRButtonDown() in the subclassed version. Could that cause any trouble?
Cheers,
/Fredrik
Do you Sonork? I do! 100.11430 PhatBoy
|
|
|
|
|
> I have written handlers for OnChar(), OnKeyDown() and
> OnRButtonDown() in the subclassed version. Could that
> cause any trouble?
I would not think so. And what do you mean by "the text dissa[ears" when you use SetSel(...)?
-=- James.
|
|
|
|
|
James R. Twine wrote:
I would not think so. And what do you mean by "the text disappears" when you use SetSel(...)?
The text that is entered in the edit box disappears.
It is not visible, and it can't be retrieved with GetWindowText().
Cheers,
/Fredrik
Do you Sonork? I do! 100.11430 PhatBoy
|
|
|
|
|
I realized if have been a bit unclear ; what I am doing is that I have subclassed an edit box and added an OnChar handler. The OnChar handler adds text and scrolls to the bottom.
Looks something like this:
void CMySubclassedEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
 CString strText("Text\r\n>");
 CString Container;
 int nLines;
 if (nChar == 0x0D)
 {
   GetWindowText(Container);
   Container += "\r\n" + strText;
   SetWindowText(Container);
   nLines = GetLineCount();
   LineScroll(nLines);
 }
 CEdit::OnChar(nChar, nRepCnt, nFlags);
}
Cheers,
/Fredrik
Do you Sonork? I do! 100.11430 PhatBoy
|
|
|
|
|
>> The text that is entered in the edit box disappears.
>> It is not visible, and it can't be retrieved with GetWindowText().
If you are using the above code, and the text dissapears when you use SetSel(...), it might be due to the fact that your call to SetSel is incorrect, and is selecting the entire control. Then, the base CEdit::OnChar(...) gets called, which will replace the selection with whatever character was entered (a CR or LF); the result: no text in the control.
Also, in the above code, "nLines" is not initialized. That might result in some strange scrolling effects.
Lastly, if all you want to do is add a CRLF and some text to an edit control, the easiest (and faster than the code you posted) is to do a CEdit::SetSel(...) to get to the end of the control, and then call CEdit::ReplaceSel(...) with the text you want to add to the control. And since pasting normally moves the caret to the end of the pastes text, you will still be at the end of the edit control's text.
Peace!
-=- James.
|
|
|
|
|
James R. Twine wrote:
>If you are using the above code, and the text dissapears when you use SetSel(...), >it might be due to the fact that your call to SetSel is incorrect, and is selecting the entire control. >Then, the base CEdit::OnChar(...) gets called, >which will replace the selection with whatever character was entered (a CR or LF); >the result: no text in the control.
Ah, right you are.
It works if I remove the selection afterwards, naturally.
Thank you for the help, much appreciated!
Cheers,
/Fredrik
Do you Sonork? I do! 100.11430:PhatBoy
|
|
|
|
|
Hi All,
How will get all the machine name which are corrently connected in a network?
Sangeetha
|
|
|
|
|