|
HHOOK SetWindowsHookEx(
int idHook, // type of hook to install
HOOKPROC lpfn, // address of hook procedure
HINSTANCE hMod, // handle to application instance
DWORD dwThreadId // identity of thread to install hook for
);
The fourth parameter is a thread id,not a process id.
While I give it explorer.exe's process id ,the function can't succeed.
How can I do?
In DLL and use Detours.
Science is a forever enigmatic modified on Friday, April 25, 2008 3:34 AM
|
|
|
|
|
Hi,
dwThreadId Specifies the identifier of the thread with which the hook procedure is to be associated.U cannot give processid in place of thread.
A process can have only one process id. In a process is a main thread and one or more child threads. So both are different.If you want to hook Explorer window set the threadId(in SetWindowsHook) to 0 then in HookProc check the class name of the Window and if it is "CabinetWClass" using GetClassName API and hook it.
thanks
Nitheesh
|
|
|
|
|
Thank you very match.
I will try an experiment on it with you said.
But how to get a main thread id with process id?
modified on Sunday, April 27, 2008 9:03 PM
|
|
|
|
|
Hi,
use GetWindowThreadProcessId to get the id of the Thread
thanks,
Nitheesh
|
|
|
|
|
|
Hi all,
What function can I use that is similar to URLDownloadToCacheFile but with the ability to download the part of a file that wasnt downloaded if an internet disconnection happens. I am thinking of a windowsupdate type of download which if I stop downloading the updates I can resume where i stopped.
thanks,
Jj
|
|
|
|
|
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
I am having problems with INSERTING 'err' value, where the value always change(dinamic).
The error I am getting at runtime is "too few parameters expected 1". This is a part of the inserting program.
float err;
CDatabase db;
CString SqlString;
db.Open("ODBC;DSN=db");
SqlString="INSERT INTO report(ERROR_VALUE,STATUS) VALUES(err,'OK')";//value of 'err' not statis
db.ExecuteSQL( SqlString );
the program will run properly if syntax of inserting like this.
SqlString="INSERT INTO report(ERROR_VALUE,STATUS) VALUES('err','OK')";
but the output not value of "err", but string "err".
anyone can help me????
|
|
|
|
|
neo on poltek wrote: SqlString="INSERT INTO report(ERROR_VALUE,STATUS) VALUES(err,'OK')";//value of 'err' not statis
try,
SqlString.Format(_T("INSERT INTO report(ERROR_VALUE,STATUS) VALUES(%f,'OK')"), err);
|
|
|
|
|
SqlString="INSERT INTO report(ERROR_VALUE,STATUS) VALUES(";
SqlString += "'";
SqlString += err;
SqlString += "'";
SqlString += ",'OK')";
I think it is working please check.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
I used the following code to show an image in the row of a listcontrol.
LV_ITEM lvi;
CString item,symbol;
symbol = card.Right(1);
int len = card.GetLength();
item = card.Left(len-1);
lvi.mask = LVIF_IMAGE | LVIF_TEXT ;
lvi.iItem = 0;
lvi.iSubItem = isubItem;
lvi.pszText = item.GetBuffer(item.GetLength());
lvi.stateMask = LVIS_STATEIMAGEMASK|LVM_SETITEMSTATE;
if(symbol.CompareNoCase("C")==0)
lvi.iImage = 0;
else if (symbol.CompareNoCase("D")==0)
lvi.iImage = 1;
else if(symbol.CompareNoCase("H")==0)
lvi.iImage = 2;
else if (symbol.CompareNoCase("S")==0)
lvi.iImage = 3;
player1.SetItem(&lvi);
There are 13 columns in the row. and there is only one row.
I wanted the image to be shown in every column of that row. But the image is being shown only in the first column. How to make it.
Thank you
Saadhinchaali
|
|
|
|
|
Saadhinchaali wrote: How to make it.
You have to set LVS_EX_SUBITEMIMAGES style inorder to display images in subitem.
player1.SetExtendedStyle( player1.GetExtendedStyle()|LVS_EX_SUBITEMIMAGES );
|
|
|
|
|
Hi,
I am getting the problem to select multiple files.And DoModal is returning 2(IDCANCEL). Code is below:
<br />
<br />
TCHAR szFilters[]=_TEXT("All Files (*.*)|*.*||");<br />
CFileDialog fileDlg (TRUE, _TEXT(""), _TEXT(""),OFN_FILEMUSTEXIST|OFN_EXPLORER|OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY, szFilters, this);<br />
<br />
TCHAR * pc = new TCHAR[4096]();<br />
fileDlg.m_ofn.lpstrFile=pc;<br />
fileDlg.m_ofn.nMaxFile = 4096;<br />
int nResVal=fileDlg.DoModal();<br />
<br />
What is the problem with it?
|
|
|
|
|
pther wrote: What is the problem with it?
The preblem is in
fileDlg.m_ofn.lpstrFile=pc;<br />
fileDlg.m_ofn.nMaxFile = 4096;
ASAIK you dont have to those parameter. You can get all the files selected using the GetStartPosition and GetNextPathName function.
TCHAR szFilters[]=_TEXT("All Files (*.*)|*.*||");<br />
CFileDialog fileDlg (TRUE, _TEXT(""), _TEXT(""),OFN_FILEMUSTEXIST|OFN_EXPLORER|OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY, szFilters, this);<br />
int nResVal=fileDlg.DoModal();<br />
POSITION pos = fileDlg.GetStartPosition();<br />
while( pos )<br />
{<br />
CString cs = fileDlg.GetNextPathName( pos );<br />
}
|
|
|
|
|
Without spacifying size of buffer, how could you get the all files path.
I read to define as on another forum.
|
|
|
|
|
pther wrote: Without spacifying size of buffer, how could you get the all files path.
Ok. MFC sets a buffer of length 256 in its constructor. But in your case that buffer will not be enough.
Any way just set the first element of the buffer as 0 after allocationg the buffer. Like..
TCHAR szFilters[]=_TEXT("All Files (*.*)|*.*||");<br />
CFileDialog fileDlg (TRUE, _TEXT(""), _TEXT(""),OFN_FILEMUSTEXIST|OFN_EXPLORER|OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY, szFilters, this);<br />
TCHAR * pc = new TCHAR[4096];<br />
pc[0] = 0;<br />
fileDlg.m_ofn.lpstrFile=pc;<br />
int nResVal=fileDlg.DoModal();
|
|
|
|
|
|
I was not able to spot any problem with the code so I just tried your code in a new MFC dialog based application and it is working fine. So I guess problem is somewhere else.
-Saurabh
|
|
|
|
|
|
If the number of files you select is causing it to fail, then your buffer is probably too small. With a buffer of 4096 and 160 files, that's only 25 characters per file.
Acccording to MSDN:
If the buffer is too small, the function returns FALSE and the CommDlgExtendedError function returns FNERR_BUFFERTOOSMALL. In this case, the first two bytes of the lpstrFile buffer contain the required size, in bytes or characters.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
I am trying with VS 2008 under Vista and even if buffer is small I do not get FNERR_BUFFERTOOSMALL. CFileDialog simply return files it can with the given buffer. I couldn't find anything specific to this in MSDN.
-Saurabh
|
|
|
|
|
I am using VS 2008 on Vista and it works even with 1000 files.
-Saurabh
|
|
|
|
|
You can call
DWORD error = CommDlgExtendedError();
to find out what exactly is the problem.
-Saurabh
|
|
|
|
|
Hi,
your code works fine for me also.
thanks,
Nitheesh
|
|
|
|