|
I used of Task manager for get PID
|
|
|
|
|
Ok, I ran that exact code, only changing:
if (te32.th32OwnerProcessID == 4948)
and it produced:
THREAD ID = 0x00000CB8
base priority = 8
delta priority = 0
THREAD ID = 0x00000B18
base priority = 8
delta priority = 0
THREAD ID = 0x000014B0
base priority = 15
delta priority = 0
Given calc's three threads, that's what I would expect.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 11-Dec-12 13:02pm.
|
|
|
|
|
Got it rise and shine sleepyhead it has 3 "THREAD ID " so its 3 threads for calc.exe,is it correct?
|
|
|
|
|
Who's got experience with this class then? Examples and documentation seem pitifully thin on the ground.
I'm just playing with it to see if it's the right control for a new development.
At the moment I'm wondering how to add a button to a property. The doc suggests overloading the protected "HasButton" function
"Indicates whether a property contains a button." says MSDN
So I don't know if I'll get a button by overloading this and returning TRUE because my overloaded function never gets called; other protectesd functions that don;t ever seem to be called are Init, CreateCombo or IsValueChanged
maybe I'm contructing my CMFCPropertyGridProperty wrong?
Thanks for looking.
|
|
|
|
|
I'm getting the same behavior as I suspect you did trying to override the CreateCombo function in a property class derived from CMFCPropertyGridProperty. Did you ever resolve this?
AlexJ
|
|
|
|
|
Hi,
I want to hook the task bar for that I have used SetWindowHookEx() function in a DLL.
But it it not working all times.
I know the task manager handle using FindWindow() API.
I want to catch the window procedure of the task bar using the task bar handle?
how to do this please help me?
|
|
|
|
|
You can find this information using the GetWindowInfo function[^] to get the class reference of the window, and then GetClassInfoEx [^] to find the pointer to the Windows procedure.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
You might use GetWindowLong with GWL_WNDPROC as second parameter (see MSDN[^]).
Veni, vidi, vici.
|
|
|
|
|
Hi,
I need some clarification on one point. We normally use static variables in C/C++. We say when we have used a static variable inside a function, it persists its previous value when that function is called again & again, e:g: to say, static variable retains its last value when that function is called again.
Can anybody explaing me the logic behind this. How a static variable knows its last value and how it is not initialized everytime on the function call.
Regards,
Mbatra
|
|
|
|
|
Because a static variable, even when declared in side a func, is created in the DATA section of a programs run space. Think of it like a global static variable that gets initialised to zero and whose value is of course persistent.
An ordinary variable declared inside a func is created on the stack. This of course winds back and forwards so when the func returns the space that variable used is lost to the next func you call.
|
|
|
|
|
|
Stackoverflow? The competition? Are you mad?
|
|
|
|
|
Please read that. carefully. ok..
|
|
|
|
|
Why? Are you saying I am wrong?
|
|
|
|
|
I am in over my head again.
I am getting error C2664 and I did read the Tech note ( something about ANSI improvement) about it and frankly I just do not understand what is the problem and <b>how to fix it in VC6.0.</b>
Do I have to redefine the GUID_DEVCLASS_COMPUTER?
The parameter GUID is defined in both functions as “const GUID*”
The API fails with this error C2664 and C_GetClassImgIndex compiles OK
error C2664: 'SetupDiGetClassImageIndex' : cannot convert parameter 2 from 'const struct _GUID *' to 'struct _GUID *'
Conversion loses qualifiers
Fails
b = SetupDiGetClassImageIndex(&m_imgList, &GUID_DEVCLASS_COMPUTER, &nRootImg);
OK
int n = C_GetClassImgIndex(&GUID_DEVCLASS_COMPUTER);
Any help would be greatly appreciated.
Cheers
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: The API fails with this error C2664 You are not using the API, this is a compiler error.
Vaclav_Sal wrote: cannot convert parameter 2 from 'const struct _GUID *' to 'struct _GUID *' You are passing a const parameter to a function that does not expect one. Use const_cast [^] to remove it. But be sure you understand the potential consequences.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Richard ,
I do not follow your explanation.
In this MSDN doc the second parameter is defined as const GUID*.
Am I using wrong version ot the Setupapi.h?
PS Did you read the title? I did say compiler error.I do appreciate your help, but growing little tired of your sideline remarks,that's all.
http://msdn.microsoft.com/en-us/library/windows/hardware/ff551074(v=vs.85).aspx
BOOL SetupDiGetClassImageIndex(
_In_ PSP_CLASSIMAGELIST_DATA ClassImageListData,
_In_ const GUID *ClassGuid,
_Out_ PINT ImageIndex
);
|
|
|
|
|
Vaclav_Sal wrote: _In_ const GUID *ClassGuid,
The pointer is a constant, not the structure.
|
|
|
|
|
Oh come on man, it is the C language. If the compiler bitches just cast it out. YOU are in control. YO are the master!
|
|
|
|
|
Have you tried something like this:
GUID tmp(GUID_DEVCLASS_COMPUTER);
b = SetupDiGetClassImageIndex(&m_imgList, &tmp, &nRootImg);
|
|
|
|
|
Hi,
I tried to port the fork API in Linux to Windows (Windows 7 and Windows 8) using the native API RtlCloneUserProcess as discussed in the following link.
http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/afdf1b68-1f3e-47f5-94cf-51e397afe073/
With the RtlCloneUserProcess function, child process is created, but didn’t get the console handle, stdin, stdout etc. The solution is to inform the CSR /win32 subsystem about the new process. But I could not able to do that. Please help me to re link the child process to the CSR.
|
|
|
|
|
How do you declare a TBYTE in C and declare a pointer to a location to be used as a TBYTE? I know how to do it in MASM, but how do you do it in C?
Dave.
|
|
|
|
|
This should help you:
typedef unsigned char tbyte[10];
int main()
{
tbyte a;
a[0] = 3;
return 0;
}
The drawback is it doesn't initialize the array for you.
My 2 cents: Please don't mix different languages' idioms. Each language is meant for a different purpose.
If you need to, you can easily use assembly. VC++ supports inline assembly. Otherwise, you can write a separate asm file and then link the resulting object file to your exe.
|
|
|
|
|
manoranjan,
I didn't think about using a typedef. I understand how to use in-line assembly, but without the typedef, trying to do
fld tbyte ptr var
fails.
Thank you for the answer.
I have re-written ENT in MASM to try to speed it up for huge files. I first modified ENT to handle the huge files, but it was terribly slow (for my 16 GB file). It took 32 minutes to process. I have cut that down to 10 minutes with my entmasm, and I am trying to validate the calculations by using printf statements in both to display all of the calculation inputs and outputs (for a VERY SHORT 10 BYTE file), but in the entropy calculations, the results do not quite match. The C compiler (visual Studio 2008) is optimizing the code and keeps most of the intermediate results on the FPU stack in temporary real format. My masm code was pretty brutal and kept each calculation separate, saving results in memory. I was using doubles (real8) for storage, and I think that the loss of precision when saving an FPU value as a real8 is what caused the result differences. I will convert my masm code to use tbytes and modify the ENT C code to do the same, and see if that makes the results match.
One other question. ENT has several 256 entry arrays for the counts and probabilities. If I change these arrays of 256 tbytes (10 BYTES each), will the mod 16 mis-alighment cause performance problems? Would it be better to make them arrays of owords (16 BYTES) and just index by 16 instead of by 10? I am not worried about the extra memory, I have GIGA BYTES of unused memory.
Dave.
|
|
|
|
|
Yes, misalignments cause performance issues on x86 (and seg fault on ARM processors).
Speaking of performance... also consider fitting your data structure (by padding) in a CPU Cache Line. This should also improve performance.
Finally, a (stupid?) question from me: What is ENT?
|
|
|
|