|
I forgot to mention, if you use a subfolder of "Program Files" like is typically used in
installations then your apps can use GetEnvironmentVariable()/SetEnvironmentVariable() to
set their own process PATH environment variables if necessary (to point to your common DLL
folder).
|
|
|
|
|
I'm wondering if anyone knows of a reasonable way to jump from an Application Hwnd to an associated processID or vice cersa. I've found much information on enumerating either running applications (EnumWindows) or active processes (PSAPI EnumProcesses, for instance), but I can't see any way to get from a processID I'm interested in to its main window handle or from an application Hwnd to its processID (and from there to its loaded modules). Hopefully I've missed aomething obvious. Suggestions appreciated.
AJ
|
|
|
|
|
Have a look at GetWindowThreadProcessId API for the reverse operation, I don't know.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
DOH! Thanks much.
I shall fume for a while over why MSDN has such retarded search capabilities that it couldn't produce this from looking for "processid" or "process identifier" or "GetWindow", but I'll get over it. It is in the Index if I'd looked there.
P.S. Alfonso might just as well have been referring to Mr. Gates.
|
|
|
|
|
AJarrett wrote: P.S. Alfonso might just as well have been referring to Mr. Gates
I absolutely agree
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi.
> I can't see any way to get from a processID I'm
> interested in to its main window handle
There is no direct way, but you could use a combination of EnumWindows and GetWindowThreadProcessId calls. There is a MSDN article discussing this issue: Get the Main Window, Get EXE Name[^]
> .. or from an application Hwnd to its processID
This one is trivial through the GetWindowThreadProcessId API.
|
|
|
|
|
Hello,
I have a tricky problem and I hope someone might give me a hint or a suggestion. The problem is caused by an application that acts as a proxy server with filtering capabilities which is installed on a machine and receives the HTTP traffic from the LAN to the Internet and filters the HTTP traffic from the Internet to the LAN. For small LANS (5 – 10 PC’s is working fine) but for larger networks an error is frequently raised: WSAECONNRESSET – connection reset by peer. As far as I know this problem is caused by the use of blocking sockets (which is not the case) or by a TCP Stack overflow.
Can anyone point a good article about how to avoid a TCP Stack overflow or knows a good tool that allows me to monitor the TCP Stack?
The application is developed in Visual C++ 6.0.
Thank you,
Best Regards,
Dan.
-- modified at 9:25 Wednesday 20th December, 2006
|
|
|
|
|
I do not know the answer to your problem and I do not pretend understand the internals of a particular TCP/IP implementation, but if on Win32, you solution may be just a registry tweak away.
Do you have any loggings/stats from the application or Performance Counters that shows a "trigger" point where you start to have problems? Knowing if/what that value is (memory, handles, etc.) would be a good place to start in looking for solutions IMHO.
That error, if being received by your application, is usualy the result of the other side dropping the connection. Are you sure there is no other hardware between your application and the Internet that may be getting overloaded or is faulty? Or is that error being raised in other applications (like IE) that are going through your app?
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!)
|
|
|
|
|
Hello James,
Thank you for the reply. The probability that the error is raised by a different network device is almost 0 because it was tested on different platforms and different LAN and the error keep appearing. I am convinced that somehow (I do not know exactly how) the application does not correctly close the connections and this error keep raising.
Regards,
Dan.
|
|
|
|
|
I got curious and bumped into this:
http://laurentszyster.be/blog/tcp-stack-flaking-out/[^]
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!)
|
|
|
|
|
Thanks,
I will read it right now.
Regards,
Dan.
|
|
|
|
|
This may be totally unrelated, but if you are using listen(), what happens if you use a
larger backlog value? SOMAXCONN is typically 5 which may cause alot of refused connections
if they come in fast enough.
|
|
|
|
|
Hi Guys
What's the way to get the Item & subItem when I double clic in a CListCtrl
That's what I have, but, how to get Item & SubItem from that?
void CDlgDebug::OnDoubleClickList(NMHDR* pNMHDR, LRESULT* pResult)
{
}
|
|
|
|
|
Look up the NMLISTVIEW structure - you will be casting the NMHDR pointer to a NMLISTVIEW pointer and getting the information from it.
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!)
|
|
|
|
|
Thanks, I'll take a look.
|
|
|
|
|
HI,
Iam Doing An application Using Tree Control.
My problem is If I double Click on Any Root Item on the Tree That Should be display in one Edit Box.
But Iam not Getting .
plz check this code
void CTreeItem::OnDblclkTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
// m_Tree is Tree Control Variable
HTREEITEM hItem = m_Tree.GetRootItem();
if ((hItem != NULL) && m_Tree.ItemHasChildren(hItem))
{
m_Tree.Expand(hItem, TVE_EXPAND);
m_Tree.EnsureVisible(hItem);
}
CString str=m_Tree.GetItemText( hItem );
UpdateData(FALSE);
CDUXmlRuleDlgDlg duxml;
// m_strNodeName is My Edit Box Control Variable.
duxml.m_strNodeName = str;
UpdateData(FALSE);
*pResult = 0;
}
plz check this
|
|
|
|
|
If I've understood your intent, I think you want to have the edit box filled with the item text from the node you double clicked. The HTREEITEM returned by GetRootItem is instead going to point to the root of the entire tree control. Try using GetSelectedItem.
|
|
|
|
|
Krishnatv wrote: My problem is If I double Click on Any Root Item on the Tree That Should be display in one Edit Box.
That edit box is on CDUXmlRuleDlgDlg , but in your code, I cant see , you have invoked it.
Krishnatv wrote: CDUXmlRuleDlgDlg duxml;
// m_strNodeName is My Edit Box Control Variable.
duxml.m_strNodeName = str;
UpdateData(FALSE);
UpdateData should be called here on you dialog object, after displaying it.
|
|
|
|
|
Dear All,
I have a MFC application and also i am having a COM interface with that application. Both are running at the same address space.
Now that MFC application is up, when I call that COM interface from different program, everything goes correct. well.
After the COM fn execution is done, the MFC application goes out of memory (application stoped).
What is the reason for this?
I need to have MFC application to be in memory still even COM fn is done.
To do this, what should i do ? How can i do this ?
Kindly help me.
Thanks.
|
|
|
|
|
I believe that this is the default behavior for COM Servers.
You can check the command line to see if you are being launched normally (no /Embedding or /Automation parameters), and manually bump your internal COM reference/instance count once. That will prevent unloading when a COM client connects (bumping the instance count) and disconnects (decrementing the instance count), because your instance count will still be above zero. You can use the CCommandLineInfo object used in your app's initialization and checks its members.
Be sure to also manually decrement the count when the user manually shuts your app down so that it unloads correctly, or your app will hide but keep running in the background.
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 have an OpenMutex() api call which I have fished out of a decompiled dll. The access rights member in the call is 0x00100000 . I have looking through the winnt.h header file trying to figure out which definition this would equate to, but I just cannot see it in there. Does anybody know what it is?
|
|
|
|
|
some times they might have made a custom security descriptor..
nave
|
|
|
|
|
SYNCHRONIZE (0x00100000L)
The right to use the object for synchronization. This enables a thread to wait until the object is in the signaled state.
Link[^]
Last modified: 2mins after originally posted -- link added
I don't believe in failure. It is not failure if you enjoyed the process.
|
|
|
|
|
Ahh thanks for that. I did see that macro, but MSDN was throwing me off a little.
|
|
|
|
|
I want to have a class in two namespace . If you know how its possible , please share with me .
In other word :
<br />
namespace A<br />
{<br />
class cls1<br />
{<br />
public:<br />
cls1()<br />
{<br />
};<br />
}<br />
}<br />
<br />
namespace B<br />
{<br />
????????
}<br />
<br />
main()<br />
{<br />
A::cls1 var1;<br />
B::cls1 var2;<br />
}<br />
<br />
Thanks a lot .
|
|
|
|