|
I am trying to program a Network Monitoring software using the C++ language for MS Windows and having trouble with monitoring the network activity in live. I want to display a messege box everytime a program is starting to listen for connection or starting to connect to another server. And also want to find out the IPs and ports (Local and Remote) involved in this activities. The think is a user should be able to allow or block the activity (just like the Norton and PC-Cillin do). 'IMPORTANT THINK IS I DO NOT WANT TO USE MFC AT ALL'
Thanks.
It's me
|
|
|
|
|
Hi,
I would really appriciate som help with a difficult task regarding WMI and C++.
I would like to call the Method GetOwner() from the Win32_Process Class after query on a process.
This is the equavilent Visual Basic code:
Public Function getownerwmi(ByVal pid As Long, ByRef wmiowner As String) As Long<br />
Dim colProcessList<br />
Dim objprocess<br />
Set colProcessList = GetObject("Winmgmts:").ExecQuery("Select * from Win32_Process where processid = " & pid)<br />
If IsObject(colProcessList) Then<br />
For Each objprocess In colProcessList<br />
<br />
ret = objprocess.getowner(struser, strdomain)<br />
wmiowner = struser<br />
getownerwmi = 1<br />
Next<br />
End If<br />
Set colProcessList = Nothing<br />
Set objprocess = Nothing<br />
End Function
I have looked throught these articles but I cant figure out where to call the GetOwner method:
MS Article:
http://msdn2.microsoft.com/en-us/library/aa384833.aspx[^]
MS Article 2:
http://msdn2.microsoft.com/en-us/library/aa390421.aspx[^]
Article on Code project:
http://www.codeproject.com/system/UsingWMI.asp?df=100&forumid=185770&exp=0&select=1509450#xx1509450xx[^]
Any help would be really appriciated!
|
|
|
|
|
|
Hi,
Yes i Looked at that article but it only describe how to get the information using a query, I cant figure out how to run a method liked the "getowner" method on my VB example.
If anyone have done this or know how, please post a short example.
|
|
|
|
|
Hello,
Can someone tell me how to use a class library from the Steinberg VST SDK?
Steinberg documentation is lacking.
Thanks,
sa
-- modified at 23:39 Sunday 28th January, 2007
|
|
|
|
|
Hello, i am one of those who try to create game, but i don't know how to start creating server-client side engine, so if anyone would like to help, it would be very much appreciated, if anyone would like to help then you can also visit www.prophecyofwar.com , that's my homepage. The page maybe won't show with first time, but it with several tries, because my host is moving to multiple hosts, it will for about 10h still.
Best regards,
reyyy
|
|
|
|
|
Maybe someone knows any guide or tutorial to how to create server-client side engine?
|
|
|
|
|
HI,
I am using a setwindowsHook() with WM_GETMESSAGE in VC++.NET
The purpose is to detect any left mouse button click.
It does detect. however, it was processed 2 times whenever ONE mouse click was pressed. any reasons?
my code is:
MOUSEDLL_API LRESULT CALLBACK hookproc(int ncode,WPARAM wparam,LPARAM lparam)
{
LPMSG msg = (LPMSG) lparam;
if( (ncode == HC_ACTION) && (wparam==PM_REMOVE) )
{
if( (msg->message == WM_LBUTTONDOWN) && (wparam == PM_REMOVE) )
{
PostMessage(hwnd,leftclick,wparam,lparam);
}
}
}
need help.. tks
terr
|
|
|
|
|
I'm not sure where you are getting info for a mouse hook proc. According to the docs
it should be something like this:
MOUSEDLL_API LRESULT CALLBACK hookproc(int ncode,WPARAM wparam,LPARAM lparam)
{
MOUSEHOOKSTRUCT *pMouseHookStruct = (MOUSEHOOKSTRUCT *)lparam;
if( wparam == WM_LBUTTONDOWN )
{
PostMessage(hwnd,leftclick,wparam,lparam);
}
CallNextHookEx(...);
}
|
|
|
|
|
hi.
hmm.. i changed to the abv method u gave. but it still captures 2 times instead of only 1 time per click.. any idea?
thanks...
terr
|
|
|
|
|
A breakpoint at...
PostMessage(hwnd,leftclick,wparam,lparam);
...gets hit two times per click?
|
|
|
|
|
hi..
the postMessage() did not process 2 times, instead the hookproc() was processed 2 times and therefore, postMessage() was called 2 times seperately.
so.. you have any idea?
ie. when i click once, the hookproc() was processed 2 times instead of 1 time.
rdgs
terr
|
|
|
|
|
The hook proc should get called at least once for the WM_LBUTTONDOWN and once for the
WM_LBUTTONUP. There's also WM_MOUSEMOVE, WM_MOUSEWHEEL, etc. messages, all of which go
through your hook proc.
That's why you need to flter out just the messages you are interested in. You may want/need
to filter by HWND or cursor position - that information is in the MOUSEHOOKSTRUCT structure.
What is the value of "leftclick" in your PostMessage call? If it is WM_LBUTTONDOWN then
your hwnd could receive two WM_LBUTTONDOWN messages if the click was in the same hwnd you
posted to.
*EDIT By the way, if "leftclick" is WM_LBUTTONDOWN then that's bad. The WM_LBUTTONDOWN posted<br />
to windows has different wparam/lparam parameters than the hook proc wparam/lparam.
Mark
|
|
|
|
|
Is there a nifty function similar to AfxMessageBox() that one can call to bring up, and then make another call to close?
A routine wthat rites an XLS file takes a variable amount of time, and all that is needed is a popup of some sort that notifies the user what it is doing.
Thanks.
|
|
|
|
|
Can this be helpful for you?Clickety[^]
Code-Frog:So if this is Pumpkinhead. Time for him to run and hide. It's an interesting thought really.
|
|
|
|
|
That is more involved than I was anticipating, and am not sure how long the file will take to write. Bringin up EXCEL can take either a few seconds or longer, and the file writing varies as well. Thanks for the reference.
|
|
|
|
|
Can you explain a bit clear ?
Do you need progress dialog kind of thing ?
|
|
|
|
|
No, just a pop up at the start of the file writing routing saying 'Writing the XLS file', and then have it closed by the program after the file is written. Thanks.
|
|
|
|
|
You could use a modeless dialog window.
Create/show it before the operation, destroy it after the operation completes. Same thing
as many (most?) progress window implementations, just simpler.
Mark
|
|
|
|
|
|
Sorry for stupid qestion..
In MFC dialog based applications I used WM_INITDIALOG message handler to do various stuff (setting CListCtrl columns etc.).
Now I`ve created an SDI MFC application with CFormView as base class. The closest message handler I can find here is WM_CREATE, which doesn`t suite my needs (it gets called to early - m_listctrl.InsertColumn() fails because there is no m_listctrl at this time).
Please help!
Which message handler do I use here?
-- modified at 11:15 Sunday 28th January, 2007
|
|
|
|
|
Makakuin wrote: Which message handler do I use here?
See OnInitialUpdate .
|
|
|
|
|
I`ll check it out! Thanks!
|
|
|
|
|
prasad_som wrote: See OnInitialUpdate.
That must an MFC thing.
To the op:
WM_CREATE and WM_CREATEDIALOG are sent during the call to CreateWindow() and CreateDialog(). The window is not created until after these messages have been processed. So it's not the best of places to initialize window dependent data.
One method I often use, from the WM_CREATE handler, call PostMessage() with your own WM_APP + XXX message. This is guarenteed to be the first message you get making it perfect for setting any data.
|
|
|
|
|
WalderMort wrote: That must an MFC thing.
Yes, it is.
OP is using MFC SDI application.
|
|
|
|