|
Hello Guys,
Can anybody of you can give me some ideas or links or code about how to convert .pdf file into .txt file.
Lot of readymade applications are available on net. I don't interested in all those but I want to make my own application for conversation.
Thanking You
C.R.Naik
|
|
|
|
|
You'll need to use the PDF SDK.
|
|
|
|
|
Friends,
Suppose we pass an object of a certain class as a reference to two other classes. It means that the two classes have a "same" copy of an object. This is a type of "composition"
Now insted of "composition", i want to get the same effect using "inheritance" OR i want my derived classes to inherit from "same" base class. Same base class means that the same base subobject. If one class make any change in the data of its parent, then the change should get reflected in the second class as its parent is same as that of first class.
How is it possible ???
|
|
|
|
|
What do you actually want to do? Are you a student quoting from your exercise or something?
You should rephrase your question so it actually makes sense.
|
|
|
|
|
Consider the following code:
class Parent
{
public:
SetValue(int a)
{
m_value = a;
}
private:
int m_value
};
class Brother:public Parent
{
brother()
{
SetValue(12)
{
};
class Sister:public Parent
{
Sister()
{
SetValue(8)
}
};
As can be seen above, the two classes "Brother" and "Sister" are derived from the same base class "Parent" Both the children classes have their own copy of "Parent". If the class "Brother" makes any change in the data member of "Parent", then the change will not effect the "Parent" of "Sister" as "Sister" has its own "Parent"
What i want is that, both the children classes should share the "same" parent. And if "Brother" changes the data present in its "Parent", then the data of the "Parent" of "Sister" should also gets changed automatically as both "Brother" and "Sister" will have same subobject "Parent".
How can i achieve this goal.
|
|
|
|
|
Jamal Jamshed wrote:
How can i achieve this goal.
static int m_value;
|
|
|
|
|
|
1) Create a base class that all related classes are derived from.
2) Make any member variables that you wish to be common to all derived classes static members.
3) If you are going to destroy (free) any of the members in the destuctor then you need to add a static reference counter member variable that is incremented in the constructor and decremented in the destructor.
class MyClass
{
static int m_nRefCount;
static int m_nMem1;
static whatever* m_pWhatEver;
...................
public:
...................
};
int MyClass::m_nRefCount = 0;
whatever MyClass::m_pWhatEver = NULL;
MyClass::MyClass()
{
++m_nRefCount;
}
MyClass::~MyClass()
{
if( --m_nRefCount < 1 )
{
if( m_pWhatEver is valid )
delete m_pWhatEver;
}
}
:-DHave a wonderful day.
INTP
|
|
|
|
|
hi..
everytime i start my program (and shut it down afterwards) VS reports two memory leaks.
i've tried the _crtBreakAlloc - technique (Q151585) to spot it.. but the problem is, that the allocation might occur, before i have got a chance to type in the number (i use "step into" to step into the code).. because it doesn't break at this numbers, but when i quit the program, the leaks occur.
is there any other possibility to stop at the allocation, which causes the problem ?(the "double click on line thingie" doesn't work too)
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
how can i use m_Combo.SetItemDataPtr for Combo Box to display each entered number in Edit control.??
I have a Edit Control field to enter variable Numbers and a Combo box from 1 to 10, every Index in Combo Box has to have a certain changed Edit Control Number.
Best reguards!
|
|
|
|
|
Hi!
Once I used "SetUnhandledExceptionFilter()" function to set my own exception filter function.Then I could turn to the filter function when the exception occured.But the problem was that I could not get the exception information(EXCEPTION_RECORD).I wanted to use "GetExceptionInformation()" to get it,but the compiler prompted:'_exception_info' : bad context for intrinsic function',I could not understand it,why?
Thanks!
|
|
|
|
|
The function GetExceptionInformation can only be used in the context of an __except block.
An easy way to use structured exceptions is to define an SE handler using the C run-time function _set_se_translator() . The CRT takes care of wiring everything together for you, so you don't have to worry about SetUnhandledExceptionFilter etc. You can even avoid __try/__except blocks by throwing a C++ exception.
Brad
|
|
|
|
|
Brad Sokol:
Your solution is good! Thanks very much!
Now I can do it well.
On the other hand,I have another idea in my exception function,I want to get more information about the locale of exception,such as the information of the stack,like the vc++'s debug tools!
Thanks!
|
|
|
|
|
Getting a stack trace including source file and line number is possible in both debug and release builds. The key is the EXCEPTION_POINTERS parameter. You need to use the symbols engine API which is in the dbghelp.dll library in the Platform SDK to translate the exception pointers into more useful information.
The best reference I've found for this is "Debugging Windows Applications" by John Robbins. He used to write the Bug Slayer column in MSDN magazine. You can find lots of his archived articles over at the href='http://msdn.microsoft.com'>MSDN site.
There is probably lots of useful stuff elswhere on the web but I don't have any links handy. Google for StackWalk or "win32 stack trace" and you'll probably find some useful links.
HTH
Brad
|
|
|
|
|
when i install ms SDK,systen tell me:
—hrror:System platform Windows2000 was detected,so MSI installation was not performed,however a current MSI installation wat not detected.MSI is required for Platform SDK setup?br />
so i can not install it sucessfully.
what aout it ?how to solve it?
thanks in advance!
|
|
|
|
|
Windows Installer Package (.msi) Files
That's all I know.
INTP
|
|
|
|
|
I want to print the content of a CRichEditCtrl. So far no problem for me, I know how to do it.
My problem is that I have to know the size of RTF text on the paper before I start the printing.
So I have to measure the size of the text depending on the resolution of a DC. If I have to print normal ASCII text I use the CDC::DrawText method with the option DT_CALCRECT which gives me the size of the text section for the given DC. Is there a simmilar method for RTF text?
As a workaround I think of using the CRichEditCtrl::FormatRange method and calculate the size iterative by giving a guessed value for the text rectangle to FormatRange and see, if all charcters fit into the rectangle. Now I size the rectangle until all characters fit into the rectangle.
Has anyone an idea how to solve the problem or is this the only solution?
Thanks in advance.
|
|
|
|
|
There is another solution: using windowless richedit
but you'll need to know COM
1. loadlibrary richedit.dll
2. obtain the CreateTextServices proc : GetProcAddress( hRichDll, "CreateTextServices" )
2. obtain the IID_ITextService : (GUID*)(GetProcAddress( hRichDll, "IID_ITextHost" ))
3. create an instance of ITextHost (a dummy one) .. read the doc
3. call query interfce for the ITextService
IUnknown* unk = NULL;<br />
(*fnCreateServices)( NULL, &m_TextHost, &unk );<br />
unk->QueryInterface( g_RichService, (void**)&m_Service );<br />
unk->Release( ); 4. send the rtf to the service
m_Service->TxSendMessage( EM_STREAMIN, SF_RTF, ... (doc)... )
5. ask the natural size
long forHeight = 1;<br />
SIZEL sze;<br />
sze.cx = forWidth;<br />
sze.cy = forHeight;<br />
<br />
m_Service->TxGetNaturalSize( DVASPECT_DOCPRINT, m_hDC, 0, NULL, TXTNS_FITTOCONTENT, (SIZEL*)<br />
&sze, &forWidth, &forHeight );
i cannot give you the whole source of the implementation of ITextHost because it should be too long, but read the ITextHost doc and implement the strict minimum.
i use that way to create dynamic rtf, calculate rtf display size, print rtf ...
notice that under XP, you should use 'msftedit.dll' instead of 'richedit.dll'
msftedit is really really faster.
good luke
|
|
|
|
|
arg mistake, read that
2. obtain the IID_ITextServices : (GUID*)(GetProcAddress( hRichDll, "IID_ITextServices" ))
|
|
|
|
|
Thank you for your detailed answer!
I hoped I could work with RTF without using COM, but I think I can not escape the Microsoft doctrine.
|
|
|
|
|
CFileFind find;
... ...
CString strTemp = find.GetFilePath();
on WindowsXP with language for non-unicode programs
"English(United States)"
to use CFileFind::GetFilePath to get file path,
the path is "F:\MY MUSIC\MP3\城里的月光.MP3",
which encoding chinese(PRC),
so strTemp get such as "F:\MY MUSIC\MP3\?????.MP3".
Is it unicode issue? How to solve it?
|
|
|
|
|
I just entered this note in my code.
Why?
{
...
CExBitmap exBmp;
exBmp.Attach(bmpBack.GetSafeHandle());
bResult = exBmp.function(...) [this == &exBmp]
{
...
CExBitmap bmpNew;
{
CWorkDC dcWork(NULL,this);
if( !bmpNew.CreateCompatibleBitmap(
&dcWork,newWidth,newHeight) )
{
return FALSE;
}
}
bmpNew.CopyBitmap(this);
HGDIOBJ hNew = bmpNew.Detach();
DeleteObject();
Attach(hNew);
...
return Result;
}
exBmp.Detach();
return Result;
} Solution:
{
...
CExBitmap exBmp;
exBmp.Attach(bmpBack.Detach());
bResult = exBmp.function(...)
{
...
CExBitmap bmpNew;
{
CWorkDC dcWork(NULL,this);
if( !bmpNew.CreateCompatibleBitmap(
&dcWork,newWidth,newHeight) )
{
return FALSE;
}
}
bmpNew.CopyBitmap(this);
HGDIOBJ hNew = bmpNew.Detach();
DeleteObject();
Attach(hNew);
...
return Result;
}
bmpBack.Attach(exBmp.Detach());
return Result;
}
I Known I am missing some thing, but what is it?
INTP (It is not enough to know the solution: you need to know why the solution worked!)
|
|
|
|
|
Well its out of scope for a start
|
|
|
|
|
No it is not out of scope!
INTP
|
|
|
|
|
Daaaa!
Problem:
exBmp.Attach(bmpBack.GetSafeHandle());
...
detach handle
delete handle
attach new handle
...
exBmp.Detach(); // detach new handle
bmpBack.GetSafeHandle() no longer valid
Solution:
bmpBack.Attach(exBmp.Detach());
INTP
|
|
|
|