|
I use the wizard to create a new MFC ActiveX control, and debug it with tstcon32.exe.
Just add a simplest method,
VARIANT test(VARIANT & v1,VARIANT & v2,VARIANT & v3);
It leaks memory, why?
logics
|
|
|
|
|
hi
i've just a simple question which i couldn't find anywhere a proper answer for it.
in this function, pNMHDR is reinterpreted to LPNMLISTVIEW as u know. i like to know what's the meaning of the last parameter of this struct. i mean lParam. it says it's the application defined 32 bit value. how can the application define this value? is this the same 32 bit value which is assigned to each item by SetItemData?
thx
|
|
|
|
|
ilostmyid2 wrote: is this the same 32 bit value which is assigned to each item by SetItemData?
Yes.
|
|
|
|
|
A common use for the per-item data is allocating a struct with new and storing a pointer to that struct in the lParam . Then when the item is deleted from the list, you delete the struct.
|
|
|
|
|
Hi,
I have 2 Process which I am using in Client/server Mode
The Client is Dos Console Project The Server is a Windows GUI
I am using Event(s) to Synchronize the Process(s) When I spawn the
Child Process I set bInheritHandles to TRUE
In The Parent Process when I Create the Event i specify an name to
identify the Event in Addition to I set the Security Attributes
structure I set bIheritHandle to TRUE however I set
lpSecurityDescriptor to NULL
Later in the Child Process When I try OpenEvent, using the name
I used to Create The Event to get the the Event handle
NULL is returned
The Only think I can think the I missed is setting the
SecurityDescriptor
Would anyone Know if this neccesary for me to do in Order to
Inherit the Event in the Child Process
Thankx
|
|
|
|
|
ForNow wrote: I used to Create The Event to get the the Event handle
NULL is returned
How did you communicate across process, the details of the event! Event Handles do not cross Process Boundaries as far as I know.
BTW why not read a few books about the subject first!
regards
Bram van Kampen
|
|
|
|
|
ok
thankx for responding
I'll be more specfic If I do a WriteFile using the Async method
Meaning the named pipe was Created with FILE_OVERLAPPED I/O
In The GUI process
Then When the DOS console process does A ReadFile
then isn't hEvent in the Overlapped structure Shared or Inhertted by
both process ???
unless I'm misundertanding The Read/Write File
used by Named Pipes for InterProcess Communication ???
|
|
|
|
|
In the book Windows via C/C++
By Jeffery Richter
In Chap 3 on Kernel Objects
On Page 43 The paragraph titled SHARING KERNEL OBJECTS ACROSS PROCESS BOUNDRIES
These are 3 bullets re: some of the reason to share Kernel Objects
the second bullet mentions named pipes
while the third bullet says events are shared across process boundries for syncronization
guess thats where I got the idea
I could not be understanding why kernel objects are shared by process
|
|
|
|
|
Are you sure your event has been created before opening in the child process? Please ensure using WinObj.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
I Checked the handle return from CreateEvent
it had a valid Value
I added code to Create Security DisCriptor TO the Create Event
I am going to try that out
The Only thing I am not 100% certin is Whether Readfile And Write
Share/Inherit the same OverLapped.hEvent
Logically it would seem they would
|
|
|
|
|
Did you check the error using GetLastError()? What's the error code/message you're getting?
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Yes it was 0x002 FILE_NOT_FOUND
Does really make sense ???
|
|
|
|
|
ForNow wrote: Yes it was 0x002 FILE_NOT_FOUND
Does really make sense ???
It should make sense. I strongly believe the event doesn't exist in the system when you tried to open it. So please check the source where the even being created and also check if the application calling "CloseHandle" before spawning the child process.
Debug your client program and just before you open the event, verify whether it exists or not using tools like WinObj.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
|
I couldn't get anywhere with WinOBJ However I did notice the Handles Column in Task Manager go up by one
When after I executed the CreateEvent
|
|
|
|
|
Hope you've created a named object. The objects with exclamation mark represents events. The tool lacks a "Find" option. Sort it and find it out yourself. Kernel objects will be appeared under "BaseNamedObjects" in the tree
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
The Event I have Created is named While stepping thru the Code with the Visual Studio Debugger after CreateEvent seems like a Handle is Returned
However when I go to WinOBj under --> KenerelObjects Tab there are only two named events HighMemoryCondition and LowmemoryCondition
|
|
|
|
|
I wrapped the event name inside the TEXT macro for Create and Open Event
and it worked
|
|
|
|
|
How you'd able to compile the source code?
OpenEvent() is Unicode ANSI compatible. if your project settings is to use Unicode character set, then you will have to pass Unicode string.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
I changed that in the Build to non unicode I seem to be
making progress
|
|
|
|
|
|
you havnt been around here for long, so you probably missed the bit that goes "we dont do people's homework/assignments/yada yada", even if we do feel a little sorry for them ...
If you post any attempt at code you've got we can use that as a starting point...
I'd suggest (since you say you're using c++) you look at :-
'string' : to hold the filename and a copy of each line in the file - you should only need two string instances to start with
ifstream : to access a data 'stream'/file for input
getline : to get one line of input from the stream/file into a string
while :(loop construct) to loop for all lines in the file until eof (end-of-file) is detected.
for starters.. you'll need to include appropriate headers - I'd suggest fstream, iostream and string ... once you can loop through a file and print its output to 'cout' or such, then think about how each line in the file needs to be split up/parsed to go into your array
'g'
|
|
|
|
|
Hey everyone,
I've been getting some rather interesting results from my LL_KEYBOARD hook recently. Here is my code:
LRESULT CALLBACK LowLevelKeyboardProc (INT nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode < 0 || nCode != HC_ACTION)
return CallNextHookEx( hKeyboardHook, nCode, wParam, lParam);
KBDLLHOOKSTRUCT* p = (KBDLLHOOKSTRUCT*)lParam;
char logchar=(char)p->vkCode;
It was working fine for a week, but I was adding KEYUP detection for the Ctrl, Alt, and Shift keys when it started giving me unexpected results.
The problem is that when I press the Ctrl key, logchar is equal to -72. I'm surprised by that, since I'm pretty sure the vkCode for the control key is 0x11. Because of this, I'm not detecting the Ctrl keypress, and ToAscii outputs the value for the ctrl key incorrectly. (It's outputting something that looks like a cent sign. If someone could explain why ToAscii accepts -72 as a valid vkcode that would also be appreciated)
The same problem occurs with any non-character key (except for space).
If anyone has any ideas on this I would highly appreciate it.
Thanks in advance.
|
|
|
|
|
the char type has the range of -127 to 128. you want to use an unsigned char which has the range of 0 to 256.
|
|
|
|
|
Ok. I changed it and now the ctrl key is giving a value of 162, which is still not equal to VK_CONTROL (0x11).
|
|
|
|