|
see AnShUmAn_ answer i think it work in your program
whitesky
|
|
|
|
|
I set WINVER to 0x500 and _WIN32_WINNT to 0x500 and it works
|
|
|
|
|
I write CAD software. I use C++. I am not very good at it!
And I have a question.
My software is need to manage, say, n number of AutoCAD files as one project. I extract the same kind of information from each drawing and keep it in another file for future use. I call this resulting files my Project file. From each drawing file I extract data that can be fit into a structure that looks like this:
typedef float point[2];<br />
struct FileData{<br />
char FileName[MAX_SIZE];<br />
int ElementHandles[A][B];<br />
point ElementLocation[A][B];<br />
}
A project can have any number of files. I am currently using a vector of type FileData to store my info at runtime and write data to the project files as memory mapped file when I am done processing.
How do you guys suggest I do it? Any other ideas?
Abhishek
-- modified at 6:38 Tuesday 27th June, 2006
|
|
|
|
|
Hello,
I'm experiencing a trouble while setting a hook procedure form an NT Service. Hook procedure is intended to capture keyboard events (WH_KEYBOARD). Thread, that installs the hook, calls SwitchDesktop to switch to desktop, that receives user input. SetWindowsHookEx returns non-null hook handle, but the hook procedure is not ever called. Are there any prerequisites I'm missing?
|
|
|
|
|
Is it a SytemWideHook or ThreadSpecific Hook and were is the hook procedure
present.
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
This is a system-wide hook, the hook procedure resides in a DLL. This DLL is loaded by a service, then the hook is installed.
|
|
|
|
|
I would start by creating a little app and running it under the debugger. Make sure you see your hook's DLL getting loaded into the running process. If not, then the hook is not getting installed correctly.
If it is being loaded into the running process, then perhaps the way the events are being filtered is incorrect?
Also, what desktop are you in when the hook is installed? Generally, hooks only work in the desktop that the hook is installed in.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
u can specify the ALLOW_OTHER_ACCOUNT_HOOK and make the service interractive to input desktop
hello
|
|
|
|
|
I am not familiar with the ALLOW_OTHER_ACCOUNT_HOOK in the context of hooks, and MSDN is not helping me here. Where is this value documented?
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
http://support.microsoft.com/kb/163892/EN-US/
hello
|
|
|
|
|
Yes, I now know that DF_ALLOWOTHERACCOUNTHOOK was the identifier you were trying to refer to.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Thank you for your reply.
I've eventually tested the hook in a small console application first. The DLL is getting loaded properly, the hook works ok.
Concerning the service, I allow it to interact with desktop and use the following code to switch the desktop before setting hook:
HDESK hUserDesktop = ::OpenInputDesktop( DF_ALLOWOTHERACCOUNTHOOK, FALSE, GENERIC_ALL );
::SwitchDesktop( hUserDesktop );
HHOOK hHook = ::SetWindowsHookEx( WH_KEYBOARD, prHook, bfInst, 0 );
All of these function return successful results. I'm aware I'm missing some important stuff to do.
|
|
|
|
|
Are you sure the hook is really not getting executed? You cannot set a breakpoint in the debugger with the service loaded and expect to see it fire from within the service, because the hook is getting loaded into the target processes, and it will fire under the context of those processes.
If you do something like using OutputDebugString(...) to write out a string to the debugger (do not use TRACE/TRACEx(...) ). Using the console application under the debugger, you should be able to see the output from that function if it is being fired.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Thank you for your reply!
I use ::OutputDebugStringA() to enable debug output and DbgView from sysinternals to capture this output. This pair works, as I receive debug output during serivce initialization. But still no output from hook.
|
|
|
|
|
Sorry - no other idea other than that the hook is just not getting across to the different desktop...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I've got it at last! The problem was with security settings of some of synchronization objects. Being created withing a service, they had their owner set to SYSTEM and none of user code could ever open them (although, this code works if it is run from a test application under my account)
Anyway, thank you for your ideas!
|
|
|
|
|
i am working in MFC. i have taken a file name with file path from user how to check whether that file exist or not
prashant jain
|
|
|
|
|
BOOL PathFileExists(LPCTSTR pszPath);
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
thanx
prashant jain malviya national institute of technology
|
|
|
|
|
See
WIN32_FIND_DATA m_data;
HANDLE hFile;
hFile=FindFirstFile(filename,&m_data)
if(hFile==INVALID_HANDLE_VALUE)
else
FindClose(hFile);
</code>
or see _access
whitesky
|
|
|
|
|
hi everyone,
can anyone give me information regarding peer to peer file sharing
Regards
venu
|
|
|
|
|
Im not sure seeHere[^] maybe it is some helpful to you
whitesky
|
|
|
|
|
Does anyone know the correct grammar for allocating a multidimensional array on the heap?
I have tried:
CHAR **Z = new CHAR[15][10];
CHAR *Z = new CHAR[15][10];
Upon further investigation is appears that C++ treats multidimensional arrays as distinct data types. This means that the problem in the above examples is that it can't assign a multidimensional array TYPE to any of the pointer types I have tried.
It has no problem, however translating between simple pointer types and SINGLE dimensional arrays. I suppose that the language is required to keep track of the number of elements in each dimension, so that it can perform the proper indexing when you supply subscript operators. So this must be the reason that the arrays are incompatible with simple pointer types, because simple pointer types do not carry such information around with them.
|
|
|
|
|
I think if you declare a pointer in this manner:
CHAR (*Z3)[10];
then you can assign any bi-direction array having 10 columns:
Z3 = new CHAR[15][10];
. . .
Z3 = new CHAR[50][10];
. . .
CHAR tab[30][10];
Z3 = tab;
It is easy to access an element:
I = Z3[2][7];
This approach can be used for multi-dimensional arrays too:
CHAR (*Z4)[10][30] = new CHAR[15][10][30];
int k = Z4[1][2][3];
Since for indexing the compiler does not need to know the first size of the arrays, it can be a variable:
Z4 = new CHAR[m][10][30];
|
|
|
|
|
Hi, it works! Thank you so much.
I wish I knew the theory behind why the declaration has a different meaning if you put the pointer name inside parenthesis.
Thanks again!
|
|
|
|