|
AFAIK you can control Excel with automation. In the MSDN the automation of excel is written in VB but it also works in a similar way in VC. If you want to do it in VC you have to "#import" an dll with this interface. It creates the com-Interface with the names of the methods. And than code trough the dschungle.
|
|
|
|
|
|
You need to find someone with older MSDN CD sets.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
In fact, all of the sdk samples have been removed from msdn. Does somebody know where they are?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Let me know which ones you want, I can Email them to you.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Orgasms are universal!! -- Mike Mullikin in The Lounge 21:27 15 May '02
|
|
|
|
|
That would be nice
You need to have an older msdn library.
samples:
- AVIEdit
- AVIView
- MPlay
- WriteAVI
I don't know if they are .cpp or as complete projects. If you zip them, they should be small.
TNX in advance
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
I clicked the link and got the page. Maybe it was down.
Must try, try, really try... you can get it if you really want
(a really good reaggy song from Jimmy Cliff)
|
|
|
|
|
That link works, that's right.
But if you look closer, you see that there's a message: "THESE SAMPLES ARE NO LONGER AVAILABLE"
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Hi,
I recently started my application under Windows XP. Everything is fine, but when I use mousewheel in my CListBox derievd class the scrolling is totaly strange. Scrolling up/down with scrollbar or keys is still normal.
Anyone knows what causes that... and more important, how to prevent?
Thx, Moak
|
|
|
|
|
You mean it appears to scroll backwards? It does this in Win2K also; it's apparently controlled the menu animation setting (desktop properties->effects->menu animation). You'll need to completely disable menu animation in order to fix it though; changing it to fade doesn't work.
---Shog9---
From now on we can call C# and MC++ "The square wheel languages" -- Jack Handy, The Lounge
|
|
|
|
|
yes, kind of backwards scrolling. So there is nothing I can do against it when using a listbox derived class? Is it a endusers choice?
|
|
|
|
|
'fraid so. At least you can blame it on MS ;~)
---Shog9---
From now on we can call C# and MC++ "The square wheel languages" -- Jack Handy, The Lounge
|
|
|
|
|
hehe. Oh you don't know how many 'winows API sux' comments I allready have in my sourcecode. )
But seriously, I came to a point where I think about reimplementing a listbox control for a chat (including emoticons and hyperlinks). I used a CListBox derived class and finally it works somehow, but it doesnt feed 100% to all my needs. I spyed on mIRC chat GUI, he used a static control in the chat output. That's a pure ownerdraw listbox-kind-of control, I assume.
Greets, Moak
|
|
|
|
|
Hio!
I am trying to allow my user to select any number of documents to print (classes derived from CFormView).. basicly they select a bunch of documents and in the CMainFrame i loop through their choices, call OnOpenDocument(), set the bottom view to the cformview, and call its BatchPrint() member function, which in turn calls CFormView::OnFilePrint()
the problem with this is that it pops up the printer selection dialog everytime..
so i have tried to create a CPrintInfo object and pass it to my BatchPrint() function, which has all of the actual code from CFormView::OnFilePrint()..
My OnPreparePrinting() only calls DoPreparePrinting() if the CPrintInfo hasn't been set once.. if its already been set then it uses the existing CPrintInfo.. my problem is that my CPrintInfo keeps getting the destructor called somehow before im done with it..
in any event.. is there a simpler way to switch a view, print a view (give print dialog), switch view, print view (no print dialog), switch view, print view (no print dialog), etc.. so the user only chooses the printer once..
any suggestions?
-dz
|
|
|
|
|
This code should get you going:
void CMyView::OnBatchPrint()
{
DOCINFO di ;
CPrintInfo printInfo ;
CMyDoc *pDoc = GetDocument() ;
CString filename ;
CDC dc ;
CRect draw_area ;
ASSERT_VALID(pDoc) ;
filename = pDoc->GetPathName() ;
filename.MakeLower() ;
CPrintDialog dlg(TRUE) ;
HDC hDC = dlg.CreatePrinterDC() ;
if (hDC == NULL)
return ;
di.cbSize = sizeof(DOCINFO) ;
di.lpszDocName = pDoc->GetPathName() ;
di.lpszOutput = filename ;
dc.Attach(hDC) ;
printInfo.m_bDirect = TRUE ;
printInfo.m_rectDraw.left = 0 ;
printInfo.m_rectDraw.right = dc.GetDeviceCaps(HORZRES) ;
printInfo.m_rectDraw.top = 0 ;
printInfo.m_rectDraw.bottom = dc.GetDeviceCaps(VERTRES) ;
draw_area = printInfo.m_rectDraw ;
dc.StartDoc(&di) ;
OnPreparePrinting(&printInfo) ;
for (printInfo.m_nCurPage = 1 ; printInfo.m_nCurPage <= printInfo.GetMaxPage() ; printInfo.m_nCurPage++)
{
dc.StartPage() ;
OnPrint(&dc, &printInfo) ;
dc.EndPage() ;
printInfo.m_rectDraw = draw_area ;
}
OnEndPrinting(&dc, &printInfo) ;
dc.EndDoc() ;
VERIFY(dc.DeleteDC()) ;
}
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
seemed like this code was going to work great by itself, but the call hDC = dlg.CreatePrinterDC(); always returns null..
i see that you declare a CPrintInfo and CDC var at the top, but they never get setup it seems.. i thought maybe i needed to do dc = GetDC(), but that returns a pointer instead of an actual CDC..
could you help a little bit more and let me know what I need to do to keep from falling out at the CreatePrinterDC command? and also help me understand how the CDC you declare gets set to the CDC of the view? thank you!
-dz
|
|
|
|
|
The only problem seems to be the CreatePrinterDC call. I copied that code from a procedure and moded it to use a CPrintDialog object to get the DC without checking it.
The MSDN says that you could get a HDC like this:
CPrintDialog dlg(FALSE) ;
HDC hdc = dlg.CreatePrinterDC() ;
The CDC created earlier in the procedure will be used to wrap the HDC returned from CreatePrinterDC() on the line dc.Attach(hdc), so you can use a standard CDC object when printing as expected by OnPrint() etc
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
plz check my new post for a continuation of this, thanks for yer help
-dz
|
|
|
|
|
Hi,
Could anyone tell me how to add a macro to active document in MFC?
thanks
Muddu
|
|
|
|
|
Could someone please tell me how one adds methods and properties(not functions and variables) in Visual C++7.0? In 6.0, we use to select the Automation tab in the Class Wizard and add methods and properties. It would also update the odl for us. What is the equivalent procedure or trick in 7.0?
Kind regards,
Tim
|
|
|
|
|
I discovered the answer to my own question and I'll answer it here in case someone else needs to do the same thing. I was expecting to add properties and methods by selecting the class in the ClassView and right clicking for the popup menu, but you can only add class member variables and functions. To add methods and properties to any interfaces in your classes, you need to find and select the application's type library listed in the ClassView. It is represented by a gray rectangle with rounded corners with a node extruding from the left side. If you expand the library, you will see a list of interfaces that exist in your project. Select the appropriate interface, right click, and add your methods and properties.
I hope this helps someone else.
Kind regards,
Tim
|
|
|
|
|
Hi,
I'm very surpised when I realized that std::string copy-costructor doesn´t create a new instance, just point to the older one
Try this code please.
You will get a memory fault error (VC6) when printing the copied string because destructor of first one has been called before
[code]
class CHexString {
private:
string m_byteStr;
public:
CHexString(const CHexString& hs) : m_byteStr(hs.m_byteStr) {}
CHexString(const char * hs) : m_byteStr(hs) {}
CHexString() {}
~CHexString( void ) { std::cout << "destroying " << m_byteStr << std::endl; }
const string getStr( void ) { return m_byteStr; }
friend std::ostream& operator<<(std::ostream os, const CHexString& hs) {
return os << hs.m_byteStr;
}
};
int main ( void ) {
CHexString hs0("JONNY");
CHexString hs1(hs0);
string hs2(hs1.getStr());
std::cout << "hs0 " << hs0 << " hs2 " << hs2 << std::endl;
//same error printing hs1 instead of hs2
return 1;
}
[/code]
Is this the normal behaviour to expect to?
Regards
Carlos.
|
|
|
|
|
No, this is definitely not normal behavior. I don't have any compiler at hand, but you might be so kind as to give this a try. Delete the const in getStr , as this:
string getStr( void ) { return m_byteStr; } Does the error persist?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Interesting you should ask this question as I was just having problems with std::string today (see my post below). I think your problem may have to do with the fact that MS's implementation of string uses reference counting. You might want to have a look here -- scroll down to the "Xstring" section. It details how reference counting can be disabled, which may be more expensive but worth the cost IMHO.
In any case, the bug fixes listed on that page should be useful to you if you are using MS's version of the STL.
--DG
|
|
|
|
|
Hello,
Check this answer posted in codeguru forums by John Barton (thanks John)
[quote]
It is normal behaviour for a string class to not copy the data but instead to do reference counting (unless the strings are different, there is no need to have multiple copies of the data).
The problem with your program is that you declared the operator<< incorrectly.
You should have made the first argument a reference:
friend std::ostream& operator<<(std::ostream& os, const CHexString& hs)
You were having a problem because when you called operator<< without the first argument being a reference, it made a local copy of the stream, and then returned a reference to the local copy (which was destroyed when the function exited).
Best regards,
John
|
|
|
|