|
You're welcome
BTW. That was one heck of a speedy reply
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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 everyone!
I have to get the text from a ms word document (.doc) and save the text to a text file (.txt).
Have any of you guys done this? Or can you give me a hint where to start?
majo
|
|
|
|
|
Here's one way using Word Automation:
CString strFileName;
_Application app;
Documents docs;
_Document doc;
COleVariant vtOptional((long) DISP_E_PARAMNOTFOUND, VT_ERROR),
vtFalse((short) FALSE),
vtTrue((short) TRUE),
vtDoc((short) 0),
vtText((short) 2),
vtRtf((short) 6),
vtHtml((short) 8);
if (app.CreateDispatch("Word.Application") == TRUE)
{
docs = app.GetDocuments();
m_ebDocName.GetWindowText(strFileName);
doc = docs.Open(COleVariant(strFileName), vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional);
strFileName.Replace(".doc", ".txt");
doc.SaveAs(COleVariant(strFileName),
vtText,
vtOptional,
vtOptional,
vtOptional,
vtOptional,
vtOptional,
vtOptional,
vtOptional,
vtOptional,
vtOptional);
docs.Close(vtFalse, vtOptional, vtOptional);
app.Quit(vtOptional, vtOptional, vtOptional);
}
|
|
|
|
|
Thanks a lot!
I will try this...
majo
|
|
|
|
|
Here is a static PINT varible: temp.
I want to store the value "12" to *temp, and my program coded like below
static PINT temp;
* temp=12;
I can succeed in compiling it, but there is an error when running it:
The instruction at "0x00406a3a" referenced memory at"0x00000000". The memory could not be "written".
What is the problem? How can solve it?
Thank you in advance!
|
|
|
|
|
Try:
static PINT temp;<br />
temp = new int;<br />
*temp = 12;
|
|
|
|
|
Obviously temp doesn't point to anything. You need to point it to an integer before attempting to dereference it.
onwards and upwards...
|
|
|
|
|
I see, after seeing your explanation
Can I ask another question?
First I completet the below sentences:
PINT temp;
temp=new int;
Then I have a PVOID varible temp2,which is to be applied like
temp=(PINT)temp2;
Is it right after twice times of putting the pointer?
Thank you!
|
|
|
|
|
Hi all,
i have a SYSTEMTIME that represents the hour '03:02:25 PM' i want to
represent this time as STRING!
i am not using MFC, i use ATL/Win32API
can any1 help?
thanks in advanced,
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
strftime will probably do what you ask.
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
|
|
|
|
|
thanks for the reply!
this is what i use:
void CSimpleDlg::SetStartTime(SYSTEMTIME& stStart)
{
wchar_t* wcStartTime = new wchar_t[MAX_SIZE_STRING_TIME];
wcsftime(wcStartTime,MAX_SIZE_STRING_TIME,L"%H:%M:%S",&stStart);
}
i get a compilation error regarding last parameter should be of 'tm' struct.how do i convert from SYSTEMTIME to tm?
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
you might also do it that way:
<br />
wchar_t* wcStartTime = new wchar_t[MAX_SIZE_STRING_TIME];<br />
swprintf(wcStartTime, "%i:%i:%i", stStart.wHour, stStart.wMinute, stStart.wSecond);<br />
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
thanks a lot man, you really helped me.....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
You're welcome!
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi again,
i need another help....
i want the system to conver the time to string as given from the SYSTEMTIME
(i.e - if the SYSTEMTIME was 03:02:03 AM then the string should be 03:02:03 AM and if the SYSTEMTIME was 15:02:03 then the string should be accordingly 15:02:03)
can u help me again plz?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Repeat the question... I'm a novice speaking english, but what you've written have nosense... (I think)
|
|
|
|
|
The values in the SYSTEMTIME structure are in no particular format. It's up to you to format them into a variable. For example:
char str[32];<br />
SYSTEMTIME st;<br />
GetSystemTime(&st);<br />
sprintf(str, "%02u:%02u:%02u", st.wHour, st.wMinute, st.wSecond);
|
|
|
|
|
The WIN32 api has some powerful functions for formatting SYSTEMTIME vars. See GetDateFormat and GetTimeFormat in the docs.
onwards and upwards...
|
|
|
|
|
Hello,
I have a problem ... I want to capture the desktop and save it in a 24Bit bitmap ... my desktop can be 256, 16bit or 32bit color.
How can I do that ? It works fine if the desktop is in 24bit ... but I want to convert a HBITMAP from 256, 16bit, 32bit to 24bit ... I hope I will not have to convert it manualy by saveing it byte by byte .... I hope there is something in windows that can take care of it ... because I saw 15Bit color and God knows many these types can be and I hope I don't have to take care of all... Please if anone can help me... !!! thanks !!!
|
|
|
|
|
|
it's cool .... !
thanks .... !!!
|
|
|
|
|
Hi
Recently I installed Visual Studio .NET for testing purposes, but kept Visual Studio 6 on my HDD. Now I uninstalled VS .NET and VS6 doesn't handle files like .dsw,.cpp,.h etc anymore. How do I restore the file associations with VC6 again?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Either reinstall, or set the associations manually. VS6 doesn't include any tools for redoing the associations.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
Ok thanks, seem like it's gonna be a lot of work. Do I lose my VC settings like colors, fonts, include/lib folders etc. if I reinstall?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greg S. wrote:
Do I lose my VC settings like colors, fonts, include/lib folders etc. if I reinstall?
Yeah, but you can backup that part of the registry first (just export to a .reg file, and import again after the install)
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|