|
Sorry, I don't know about this. You'll have to try and find the format of an OLE Compound file. I doubt anyone here would know it - I think almost everyone here would do it using StgOpenStorage() .
Are you programming for Windows, or Linux or another O/S?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
I think almost everyone here would do it using StgOpenStorage().
Actually, I'd be inclined to use Word Automation. If that, in turn, is handled by StgOpenStorage() and/or IStorage , I'm not sure.
|
|
|
|
|
DavidCrow wrote:
Actually, I'd be inclined to use Word Automation. If that, in turn, is handled by StgOpenStorage() and/or IStorage, I'm not sure.
I was meaning, "assuming they wanted to read the file directly" . Word Automation is obviously a much nicer way to do it
FYI, I think I remember seeing the Word does use IStorage internally
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Word is a closed format that isn't documented. Reading it via fopen will only give you a lot of binary data and not the text of the document.
What exactly do you want to do with the data once read? You may be better looking at using the WORD COM object model to load the document and do your work on it.
Have a look on MSDN for KB196776.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
Michael P Butler wrote:
You may be better looking at using the WORD COM object model to load the document and do your work on it.
I would have said that, but there's a number of reasons you'd want to use the file directly. One I came across is that you can not get access to image data via the COM object model. I ran into this while trying to get PowerPoint slide information, and it has caused me a lot of heartache since .
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi !!
Here is what I'd like to do in C++ : (I don't know if it's possible or not)
I have several functions in a class. I want to call one of them according to a given string representing the name of the function to be called. It looks to me that the only possible way to do it is to manually compare the given string with each existing function and call the good one, but I think it would me much better to have it done automatically, without having to add a comparison if a new function is added.
I'd like to have something like :
MyObject->callThisFunction("processArray");
which would result in calling the processArray() function.
Any help or suggestion will be greatly appreciated !
Jerome
|
|
|
|
|
Use a map and add a macro to add new functions to the map. Then add code to execute the function in the map if it is found.
John
|
|
|
|
|
Hi,
thanks for your answer, but I'm not sure to know what is a map, and how I could use macro to add new functions to the map.
Could you be more specific ?
Thanks !
Jerome
|
|
|
|
|
A map will allow you to map the string names to the function pointers. This is STL and not a beginner subject. It's too early in the morning (05:33) for me to go into much depth now I'll see if I can expand later after I catch some more ...
John
|
|
|
|
|
Hi,
As I right understand you want create somthing
similar as command processor - take text input
and execute it commands.
Do do this simplest way is create association
between C++ functions(class members) and array( or map )
and function that should find 'assoc' in the array by
be text and call them.
Hope this help.
Vitali
|
|
|
|
|
Do you ultimatly want to make your application scriptable?
There are a few articles on how to do that on CP and they also explain what to do to let the scripts call methods of your applications objects.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
jhwurmbach wrote:
Do you ultimatly want to make your application scriptable?
Yes !
jhwurmbach wrote:
There are a few articles on how to do that on CP and they also explain what to do to let the scripts call methods of your applications objects.
Could you point out such articles ? I tried to search CodePorject for them (with keywords like 'scriptable') but couldn't find any !
Thanks !
Jerome
|
|
|
|
|
|
mmmmhh looks like my weekend will be very enjoyable !
Thanks !
Jerome
|
|
|
|
|
Use pointer to function.
like this
{
void (*f[3])(int) = {function1, function2, function3};
int iParam;
(*f[2])(iParam); //calling function2
}
void function2(int c)
(
cout<<"hi"<
|
|
|
|
|
Hi there,
I have an ATL control with some color properties (get/set) that can be changed by a property page. For the colors I use the MS Stock Color Property Page (CLSID_StockColorPage).
The problem with this property page is that the list, showing the colors that can be changed, does not have a horizontal scrollbar, so the final part of long property names is chopped off, and you can't see the difference anymore, if there are properties that only differ in the final part of the name.
Anyone else also seen this problem and solved it? Should I be using a different property page?
Any suggestions are welcome.
Marco Voorwinden
|
|
|
|
|
Hello
I've got a client/server application that sends small packets 10-50 bytes.
The server, running win2000, uses IOCP and WSARecv + WSASend.
The client uses an ownmade socket class also using WSARecv/WSASend and overlapped IO.
Both the client/server waits for a Read, handles it and invoked WSARecv again. WSASend is only invoked when something is waiting in the outbuffer.
Serverside:
The first two transactions are handled ok (both transactions are sent at the same time and is recieved with the same WSARecv). But the second transaction, sent a couple of seconds later, will not be read by the server.
The IOCP function gets called by the WSARecv but 0 bytes read are reported.
ClientSide:
After the last send I do a WSAGetOverlappedResult and it reports that the bytes were sent.
I've tried to disable the nagle algorithm and setting SO_SNDBUF + SO_RCVBUF to 0 in the client. I've also tried to set SO_SNDBUF/SO_RCVBUF to zero in the server.
client log:
Socket(3)(Connect): WSAConnect() OK!
Socket(3)(Read): WSARecv
Socket(3)(Read): pending read...
Send Trans: 0
Send Trans: 2
Socket(3)(Send): New data triggered.
Socket(1)(Send): WSASend
Socket(3)(Send): Write completed
Socket(3)(Read): Read completed.
Socket(2)(Read): WSAGetOverlappedResult
Recieve, Trans: 0
Socket(2)(Read): 71/71 bytes handled
Socket(3)(Read): WSARecv
Socket(1)(Read): Completed directly 14 bytes
Recieve, Trans: 2
Socket(2)(Read): 14/14 bytes handled
Socket(3)(Read): WSARecv
Socket(3)(Read): pending read...
Send Trans: 3
Socket(3)(Send): New data triggered.
Socket(1)(Send): WSASend
Socket(3)(Send): Write completed
Socket(3)(Read): Read completed.
Socket(2)(Read): WSAGetOverlappedResult <- returns 0 bytes
serverlog:
prio: 1 client: 4 Connect from 127.0.0.1:1201
prio: 1 client: 4 Read -> Incomming bytes: 29
prio: 3 client: 4 Recieve, Trans: 0
prio: 3 client: 4 Send, Trans: 0
prio: 1 client: 4 Send -> WSASend
prio: 2 client: 4 Send ->Sent 71/71 bytes. (flags: 0)
prio: 3 client: 4 Recieve, Trans: 2
prio: 3 client: 4 Send, Trans: 2
prio: 1 client: 4 Send -> WSASend
prio: 2 client: 4 Send ->Sent 14/14 bytes. (flags: 0)
prio: 2 client: 4 Read -> 29/29 bytes handled
prio: 1 client: 4 Read -> WSARecv
prio: 2 client: 4 Read -> Pending read inited
prio: 0 client: 4 0 bytes read!
prio: 1 client: 4 Read -> aborting, dead or shutting down...
What am I doing wrong?
|
|
|
|
|
One thing to make sure with IOCP is that you should make sure the same socket is not serviced by more than one thread at a time otherwise you will have problems.
John
|
|
|
|
|
John M. Drescher wrote:
One thing to make sure with IOCP is that you should make sure the same socket is not serviced by more than one thread at a time otherwise you will have problems.
Why? Im using CriticalSections..
|
|
|
|
|
I am trying to get a custom cursor working under DirectInput and Direct3D. The direct input is taken care of, I have my code to give me the screen coords that I want. The problem is I can't get my cursor to display at those coords. I am using the Scrawl example in the DX8 SDK as a guide. Here is the method:
void CShell::UpdateCursor(void)<br />
{<br />
PAINTSTRUCT ps;<br />
HDC hDC;<br />
<br />
hDC = BeginPaint( hWnd, &ps );<br />
if( NULL == hDC ) return;<br />
<br />
DrawIcon(hDC, iCursorX, iCursorY, hCursor);<br />
<br />
EndPaint( hWnd, &ps );<br />
}
I have tried calling this before, during and after the d3d beginScene and endScene. Maybe the DrawIcon call isn't working because the project is d3d, but I couldn't find anything to indicate this.
Any advice would be greatly appreciated.
....now where does this plug in....
|
|
|
|
|
How to limit resizing of the window? (Minimal size should be 100x100).
|
|
|
|
|
|
Hi,
I'm very new to MFC and have a very basic question.
How do I fire an event/massage from my program?
For example,
In the Tree Control,
Right Click on the Tree Control doesn't change the selection, so by using
m_nTree.GetSelectedItem(), I get the item which was selected earlier (even if I right click on a different item). If there was any way to trigger TVN_SELCHANGED event from the handler of right click event, my task would have been easier.
Please help.
Thanks,
|
|
|
|
|
try PostMessage or SendMessage.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
How can I add a custom menu to Internet Explorer(i.e an extra menu to Internet Explorer like utilities to do certain task)
|
|
|
|