|
I'm looking for the network monitor 2.0 SDK Could you tell me where can I get it?
|
|
|
|
|
I have used a DB Grid control and it is working fine but it has got one problem. When I run the application, the select database dialog popups! How can I get rid of this dialog?
|
|
|
|
|
Hi,
The following code snippit, produces an embeded excel object. My question is how do I manipulate it?
#import "C:\Program Files\Microsoft Office\Office\EXCEL9.OLB" rename ("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL") rename ("DocumentProperties", "DocumentPropertiesXL") no_dual_interfaces//, raw_native_types
snip.....
WORDLib::_ApplicationPtr pWrd = m_pParentApp;
pWrd->Visible = VARIANT_TRUE;
WORDLib::_DocumentPtr pDoc = pWrd->ActiveDocument;
COleVariant vClassType = "Excel.Sheet";
WORDLib::InlineShapePtr pShp = pDoc->InlineShapes-
>AddOLEObject ( vClassType );
WORDLib::OLEFormatPtr pFmt = pShp->OLEFormat;
_bstr_t bTyp = pFmt->ClassType;
/*
** pFmt->ClassType == "Excel.Sheet.8"
**
** pFmt->Object returns an IDispatch -- but to what ????
*/
Excel::_WorksheetPtr pSheetptr = pFmt->GetObject(); // pFmt-
>Object;
pSheetptr->Range["A1"]->Font->Bold = VARIANT_TRUE; // This fails with Code = 80020003 ( Member not found. )
The functions do exist.
If I do this by creating an excel app ptr, then get active worksheet()
I can then call these functions to manipluate the work sheet.
What I suspect is the GetObject is returning something that can be used to get the app ptr or wrksheet ptr.
Regards
Ian G
/*
Object Property
Returns the object that represents the specified OLE
object's top-level interface.
This property allows you to access the properties and
methods of the application in
which an OLE object was created. Read-only.
Remarks
Use the TypeName function to determine the type of
object this property returns for a
specific OLE object.
Object Property Example
This example displays the type of object contained in
shape one on slide one in the
active presentation. Shape one must contain an OLE
object.
MsgBox TypeName(ActivePresentation.Slides(1) _
.Shapes(1).OLEFormat.Object)
This example displays the name of the application in
which each embedded OLE object
on slide one in the active presentation was created.
For Each s In ActivePresentation.Slides(1).Shapes
If s.Type = msoEmbeddedOLEObject Then
MsgBox
s.OLEFormat.Object.Application.Name
End If
Next
This example adds text to cell A1 on worksheet one in
the Microsoft Excel workbook
contained in shape three on slide one in the active
presentation.
With ActivePresentation.Slides(1).Shapes(3)
.OLEFormat.Object.Worksheets(1).Range
("A1").Value = "New text"
This would indicate that its of type Excel application ?
*/
|
|
|
|
|
Hi
I am displaying information of a simple Cperson class
in a dailog box - which is better practice to pass the
information by parameter to the dailog via DDX or to
pass a pointer to the Cperson object and let the dailog
box extract the data ?
Thanks
|
|
|
|
|
It would definately take less processor time to pass a reference or a pointer, so this would be the best option in that case. However, you can also have a dialog box class that accepts a Cperson class in its constructor, and then is permenantly linked with that Cperson or a copy of it. It is mostly a matter of opinion and depends on what you intend to use the dialog for.
==================
The original message was:
Hi
I am displaying information of a simple Cperson class in a dailog box - which is better practice to pass the information by parameter to the dailog via DDX or to pass a pointer to the Cperson object and let the dailog box extract the data ?
Thanks
|
|
|
|
|
My suggestion would be pass a reference to the object and let the Dialog interrogate the object directly for the data. Why pass n parameters when half the raison d'etre for the object is the encapsulation of this data? Pass a reference.
In fact, there are probably ways to display the data in a dialog in such a way (combined with a bright method or two in the CPerson object) such that you can change the internal data represented in the CPerson without having to modify the Dialog that displays it. One of the stratagems of the experienced programmer is to try to devise ways to insulate himself from changes in data structure within object classes - this tends to happen, and the less impact it has on code scattered across the project, the better.
|
|
|
|
|
Hi,
I would like to know how I exit a program (the way it should) and than run another program.
I'm planning to use this after a user has downloaded an update from within the program and than letting him start the update. For that, the running program has to be closed.
Could anyone give me a suggestion?
|
|
|
|
|
1) call CreateProcess to start the other program
2) In a user interface program (i suppose that's what you are writing), call PostQuitMessage.
==================
The original message was:
Hi,
I would like to know how I exit a program (the way it should) and than run another program.
I'm planning to use this after a user has downloaded an update from within the program and than letting him start the update. For that, the running program has to be closed.
Could anyone give me a suggestion?
|
|
|
|
|
|
I'm using an Access 97 database and I want to change this value programmatically (updating users databases).
I can read it by calling GetFieldInfo() using AFX_DAO_ALL_INFO, but there is no SetFieldInfo() function.
Any suggestions?
|
|
|
|
|
Look at DAOTABLE sample in VC++ help.
It shows how to create tables, fields,and indexes...
Walter
==================
The original message was:
I'm using an Access 97 database and I want to change this value programmatically (updating users databases).
I can read it by calling GetFieldInfo() using AFX_DAO_ALL_INFO, but there is no SetFieldInfo() function.
Any suggestions?
|
|
|
|
|
Hi!
In my MDI app, i want to add a "Print" button at each dialog box to allow to the user to print it.
Is it possible to print a dialog box?
I try to use the CWnd::Print() function. The help says "Call this member function to draw the current window in the specified device
context, which is most commonly in a printer device context."
But it doesn't work!
This is my code...
void CSACellDefDlg::OnPrint()
{
CDC dc;
CPrintDialog printDlg(FALSE);
// Get printer settings from user
if (printDlg.DoModal() == IDCANCEL)
return;
// Attach a printer DC
dc.Attach(printDlg.GetPrinterDC());
dc.m_bPrinting = TRUE;
// Get the application title and initialise print document details
DOCINFO di;
::ZeroMemory (&di, sizeof (DOCINFO));
di.cbSize = sizeof (DOCINFO);
di.lpszDocName = "";
// Begin a new print job
BOOL bPrintingOK = dc.StartDoc(&di);
// Get the printing extents and store in the m_rectDraw field of a
// CPrintInfo object
CPrintInfo Info;
Info.m_rectDraw.SetRect(0,0,dc.GetDeviceCaps(HORZRES),dc.GetDeviceCaps(VERTRES));
// begin new page
dc.StartPage();
this->Print(&dc,PRF_ERASEBKGND);
// end page
bPrintingOK = (dc.EndPage() > 0);
if (bPrintingOK)
// end a print job
dc.EndDoc();
else
// abort job.
dc.AbortDoc();
// detach the printer DC
dc.Detach();
}
Thanks for your help
Sandrine
|
|
|
|
|
Did you try giving your dialogs a WM_PRINTCLIENT message handler? And shouldn't you add the flag PRF_PRINTCLIENT?
==================
The original message was:
Hi!
In my MDI app, i want to add a "Print" button at each dialog box to allow to the user to print it. Is it possible to print a dialog box?
I try to use the CWnd::Print() function. The help says "Call this member function to draw the current window in the specified device context, which is most commonly in a printer device context."
But it doesn't work!
This is my code...
void CSACellDefDlg::OnPrint() { CDC dc; CPrintDialog printDlg(FALSE); // Get printer settings from user if (printDlg.DoModal() == IDCANCEL) return; // Attach a printer DC dc.Attach(printDlg.GetPrinterDC()); dc.m_bPrinting = TRUE; // Get the application title and initialise print document details DOCINFO di; ::ZeroMemory (&di, sizeof (DOCINFO)); di.cbSize = sizeof (DOCINFO); di.lpszDocName = ""; // Begin a new print job BOOL bPrintingOK = dc.StartDoc(&di); // Get the printing extents and store in the m_rectDraw field of a // CPrintInfo object CPrintInfo Info; Info.m_rectDraw.SetRect(0,0,dc.GetDeviceCaps(HORZRES),dc.GetDeviceCaps(VERTRES)); // begin new page dc.StartPage(); this->Print(&dc,PRF_ERASEBKGND); // end page bPrintingOK = (dc.EndPage() > 0); if (bPrintingOK) // end a print job dc.EndDoc(); else // abort job. dc.AbortDoc(); // detach the printer DC dc.Detach(); }
Thanks for your help
Sandrine
|
|
|
|
|
Check out the printing section of this site - there are a couple of articles up now that should get you going in the right direction.
==================
The original message was:
Hi,
I want to be able to print and do another things while I'm doing this ( my printing proccess is very slow), so I have made a thread that inherits from CWinThread, there I pass the handle of the printer Dc, then I convert it to a CDC and I begin to print, ... and then the program print and crashes...
With the screen painting I have used a CClientDc and it goes all right, but with the printer, I have no idea..
Anybody can help me ?, Thanks, Bye ! Braulio
|
|
|
|
|
hi !! how can i know who is connected to my shared directory ?
Thierry
|
|
|
|
|
Hi,
On my computer (Windows NT) I use Control Panel -> Server.
Regards,
Serguei Velikevitch,
Dundas Software.
==================
The original message was:
hi !! how can i know who is connected to my shared directory ?
Thierry
|
|
|
|
|
Hi,
If you want to do this programatically.
Then use NetConnectionEnum()
"The NetConnectionEnum function lists all connections made to a shared resource on the server or all connections established from a particular computer. If there is more than one user using this connection, then it is possible to get more than one structure for the same connection, but with a different user name."
Make sure you link to netapi32.lib
HTH
Ghazi Wadi
==================
The original message was:
Hi,
On my computer (Windows NT) I use Control Panel -> Server.
Regards, Serguei Velikevitch, Dundas Software.
================== The original message was: hi !! how can i know who is connected to my shared directory ?
Thierry
|
|
|
|
|
If you can be patient for some days, the next release of WindowsNT System Manager will contain also the sharing management. Because I cannot send you an executable without your permission, I'm attaching only an image to show what it is now - it will be helpful if you can reply (here, or better, on my e-mail address) to tell me if this is what you're asking for...
Sardaukar
==================
The original message was:
hi !! how can i know who is connected to my shared directory ?
Thierry
|
|
|
|
|
Excuse me, the correct address of submission is WindowsNT System Manager
==================
The original message was:
If you can be patient for some days, the next release of WindowsNT System Manager will contain also the sharing management. Because I cannot send you an executable without your permission, I'm attaching only an image to show what it is now - it will be helpful if you can reply (here, or better, on my e-mail address) to tell me if this is what you're asking for...
Sardaukar
================== The original message was: hi !! how can i know who is connected to my shared directory ?
Thierry
|
|
|
|
|
i'm on 98 not NT and if you can send to mu e-mail some code examples it will be very good.
Thierry
|
|
|
|
|
Hi all,
I am writing a MDI application, which views are derivated
by CRichEditView. In the status bar, I want to display the
current position of the caret. The line number is easy to get,
just call GetRichEditCtrl().LineFromChar(-1), but how to determine the column?
Thanks in advance,
Thömmi
|
|
|
|
|
Thömmi,
You are actualy very close to the solution to this problem.
To get the caret position within current line you will have to look at two CRichEditCtrl member functions.
GetSel - if you are not handling the 'EN_SELCHANGE' notification than use this function to get current position of the caret. Vales returned contain character position from the beginning of the rich edit string.
Use the LineIndex function to get total number of characters before current line.
By subtracting chars before line from the caret position you will get column index in current line.
void CRichEditTestDlg::OnSelchangeRichedit(NMHDR* pNMHDR, LRESULT* pResult)
{
SELCHANGE *pSelChange = reinterpret_cast<selchange *="">(pNMHDR);
CString tempStr;
tempStr.Format( "ln: %d, col: %d",
m_richEdit.LineFromChar( -1 ),
pSelChange->chrg.cpMin - m_richEdit.LineIndex( -1 ));
SetDlgItemText( IDC_POS, tempStr );
*pResult = 0;
}
Peter Zajac
Dundas Software
==================
The original message was:
Hi all,
I am writing a MDI application, which views are derivated by CRichEditView. In the status bar, I want to display the current position of the caret. The line number is easy to get, just call GetRichEditCtrl().LineFromChar(-1), but how to determine the column?
Thanks in advance, Thömmi
|
|
|
|
|
Hi all,
I am writing a MDI application, which views are derivated
by CRichEditView. In the status bar, I want to display the
current position of the caret. The line number is easy to get,
just call GetRichEditCtrl().LineFromChar(-1), but how to determine the column?
Thanks in advance,
Thömmi
|
|
|
|
|
long startChar, endChar;
GetRichEditCtrl().GetSel(startChar, endChar);
startChar marks the start of the selection and endChar the end. If there is no current selection then the two values will be the same and will indicate the position of the caret.
|
|
|
|
|
Hi,
Does anyone know how to redirect cerr to a string stream?
Thank you
Hung
|
|
|
|