|
Afther a long search over the internet and MSDN, I decided to ask someone more skilled than me that may be on this forum...
Is there possible to intercept an application file operation reqest? Let's say an application is triing to open a file, can I set a hook that notifies me that?
If not, how can this goal be accomplished? Writing kernel mode intermediate drivers for the i/o routines?
I hope I understand...because is a rough world out there...
|
|
|
|
|
|
Thanks for you answer, but I'm tring to find a way in order to intercept some file I/O actions...
Adica in timp dinamc sa imi spuna daca o aplicatie deschide o fila, citeste dintr-o fila, scrie intr-o fila, etc... Intrebarea era daca este posibli cu Hook-uri si cum, sau daca nu cum este posibil? - Mersi oricum
I hope you understand...because is a rough world out there...
|
|
|
|
|
Vlad Stanciu wrote:
Is there possible...
It's possible and, depending on your actual requirements, might not be a trivial task. You may need to create a virtual device driver, install a VxD service called IFSMGR_InstallFileSystemApiHook , or create a file system driver that "sees" all IRPs and FastIO requests directed at a drive.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello,
I am using MFC to call a stored procedure written in Oracle PL/SQL, but when I make
the call I get the next error in Spanish:
"No se enlazaron columnas antes de llamar a SQLFetchScroll o
SQLExtendedFetch", which more or less in English means:
"No rows were binded before calling SQLFetchScroll or SQLExtendedFetch".
I am using a CRecordset derived class to access the stored procedure. I am
unable to find the error.
THE STORED PROCEDURE'S HEADER:
Sp_Int_Ot_Ordendetrabajoalta ( lineatrabajo NUMBER, lv_orden NUMBER, usuario
VARCHAR2, idvehiculo NUMBER, fechamax1 VARCHAR2, resumen VARCHAR2, detalle
VARCHAR2,
coderp VARCHAR2, numtrabrecibidos NUMBER, lv_CODOT VARCHAR2, retorno OUT
INTEGER)
THE .H FOR THE CRECORDSET DERIVED CLASS (Visual Studio 6 comments removed)
class CRecSP : public CRecordset
{
public:
CRecSP(CDatabase* pDatabase = NULL);
DECLARE_DYNAMIC(CRecSP)
CString m_szSQL;
long m_RETORNO;
virtual CString GetDefaultConnect();
virtual CString GetDefaultSQL();
virtual void DoFieldExchange(CFieldExchange* pFX);
};
THE .CPP FOR THE CLASS (VS6 comments removed)
IMPLEMENT_DYNAMIC(CRecSP, CRecordset)
CRecSP::CRecSP(CDatabase* pdb) : CRecordset(pdb)
{
m_RETORNO = 0;
m_nParams = 1;
m_nDefaultType = snapshot;
}
CString CRecSP::GetDefaultConnect()
{
return _T( DB_CONNECTION_STRING );
}
CString CRecSP::GetDefaultSQL()
{
return m_szSQL;
}
void CRecSP::DoFieldExchange(CFieldExchange* pFX)
{
pFX->SetFieldType(CFieldExchange::outputParam);
RFX_Long(pFX, _T("[retorno]"), m_RETORNO );
}
USING THE CRECORDSET DERIVED CLASS: (Vars read from EditBoxes as CStrings
and formatted in the SQL)
CRecSP *rec = new CRecSP(&db);
szSQL.Format( "{CALL
FGROT2005.SP_INT_OT_ORDENDETRABAJOALTA(%s,%s,'%s',%s,'%s','%s','%s','%s',%s,'%s',?)}",
szLinea, szOrden, "USER", szIdVeh, szFechaMax, szResumen,
szDetalle, "ERP", "0", szCodOT
);
rec->m_szSQL = szSQL;
//rec->Open( CRecordset::forwardOnly,szSQL,CRecordset::readOnly );
rec->Open( );
iError = rec->m_RETORNO;
rec->Close();
-- modified at 3:49 Tuesday 6th September, 2005
|
|
|
|
|
Hello there.
I'm having difficulties on how I will add the data from one or several CStringArray to another CStringArray.
For e.g.
CStringArray strInfo[1] = { "12", "13", "14" };
CStringArray strInfo[2] = { "1", "2", "3", "4" };
CStringArray strInfo[3] = { "5", "6", "7", "8", "9", .... };
.
.
.
. and so on...
and the new CStringArray should have the data from strInfo[1], strInfo[2] and strInfo[3] ....
so it should be like this.
newStrInfo = { "12", "13", "14", "1", "2", "3", "4", "5", "6", "7", "8", "9", .... };
Please help me on this matter. Any help is much appreciated.
By the way, if it's possible to convert it in an integer array, please teach me too.
I also made the input data as integer array instead of CStringArray (int* strInfo[1], int* strInfo[2], int* strInfo[3]...) but still I can't pass the data into another data array.
Thanks and best regards.
With great power comes a great responsibility.
|
|
|
|
|
use this
details in MSDN, it`s a member of CStringArray
void InsertAt( int nStartIndex, CObArray* pNewArray );
CODE:
CStringArray strInfo1;
CStringArray strInfo2;
CStringArray newStr;
strInfo1.Add("TEST 1->1");
strInfo1.Add("TEST 1->2");
strInfo1.Add("TEST 1->3");
strInfo1.Add("TEST 1->4");
strInfo1.Add("TEST 1->5");
strInfo2.Add("TEST 2->1");
strInfo2.Add("TEST 2->2");
strInfo2.Add("TEST 2->3");
strInfo2.Add("TEST 2->4");
strInfo2.Add("TEST 2->5");
newStr.InsertAt( 0, &strInfo1);
newStr.InsertAt( strInfo1.GetSize(), &strInfo2);
for( int i=0; i
|
|
|
|
|
You can use CUIntArray instead of CStringArray, provided that you are using unsigned ints (==positive values).
Or, you can save your values as unsigned inte, and then (if you have to) cast them to signed ints.
Pseudo-code (should work, not tested):
for(i = 1; i < noOfArrays; i++)
{
for(j= 0; j < intInfo[i].GetSize(); j++)
newArray.Add(intInfo[i].GetAt(j));
}
|
|
|
|
|
Thanks for your help guys.
I found the Append function under CStringArray. I'll try to use it first, if this will not give the result I needed, I will try your solutions guys..
Thanks for the responds..
With great power comes a great responsibility.
|
|
|
|
|
Thanks for your help guys.
I found the Append function under CStringArray. I'll try to use it first, if this will not give the result I needed, I will try your solutions guys..
Thanks for the responds..
With great power comes a great responsibility.
|
|
|
|
|
The following is my code for the listctrl
/////////////////////////////////////////////////////////////
lvItem.iImage = m_nIcon;
for (int i = 0; i<200;i++)
{
nChk ++;
szTest.Format("%d",nChk);
m_test = szTest;
UpdateData(FALSE);
// Set up item
lvItem.mask = LVIF_TEXT | LVIF_IMAGE;
lvItem.iItem = 0;
lvItem.iSubItem = 0;
lvItem.pszText = LPTSTR(LPCTSTR(szTest));
m_List.InsertItem (&lvItem);
// Set up time and date
CString szTimeDate = timeTimeStamp.Format(LOCALE_NOUSEROVERRIDE,
LANG_USER_DEFAULT);
int nIndex = szTimeDate.Find(" ");
CString szTime = szTimeDate.Right(szTimeDate.GetLength() - nIndex - 1);
CString szDate = szTimeDate.Left(nIndex);
nListCount = m_List.GetItemCount();
if(nListCount >1000)
m_List.DeleteItem (nListCount-1);
nListCount = m_List.GetItemCount();
// Insert Subitem in list control (date)
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 1; // SubItem 1 is Date column
lvItem.pszText = LPTSTR(LPCTSTR(szDate));
m_List.SetItem(&lvItem);
// Insert Subitem in list control (time)
lvItem.iSubItem = 2; // SubItem 2 is Time column
lvItem.pszText = LPTSTR(LPCTSTR(szTime));
m_List.SetItem(&lvItem);
}
///////////////////////////////////////////////////////////
What I find is that the memory requirement increases as I increase the items
but as u can see I am removing the items from the List after the max. no of
items is reached still I find a large chunk of memory being taken up.
The memory requirement for say 1000 items is 2964K then it should remain the
same as I am deleting the extra items. How can I control this memory
requirement.?
Rohan
|
|
|
|
|
Make a virtual list...
NG
|
|
|
|
|
You are assuming that deleting an item from a list control, or freeing memory in general, automatically lowers your application's memory footprint. That is wrong. While freed memory does eventually make its way back to the available pool, Task Manager will show you what is effectively a high-water mark. In other words, just because you do not see it go down does not necessarily mean there is a problem.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
How do I check that the memory requirement for the EXE is within permissible limits.Since the action atleast indicates an increase in memory usage by the EXE.
As you say the Task Manager is not the true picture, but the memory usage shown in the same is certainly increasing.How do I solve that.
|
|
|
|
|
I'm not exactly sure what you are asking, but it sounds like you need to run your program trhrough all of the possible combinations, and then note the memory consumption via Task Manager right before you shut it down. That might give you a good-enough answer to the question, "In the worst case, how much memory does my program require to run?"
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Respected all
Regards!
I am a begginers n VC++.i have a problem.
" I have a number of images(bitmaps) that are stored on disk,I want to read all the images once and store all the images in a temprary storage area when my program runing instead of reading one by one image,I think "CImageList " will solve my prolem but not because this store all the images of same size and i have images of different sizes.
so plz help me that how i handle this problem
david
|
|
|
|
|
You can use CBitmap to load the bitmaps, but create the CBitmap objects dynamically.
And you can have a class variable like:
CPtrArray m_ptrBitmapArray;
CBitmap* b;
Do the following for all bitmaps.
b = new CBitmap;
b->LoadBitmap(...);
Then add the bitmap to the array.
m_ptrBitmapArray.Add(b);
You can again access them like:
CBitmap* b;
b = (CBitmap*)m_ptrBitmapArray.GetAt(0);
this is this.
|
|
|
|
|
Use a simple linked list of image data.
- Parhar
|
|
|
|
|
How can I get a Color of Control. The only information do I have is the handle of that control. How Can I Get and Set is Color. I tried out:
CDC* pDC = wndCtrl.GetDC();
pDC->SetBkColor(...);
I hope it wud worked but it didnt ... Any help on both ( getting and setting ) color of a control with above mentioned requirement.
Best Regards
|
|
|
|
|
class CStrEdit : public CEdit
{
protected:
COLORREF m_crTextColor;
COLORREF m_crBkColor;
CBrush m_brush;
...
...
...
};
...
...
...
...
CStrEdit::CStrEdit()
{
m_crBkColor = ::GetSysColor(COLOR_WINDOW);
m_crTextColor = ::GetSysColor(COLOR_WINDOWTEXT);
}
CStrEdit::~CStrEdit()
{ m_brush.DeleteObject(); }
BEGIN_MESSAGE_MAP(CStrEdit, CEdit)
ON_WM_CTLCOLOR_REFLECT()
ON_WM_CREATE()
END_MESSAGE_MAP()
// CStrEdit message handlers
HBRUSH CStrEdit::CtlColor(CDC* pDC, UINT nCtlColor)
{
if (m_brush.m_hObject) {
pDC->SetBkColor(m_crBkColor);
pDC->SetTextColor(m_crTextColor);
return (HBRUSH) m_brush.m_hObject;
} else
return NULL;
}
void CStrEdit::SetBkColor(COLORREF crColor)
{
m_crBkColor = crColor;
if (m_brush.m_hObject)
m_brush.DeleteObject();
m_brush.CreateSolidBrush(crColor);
}
void CStrEdit::SetTextColor(COLORREF crColor)
{ m_crTextColor = crColor; }
int CStrEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CEdit::OnCreate(lpCreateStruct) == -1)
return -1;
SetBkColor(m_crBkColor);
SetTextColor(m_crTextColor);
return 0;
}
Got the solution? Then rate this.
Nice talking to you.
|
|
|
|
|
Well I am doing it. Actually I am deriving a class from CFileDialog but I simply cant catch the WM_CTLCOLOR or WM_CTLCOLOR_REFLECT message whereas when I derive the class from CDialog then I am able to handle the message WM_CTLCOLOR or WM_CTLCOLOR_REFLECT. any help on it.
Regards
|
|
|
|
|
Ibraheem Khan wrote:
Set is Color. I tried out:
you have to Handle WM_CTLCOLOR message in your application
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Well I am doing it. Actually I am deriving a class from CFileDialog but I simply cant catch the message whereas when I derive the class from CDialog then I am able to handle the same message u mentioned. any help on it.
|
|
|
|
|
Hello,
I want code to creating DSN dynamically.
|
|
|
|
|
parims wrote:
I want code to creating DSN dynamically.
great ! that's all you want ? humm, let me see what i have in my bag... oh, here is this :-
void main(void) {
}
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|