|
prithaa wrote: I have read about COM programming and now want to use it in VC++
Why do you _need_ to use it ? Is there a particular problem that absolutly have to use COM that cannot be done otherwise ?
Office Automation classes are COM objects (AFAIRemember); so there's a link there.
This signature was proudly tested on animals.
|
|
|
|
|
prithaa wrote: I have done automation and used automation classes to open word excel . Is it very similar to that ?
Yes, that's exactly what COM is. Automation is an IPC mechanism that is based on COM.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
But remember the best control you get with C++, so check BEFORE CODING whether all needed features are supported.
This looks like a great article for that stuff:
Accessing Excel Spreadsheets via C++[^]
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hey folks!
I have a CListCtrl which is filled with several calls to InsertItem and then later updated by using CListCtrl::SetItemText[^]. This works fine except for the first column, if i do this:
list.SetItemText(rowIndex, 0, "Hello World");
nothing happens, the method returns with nonzero indicating success, GetLastError is zero, but the text is not changed. It works for any other column, so e.g:
list.SetItemText(rowIndex, 1, "Hello World");
works fine. I would like to avoid having to insert new items and deleting old ones when there's an update just because the first column needs updating too. Any ideas why this is happening? I googled some and found similar things but nothing exactly the same or really helpfull.
Thanks for any help in advance.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I hope u called the InsertItem.
Величие не Бога может быть недооценена.
|
|
|
|
|
As said, yes. This is a stripped, simplified version what i do:
list.InsertColumn(0, "One");
list.InsertColumn(1, "Two");
list.InsertItem(0, "Hi");
list.SetItemText(0, 0, "Hello");
list.SetItemText(0, 1, "World");
After InsertItem the column "One" contains "Hi" and the column "Two" is empty.
After the first SetItemText the column "One" still contains "Hi" (this is what i don't understand) and the column "Two" is empty
After the second SetItemText column "One" contains "Hi" and column "Two" contains "World".
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
if you want set the text of first item, you should call InsertItem().
and if you want set the first column, you call
SetColumn();
Regards,
Srinivas
|
|
|
|
|
I have a z_streamp, which is a pointer to a z_stream_s. z_stream_s is defined as follows:
typedef struct z_stream_s {
Bytef *next_in;
uInt avail_in;
uLong total_in;
Bytef *next_out;
uInt avail_out;
uLong total_out;
char *msg;
struct internal_state FAR *state;
alloc_func zalloc;
free_func zfree;
voidpf opaque;
int data_type;
uLong adler;
uLong reserved;
} z_stream;
I am trying to convery the next_in Byte to a string but I get a c2059 error that doesn't make any sense (it complains about a parenthesis: error C2059: syntax error : ')')
Here is my code:
z_stream_s zs;
zs = *z_stream_in;
char dest(StackSizeOf(char));
strcpy(dest,zs.next_in*);
(the *z_stream_in it uses is passed to it by the caller)
I think I may be defining the char wrong but I don't think that's whats causing the error.
Can anyone help please?
|
|
|
|
|
I have few doubts
1. What is the type of z_stream_in?
2. Whether StackSizeOf class is defined by you?
3. In
strcpy(dest,zs.next_in*); ,
Here what zs.next_in* means?
Величие не Бога может быть недооценена.
|
|
|
|
|
1. z_streamp, which is means it is a pointer to a z_stream_s
2. StackSizeOf is defined as #define StackSizeOf(Type) ((sizeof(Type)<sizeof(PBYTE))?sizeof(PBYTE):(sizeof(Type)))
3. zs is a z_stream_s (see the definition of z_stream_s in my previous post)
|
|
|
|
|
strcpy takes parameter char* as first parameter and const char* as second parameter [^]
so i hope Bytef is typedef of char.
if so then explicit casting is not needed else needed
and
i think no need of zs.next_in* instead just zs.next_in is needed.
Величие не Бога может быть недооценена.
|
|
|
|
|
Omnicoder wrote: z_stream_s zs;
zs = *z_stream_in;
char dest(StackSizeOf(char));
strcpy(dest,zs.next_in*);
This code does not appear to make sense. I don't think you can set a z_stream_s to a reference as you are trying to do. Also strcpy() needs a pointer to an array for its source and destination fields. You have set the destination to a single character, and the source to an incomplete expresion.
|
|
|
|
|
I am using VC6 win32 console application.
I have a function as follows:
void GetModelInfo(char *pModelName, char *pIC1, char *pIC2)
{
pModelName = "test";
pIC1 = "abc";
pIC2 = "abc123";
}
Code where the function is called:
{
char ModelName[30], IC1[30], IC2[30];
memset(ModelName,0,30);
memset(IC1,0,30);
memset(IC2,0,30);
GetModelInfo(ModelName, IC1, IC2);
}
After the function GetModelInfo is getting called the variables pModelName, pIC1, pIC2 are not getting updated with the values assigned inside the GetModelInfo function.
Please help me to find whats the problem
|
|
|
|
|
To get it updated either you have to use the the variables stored in heap
and allocate outside the function.
or
change the parameter as reference
void GetModelInfo(char *&pModelName, char *&pIC1, char *&pIC2)
Величие не Бога может быть недооценена.
|
|
|
|
|
You can use strcpy() function instead of assignment.
strcpy(pModelName, "test");
|
|
|
|
|
You cannot set method parameters in this way, all this does is set the temporary parameters within GetModelInfo() . In order to return the information you will need to use some copy method into the destination arrays. Read your C reference guide on the use of pointers and parameter passing.
|
|
|
|
|
They are not updated because inside GetModelInfo local copies of the variables (which represent the addresses of the character arrays) are assigned new values. Because they are simply copies the original contents of the variables are not changed.
To change the contents of the original arrays, you have to copy the text to the memory addresses like this:
void GetModelInfo(char *pModelName, char *pIC1, char *pIC2)
{
memcpy(pModelName, "test", 30);
memcpy(pIC1, "abc", 30);
memcpy(pIC2, "abc123", 30);
}
That way they will be updated.
|
|
|
|
|
Hi...
Hi have two clasess. Class_A, Class_B.
Now i am having all the values in Class_B. But my listcontrol is in Class_A.
I have to set all the values from Class_B.
What is the procedure?
Thanks...
G.Paulraj
|
|
|
|
|
I suppose that you want to access the other class's member variables , isn't it ?
you can use the new operation.
|
|
|
|
|
What do you mean ?
|
|
|
|
|
This really depends on how the different classes are used in your program. One approach would be to pass Class_B to Class_A and provide getters in Class_B, so that Class_A can retrieve the values and populate the list.
What kind of architecure are you using ? Are you using MFC ? If yes are you using a doc/view architecture ? Is the list part of your view ? You need to give a lot more details about your architecture in order for us to help.
|
|
|
|
|
Hi...
I am using MFC only.
Its based on ObjectARX. I am retrieving all the values in Class_B.
But my list control is class_A.
How to insert class_B values in Class_A control?
G.Paulraj
|
|
|
|
|
So, what's wrong with my first suggestion ? Did you try to understand it at least ?
BTW, when somebody asks you for details about your program architecutre, repeating the same information you already posted in your first message doesn't add anything...
|
|
|
|
|
hi,
I want to show particular location in a pdf file while opening it. How to do this?
Thanks,
modified on Wednesday, December 2, 2009 3:16 AM
|
|
|
|
|
I am not sure what this has to do with C++, but ... If you are trying to do this with code then you will need to interpret the index of the PDF file, locate the data for the relevant page, and then format and display that data.
See the PDF specification documentation at Adobe[].
|
|
|
|