|
Hello dear programmers,
Please help me with this one ...
I'm having trouble copying a worksheet in VC++ (MFC).
I'm accessing an Excel object and trying to manipulate it.
So far, some function that i've used was working fine except the copy function of Worksheet class. There's no error during compilation, but at runtime a message is displayed stating that "Copy method of worksheet class failed."
By the way, I am using MS Office 2000.
Thanks in advance.
|
|
|
|
|
I wanaa to start timer on clicking button Btn_Start
and here i will disable button Btn_Start
(GetDlgItem(BTN_START ))->EnableWindow (FALSE);
SetTimer( 21, 1000 * 60 * 180, NULL);
as my calculations 1000 * 60 * 180 = 3 hours or 180 mint
is it ?
after expiry of 180 minuts in ON_TIMER Event
I will Enable Start Button
GetDlgItem(BTN_START ))->EnableWindow (TRUE);
KillTimer( 21 );
But it not complete its time of 180 mint ,,
it enable it early ,,,,
Y??
any reason
thanx
|
|
|
|
|
not sure what you're on about
but are you catching the OnTimer event?
and making sure you deal with only the correct timer event (21)
cheers
bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
Wts is timers life time ,, means i wanaa say its maximum limit to set it..
if i set a timer for 24 hours ,, will work
or SetTimer (...) have any time range for timer
thanx
|
|
|
|
|
mate, i have no idea what you're on about
you have not provided enough information for anyone to give you any decent answer
bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
According ot MSDN,Maximum limit is 0x7fffffff or 597 hr. for setting Timer
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I have no idea what "wts" and "wanaa" mean. If you are looking for the max value for SetTime(...), look at the function prototype.
SetTimer(
HWND hWnd ,
UINT nIDEvent,
UINT uElapse,
TIMERPROC lpTimerFunc);
It looks like uElapse is of type UNIT, so probably the max number of milliseconds is UINT_MAX.
Details on UINT_MAX can be found at msdn.microsoft.com
|
|
|
|
|
Set timer interval to 1000 (1 second) when creating timer.
You will need to create a member data and then increment it in the timer:
CMyDialog::OnTimer(...)
{
m_seconds++;
// then you can calculate m_seconds and do whatever
// other code
}
|
|
|
|
|
You should use the value returned by SetTimer for KillTimer.
From MSDN
=========
Return Value from SetTimer(...)
The timer identifier of the new timer if the function is successful. An application passes this value to the KillTimer member function to kill the timer. Nonzero if successful; otherwise 0.
|
|
|
|
|
sir i am having one static link library file,i want to create an application by using that library,plz give me the steps which i have to follow in order to use the library
|
|
|
|
|
In my program, i m using CDaodatabase for database connectivity. i then use CDaorecordset to entry/modify data in the database.
My question is::
I do not use DSN anywhere in my program. Does CDaodatabase handle DSN internally. Wat is the better implementation - using DSN or using CDaoDatabase implementation? and wat is the main diff between the two?
|
|
|
|
|
CDaoDatabase constructs a CDaoDatabase object. The path to the database will have to be provided and connection can be opened with Open() method.
|
|
|
|
|
can u point out the difference between connecting vis CDaodatabase and connecting via DSN?
|
|
|
|
|
DSN stands for Data Source Name. Data Source can be a database, spreadsheet, text file etc. We assign DSN to a data source so that irrespective of the data source details and location, we can use that data source; add, modify or delete records, just by knowing it's DSN. From the application use CDatabase class to connect to a data source.
Where as in CDaodatabase, full path to the database needs to be provided to connect.
If the path of the data source changes, if a DSN exists, then changing path in the settings is all that is needed. Code doesnt have to be changed.
|
|
|
|
|
Dear programmers,
We use a device to provide X and Y coordinates similar to a mouse. Using VC++ I create a very small dialog box and refresh its position using the SetWindowPos funtion (at a rate of 120 HZ and setting it as TopMost window). I can also left-click by bringing the mouse to the corner of the small dialog's position and clicking and sending back the mouse cursor to its original position. This way I fully simulate a mouse cursor. Everything works perfect. Except when the window clicks on a menu (i.e. File, Edit, View, Tools, ...). Then the menu that contains all the menu items covers the small dialog box and user cannot see where they are pointing at.
Is there anyway I can highlight menu items when the position of my small dialg box is within the menu item's region? Just like when the mouse moves over the menu item? By the way, remember that the menu item is not a part of my program. It can be in any program.
This is the last part of my project. PLEASE PLEASE if you can think of a solution let me know. I have worked on this project for 4 months. I can further explain the program if you want.
Thank you in advance,
|
|
|
|
|
Hi everyone,
I am using the SetCursor function of VC++ and I want to be able to set the cursor type not just when the mouse is over my program (client area). I want the mouse cursor to change wherever it is. Any suggestion would be most greatly appreciated.
Thanks,
|
|
|
|
|
I have a CFormView that contains about 40 child dialogs, each of which contains at least 5 dialog controls (customer request, not our idea, so don't even think about suggesting another way to do this).
Can anybody come up with a way to allow the user to TAB between these dialogs using the tab key?
Basically I want the user to be able to tab from control to control, as if the chiold dialogs were one great big dialog.
The first person that comes up with something viable with not be verbally abused for one whole week, no matter how absurdly stupid their messages are.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
I think the following procedure should work for what you are trying to do:
1) Override the WM_KEYUP message
2) In the message handler, check if the key pressed is the TAB key
3) If the key pressed is the TAB key, check which control currently has the focus (GetFocus should do the trick)
4) If the control which currently has the focus is the last control on a child dialog, set the focus to the first control on the next child dialog (SetFocus) and then return from the message handler without calling the default WM_KEYUP handler.
5) If the control which currently has the focus is not the last control on a child dialog, return after calling the default handler.
If you need me to provide sample code for this, just ask.
Hope that helps!
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
I do not think that WM_KEYUP is the correct message. Just go to a dialog and press and hold the tab key. Notice that the focus goes from one control to the next? WM_KEYUP is obviously not being called when the focus is changing. He would have to handle WM_KEYDOWN.
The rest of your suggestion seems probable.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
PJ,
I had originally typed WM_KEYDOWN in my post, but then I thought that one would only want the change of focus to come after the key had been released, clearly ignoring that focus changes if you hold down the tab key.
Thanks for the correction!
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
You're in luck, Windows supports what you want to do and I've done something similar myself.
1. Create a placeholder static control in the dialog used for the form view, and make it the same size as the area where the child dialogs will be put.
2. In OnInitDialog() , get the RECT of the placeholder, then destroy the placeholder.
3. Next, create your child dialogs using the RECT you got in step 2 for the dialogs' initial size. VERY IMPORTANT: All child dialogs must have the WS_EX_CONTROLPARENT style. You can set this in the resource editor; you should also turn off the visible style, set them to all be child dialogs (not the default of popup), no caption, and no border.
4. After creating each dialog, use SetWindowPos() to position it in the right place in the tab order. For example, if the child dialogs should be after IDC_FOO in the tab order, do:
wndChildDlg.SetWindowPos ( GetDlgItem(IDC_FOO), 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
for each dialog.
After that, It Just Works because the default dialog proc sees the WS_EX_CONTROLPARENT style and does the keyboard handling for you.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
I did the creation of the child dialogs a little differently, and I also had to set Control parent on the formview template.
Brilliant! Thanks mucho!
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
My C++ program needs to read some structured datasets, or compound datasets just like database tables, but without pre-defined data structure. The structure of a dataset can only be determined at run-time and varies from one dataset to another. I don't know how to define a "generic" data structure so that it can change with datasets dynamically. Can anyone give me a help? Thanks in advance.
Fiona
|
|
|
|
|
Hi,
Could you be a little more specific in your question? When you say "datasets just like database tables" are you actually reading the data from a database, from a flat file, or from some other source? Also, is your question how to read these datasets whose structures are unknown until run-time, or how to make a generic data structure to store them once they have been read?
I can try and help you if you answer these questions.
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
Hi,
Thanks for your reply. My specific task is to write a data viewer interface to read and display data from files in a particular format. Datasets in a file can be a n-dimensional array of same type, or can be a compound table of different data type, that is what I said like a database table. When I access a data file, I have got some library functions to determine what type of a dataset is, if it's a compound table, the library functions also return how many columns in the table and what data type for each column. For example, if I know a compound table consisting of an "int" type and a "double" type, then I can define a structure like:
struct MyType
{
int a;
double b;
};
and then pass an array of this struct to the "readdata" function to receive the table data. However, as table structures vary with datasets, I cannot pre-define a struct like before. That's what I said I need some generic structure. Actually, the "readdata" library function returns a void pointer to the memory buffer that receives data from the file. The data strcuture on the memory buffer is same as the actual data structure in the table. That's why I want to define a strcut array to recieve data.
Hope this clarifies my problem and hope you can help me sovling this problem.
|
|
|
|