|
Hello,
First off, let me say that I'm fairly new to ActiveX controls, so I'm probably missing something obvious, but here's the situation.
I'm trying to use the Microsoft Office Spreadsheet 11.0 control in a dialog application. I've gone through all of the steps to get the class added to my project. I found the control in the Registered ActiveX Controls folder and selected it, I left the default classes selected and it appeared to create all of the wrapper classes without any major hiccups.
The problem comes when I try to compile the program. I get many errors (around 35) which read:
error C2440: 'type cast' : cannot convert from 'struct IDispatch *' to 'class CSpreadsheet'
No constructor could take the source type, or constructor overload resolution was ambiguous
The errors occur in various classes, but invariably the function causing the error has this structure:
CSpreadsheet CXmlMaps::GetApplication()<br />
{<br />
LPDISPATCH pDispatch;<br />
InvokeHelper(0x60020004, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, NULL);<br />
return CSpreadsheet(pDispatch);<br />
}
The problem seems to be calling the CSpreadsheet (one of the wrapper classes created by the ActiveX wizard) constructor, but CSpreadsheet doesn't appear to have any constructors defined. It's derived from CWnd, so I don't think there are any suitable constructors there either. I've been able to successfully use some of the simpler ActiveX controls (such as the Calendar control), but it seems to hang up on this one for some reason. Any insight would be helpful. I hope I've explained it well enough.
Thanks!
JD
|
|
|
|
|
I'm using this code to draw on a dialog box and had a quick question.
CClientDC dc (this);
CRect rect;
GetClientRect (&rect);
dc.SetBkMode (TRANSPARENT);
CFont font;
font.CreatePointFont (100, _T ("Arial"));
CFont* pOldFont = dc.SelectObject (&font);
CString str (_T ("Hello World"));
dc.TextOut (rect.Width () - 100, rect.Height () - 200, str);
dc.SelectObject (pOldFont); I just want to know if this is the best way to write on a dialog without using a control of any type? I thought of another question that'd I'd like to ask. If I wanted to print text next to a control on the dialog (say an Edit control) how would I get it's coordinates? I've tried using GetClientRect and GetWindowRect (both with and without using ScreenToClient), but neither of them gets the right position of the window. Any help is appreciated. Thanks.
- Aaron
|
|
|
|
|
I am developing a dialog app in Vc++ that uses a Property sheet and adds 1 page to it . the page has 2 grid controls(specifically #grid) as its main item and also a Child Dialog that it creates .
Here is the heirarchy
MainDialog (Memory allocation and deallocation, calls to the COM server)
PropertySheet , ComServer
PropertyPage (grid controls , XML parsing using MSXML & memory allocation and deallocation)
ChildDialog (painting the window)
Also there is 500 bytes of memory allocation and the same is being deallocated . I need to do this 2 times .
I do this using calls to "new " and make sure that i delete the array when not needed .
Plus i have some interaction with a COM server in my code .
Finally in one of the child windows created by the page , i do some custom drawing by implenting code in the OnPaint method of that Dialog class .
out of curiosity i was monitoring my app's memory usage in the Windows task manager and found that
During startup the mem size was around
2500 k
After i invoke a CFileDialog in the code and open a file , (perform some XML parsing using MSXML) the mem usage was
8000 k
and then it keeps on increasing . till it gets stable around 12000 k .
I am wondering why my app's mem usage is so high and shouldnt it change when i delallocate memory ?
Is this a true measure of my apps performance ?
I need to have some pointers(no pun intended) whether there is some critical performance issue here !
|
|
|
|
|
i have 2 dialogs(2 classes) set up as 2 tabs on another dialog in an SDI application, each tab has edit box controls and such... how can i share data between these 2 tabs or share members data between these 2 classes?
what i am trying to do is get the filename from the first class (in a cedit control or a member variable) when i am on the second tab
thanks for helping this newbie
|
|
|
|
|
Cant u have this data as part of(member variable) the other dialog that holds these 2 dialogs ?
or declare it in CMainFrame and then declare it as extern , wherever u need to use it !
|
|
|
|
|
well, i can set a global var and solve my problem, but im wondering how to share data between 2 dialog classes or perhaps between a view and a dialog
thanks
|
|
|
|
|
Can't you make the datas members of your CDoc-derived class? Or, if that violates your application logic, have a data variable in the common parent of the two dialogs. Dialogs should IMHO never hold any data, just display and validate it. The data is to be stored in the document.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
In this line of code :" WSAStartup(0x0101,&wsd) " can somebody tell me what the " 0x0101 " stands for ??
Regards,
Kapil
|
|
|
|
|
|
kpatry wrote:
...can somebody tell me what the " 0x0101 " stands for ??
In general, or in the context of the WSAStartup() function?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Give me both.. in general and in the context of WSAStartup()
cheers,
Kapil
|
|
|
|
|
In general, it is the base-16 representation of 257. In the context of WSAStartup() , it is highest version of Windows Sockets support that the caller can use, with the high-order byte specifying the minor version (revision) number, and the low-order byte specifying the major version number.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
LRESULT CT71View::OnGoodbye(WPARAM wParam, LPARAM lParam)
{
// message received in response to modeless dialog OK
// and Cancel buttons
TRACE("CT71View::OnGoodbye %x, %lx\n", wParam, lParam);
TRACE("Dialog edit1 contents = %s\n",
(const char*) m_pDlg->m_strEdit1);
//m_strEdit1 ismembervariable of the edit control in dialog control
m_pDlg->DestroyWindow();
return 0L;
}
onGoodbye the message function is written by the user herself.
i want to know :first,What is the meanin of "LRESULT",why to add it?when to use it?
second,why "return 0L",Why not "return 0" only?
thank you!
|
|
|
|
|
Microsoft code is lousy with terrible macros and typedefs. LRESULT is a return code, and obviously the L stands for long, hence the return value also being explicitly made a long. Google gave me this:
http://root.cern.ch/lxr/ident?i=LRESULT[^]
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Just curious all the tutorials i have came upon doesn't address this issue. How do you append to a file using serialization? I have a database (text file) dialog program i made that will write to a file and read from the file. However it overwrites preexisting data. Help on this would be great. I know fsopen has +a is there anything like that in serialization?
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
Appending with serialisation makes no sense. The point of serialisation is that you have a data structure somewhere in memory that you want to save to disk and read back sometime later. The serialisation process doesn't just save the data, it saves metadata to make it possible to read both the data and the data structure back later. Deserialisation recreates your datastructure (with all the pointers from high level objects to lower level objects intact). Thus, the only way that appending makes sense is to 'append' an object of some kind to the original structure in memory. Appending data to a 'file' that contains serialisation data without reference to the original data will result in 'orphaned' objects existing in your memory - objects you can't reference because your original data structure has no idea they exist.
Rob Manderson
Colin Davies wrote: I'm sure Americans could use more of it, and thus reduce the world supply faster. This of course would be good, because the faster we run out globally, the less chance of pollution there will be. (Talking about the price of petrol) The Soapbox, March 5 2004
|
|
|
|
|
HI all;
I am building an application which should have a tab control on a CDialogBar. Visual C++ gladly added the dockable dialog bar for me but i could not figure out where to put the code to create the tab control since the OnInitDialog() function is simply ineffective. Can anybody please help out. I need to know where i should place my code to create the TAb control on the dialogbar.
I badly need this guys;
THanks
Krugger
|
|
|
|
|
Let's assume you're trying to create the object using DDX. In other words, you've embedded an object of the correct type in your class definition and written a DoDataExchange function with the appropriate DDX_Control() call.
It might look like this (simplified).
Header file.
class CMyDialogBar : public CDialogBar
{
public:
CMyTabbedControl m_tabControl;
virtual void DoDataExchange(CDataExchange* pDX);
virtual void OnInitDialog();
};
and your implementation file looks like this.
void CMyDialogBar::DoDataExchange(CDataExchange* pDX)
{
CDialogBar::DoDataExchange(pDX);
DDX_Control(pDX, IDC_MYTABCONTROL, m_tabControl);
}
void CMyDialogBar::OnInitDialog()
{
CDialogBar::OnInitDialog();
return TRUE;
}
And yet it doesn't work. As you've noticed, OnInitDialog() isn't called for a DialogBar. The solution I found was to add a function Initialise() to the DialogBar derived class and call it once I knew the dialog bar had been created.
void CMyDialogBar::Initialise()
{
UpdateData(FALSE);
}
Yes, it's that simple. Just call UpdateData() (make sure the call occurs before any code that tries to use the TabControl) and the control will be created.
Rob Manderson
Colin Davies wrote: I'm sure Americans could use more of it, and thus reduce the world supply faster. This of course would be good, because the faster we run out globally, the less chance of pollution there will be. (Talking about the price of petrol) The Soapbox, March 5 2004
|
|
|
|
|
Hi,
I have scanner program that send scanned pictures to printer through firewire.
I want to develop a server in Visual C++ that will recieve the scanned pictures instead of the printer, will schedule them, and send them to the printer.
Both connections of scanner->server and server->printer should be by firewire (The speed is the most important issue for me).
Any one has an idea how to cope with this issue?
Should the server pretend to be a printer, so the scanner will send the pictures to it?
Do I have to dig into the printing protocol in order to enable the server communicate with both scanner and printer?
I don't have a clue how to approch this issue ,
So any help will be very appreciated.
Thanks,
Alon
|
|
|
|
|
hi
how can i scroll to the end of an edit control each time I add text.i am not using mfc only the windows api functions.
thanks
|
|
|
|
|
|
Hi members,
I am having a problem in writing a program that will generate a billing statement for a customer. How can I declare gas used in this program?
Natural GasTex Company charges their customers based on the amount of gas that they consumed. The company uses the following table to compute charges.
Gas used (in thousands cubic feet)
Rate
First 20
$16.48
Next 5
$1.19 per thousand cubic feet
Next 7
$0.79 per thousand cubic feet
Above 32
$0.39 per thousand cubic feet
Nyn
|
|
|
|
|
This appears to be a homework assignment. If you have specific questions people are willing to help you, however they will not do your homework for you as you are only cheating yourself in the end.
- Nick Parker My Blog | My Articles
|
|
|
|
|
nynny wrote:
I am having a problem in writing a program that will generate a billing statement for a customer.
woah... how much are you charging ur customer ?
MSN Messenger.
prakashnadar@msn.com
|
|
|
|