|
Thanks for the information. I actually looked up the code in SysInternals.com.
IPHlpAPI seems to have undocumented functions that can be used to obtain the ProcessIDs of the applications accessing ports. However, it also appears that these undocumented functions come only with XP.
So how did people find the same information prior to using XP? Any ideas?
Thanks.
|
|
|
|
|
Hi!
I want to implement a "dialog box" inside a "menu" application. And both the applications should interact with each other.
How can I do that?
Thanks
sumod
|
|
|
|
|
Huh ? What do you mean by both should interact with each other ? are the two applications independant ( 2 exe files ) or something else ?
If I understand correctly , you need to create a modeless dialog, using Create and ShowWindow on the dialog instead of DoModal.
Max.
|
|
|
|
|
If what you want to do is have 2 dialogs from the same app and have them talk to each other, try:
In the main dlg.h
protected:
CMySecondDlg m_SecondDlg;
then in dlg.cpp:
m_SecondDlg.Create(IDD_MY_DIALOG_RESOURCE, this);
and to show it:
m_SecondDlg.ShowWindow(SW_SHOW);
Then to get access to the main dlg from the new one:
CDlg* pMainDlg = static_cast<CDlg*>(AfxGetMainWnd());
Then you can access main dialog public members like:
pMainDlg->m_MyEditBox.SetWindowText("Boo!");
The second dialog would then be called a Modeless dialog rather than a Modal one.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
How can I not viewing disassembly while I'm debugging my program.. I only want to view variables.. so I went to View menu tab, click on Debug Windows, then I choose Variables. However, when I try to debug, I can view variables changes and Disassemblying at the same time too..
what should I do if I dont' want to view disassembly??
Thanks
|
|
|
|
|
You can open the source file to where you are debugging then step through the source code instead.
However if you do not have the source code then you will be stuck stepping through the disassembly because the IDE needs to have something that you are stepping through when you are watching your variables.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hello.
I have an ActiveX control which I run in Internet Explorer. I want to be able to do some
changes it the html when the control is closed.
I have seen a code example on MSDN:
CComPtr<IOleContainer> spContainer; <br />
m_spClientSite->GetContainer(&spContainer); <br />
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spDoc(spContainer); <br />
if (spDoc)<br />
spDoc->put_bgColor(CComBSTR(_T("pink")));
My problem is I don't know how to obtain the member variable m_spClientSite. Do I have to
implement an interface to use this variable? I tried to include <atlctl.h> but that gave me
a lot of errors.
Any help is greatly appriciated.
Thanks in advance.
/Charlie.
|
|
|
|
|
the m_spClientSite is I think the member of ATL's class CComControlBase. If you have an ATL component, you have this member for your use.
If you are using some other stuff for generating the control, you have to implement the IOleObject::SetClientSite method, where you can store the supplied parameter (exactly as ATL does this) or look how your library implements the SetClientSite method, where the result is stored etc.
|
|
|
|
|
Thank's for the answer.
I have created the control with the MFC ActiveX ControlWizard.
I really have no idea on how to implement the IOleObject, I have tried to find out how to to on MSDN but I can't find anything good... So if you could give me a hint on how to implement the interface I would be very greatful.
/Charlie.
|
|
|
|
|
Ah, with MFC I can't help you too much. But I believe that COleControl::GetClientSite() can help you. But this is only blind shooting from the help. This function returns the IOleClientSite pointer, so you will have the same result as having the m_spClientSite pointer.
|
|
|
|
|
I have insert ActiveX control into my dialog based application, and when i compile that dialog i just see the name of a control in place where control should be. That control is registered. Where is a problem?
6.12.2002 Adam Pietrzyk
Poland
|
|
|
|
|
What ActiveX component? MS, 3rd Party, or proprietary? I use some 3rd party ActiveX stuff pretty regularly, so if you give me some details, perhaps I can help...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I've got a doc/view app where my document contains data *not* stored in a file. How do I create a new document/view pair without passing in a filename to CWinApp::OpenDocumentFile()?
I need to attach my in-memory data to the document early on enough in the process for the view to be able to retrieve it in OnInitialUpdate(). Right now I store a pointer to the in-memory data in a global before calling OpenDocumentFile() and the document class constructor picks it up from there but obviously this is not real pretty
he he he. I like it in the kitchen! - Marc Clifton (on being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Just process on new document and populate the data in the
document. As for the file name just forget it, only
visible trace that it is still being used it in the
main frame, you can remove it by removing the bit
FW_ADDTOTITLE in the mainframe's OnCreate.
|
|
|
|
|
Thanks for the reply. But...
1) Since OpenDocumentFile() only takes a LPCTSTR (the filename), I guess I was asking what is the correct way to pass a pointer to my in-memory data so that the document object gets it when it is eventually created.
2) FWS_ADDTOTITLE only controls whether the MDI child window's title gets included in the main window's title. Clearing it in my document frame class stops the "filename" from appearing in the MDI child windows but MFC uses my application name instead! I haven't yet figured out a way to put *my* title in there.
he he he. I like it in the kitchen! - Marc Clifton (on being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
If you have a pointer the document template class you can do something like:
CMyDocument *pDoc = (CMyDocument*)pDocTemplate->OpenDocumentFile(NULL);
pDoc->UseThisData(pYourData);
pDoc->UpdateAllViews();
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
Tried that. I was hoping to be able to use CWinApp::OpenDocumentFile() since it takes care of the case where the document is already open. Doesn't like a NULL or empty filename, though. I jst thought there might be a Better Way. Oh well
Thanks
he he he. I like it in the kitchen! - Marc Clifton (on being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
I have a worker thread. And I've found an interesting problem, which looks like a windows bug. (!!)
When done polling the message que, and Waiting() for events or more mesasges, the MsgWait seems to ignore that there are already messages in the que, thus locking the application if there happens to be a message in the que when waiting.
Now to the interesting:
When pausing the locked application in VisualStudio. And immediately resuming it. The MsgWait returns (!!!!!) and messages are pooled as expected!
I'm using w2ksp3.
What should I do? Having a WM_TIMER every second, and ignoring the messages isn't good enough.
|
|
|
|
|
Did your queue signal the event correctly?
|
|
|
|
|
I'm creating a dialog with a section of it used for drawing graphs. Following the design presented in the Fire sample supplied with VC++ 6.0, I inserted a Static control in the dialog, and attached it to my own "ZPlane" drawing object derived from CStatic.
Everything worked as expected until I drew a circle that went outside the dimensions of the Static control. For some reason, I can draw outside the the control as layed out in the dialog. I thought the DC constructed with the this pointer would return an object with "clipping" set to the size of the CStatic object inside the dialog, but it seems to have been constructed with a clipping region of the parent dialog box.
It's 3:30am, I'm tired, and will work on it some more tomorrow, but if you can point me in the right direction, I'd appreciate it. The question is, how do you set up the clipping region of the DC? I've tried a few of the DC set clip region commands, but to no avail.
If I call GetClientRect from my CStatic derived drawing object, I get the correct size of the Static control, and if I draw a rectangle based on that Rect, it's the size of the Static control. I'd like to specify the clipping region of the DC (I'm assuming you can do this) to the size of the Rect obtained with the GetClientRect.
Thanks.
|
|
|
|
|
I gave it one more shot...
Turns out the documentation for
CRgn::CreateRectRgnIndirect( LPCRECT lpRect );
specifies lpRect as containing the logical coordinates of the clipping rect. I found another example of drawing within a clipped area, and it used the device coordinates! I switched to device coordinates, and everything is working as expected.
Is there a problem with the docs???
Now I'm really going to bed!
|
|
|
|
|
ClientRect coordinates are always rooted at (0,0) and extend the width and the height of your window.
If your DC is being constructed for the entire dialog, and not just the static control that you have created, then if your static control is not rooted at (,0) then GetClientRect will not work for you.
You could try using ::GetWindowRect()< instead. It will contain the coordinates of your static control relative to the window that created the DC.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hello,
I have created a MFC application (doc/view architecture) that is running in background (is not visible) and I print some reports from that application.
The problem is that the "Printing" dialog that comes up when a report is sent off to a printer is visible during the printing process.
How can I hide it?
Many thanks,
Vasile
|
|
|
|
|
You can probably, write your own pagination and printing
or track down the point at which dialog is being shown
in the mfc code and then override the function in your
own class and copy from the original function
and remove the dialog calling code.
|
|
|
|
|
Hi,
I have a custom ui application. If i keep on resizing the window in windows 98 it says resource not found.It is fine in xp ,2k.There is no resource leak are been reported from bouncechecker application.
What is wrong?
Regards
Neha
|
|
|
|