|
Alok,
I am not getting the decrypted one while retrieving from the database...
Regards,
neha
|
|
|
|
|
Hi,
I created a macro to extract all text along with the speakernotes to a textfile. When I run this macro from visual basic it processed the (very large) powerpoint presentation in 5 sec.
Now I programmed exactly the same thing in Visual C++ but it takes 40 seconds to process the same file
Detail: I am not running my program in debug mode so that doesn't slow the process down
Anyone who has an explanation for this ??
The macro in VB and my code in C++ is attached to the post.
Note that I use Disphelper to communicate with the COM objects
Macro to extract all text and speakernotes in Visual Basic
----------------------------------------------------------
Sub ExportText()
Dim oPres As Presentation
Dim oSlides As Slides
Dim oSld As Slide 'Slide Object
Dim oShp As Shape 'Shape Object
Dim oShp2 As Shape 'Shape Object
Dim NotesText As String
Dim iFile As Integer 'File handle for output
iFile = FreeFile 'Get a free file number
Dim PathSep As String
Dim FileNum As Integer
PathSep = "\"
Set oPres = ActivePresentation
Set oSlides = oPres.Slides
FileNum = FreeFile
'Open output file
' NOTE: errors here if file hasn't been saved
Open oPres.Path & PathSep & "AllText.TXT" For Output As FileNum
For Each oSld In oSlides 'Loop thru each slide
For Each oShp In oSld.Shapes 'Loop thru each shape on slide
'Check to see if shape has a text frame and text
If oShp.HasTextFrame And oShp.TextFrame.HasText Then
Print #iFile, oShp.TextFrame.TextRange
End If ' Has text frame/Has text
Next oShp
For Each oShp2 In oSld.NotesPage.Shapes
If oShp2.HasTextFrame And oShp2.TextFrame.HasText Then
Print #iFile, oShp2.TextFrame.TextRange
End If ' Has text frame/Has text
Next oShp2
Next oSld
'Close output file
Close #iFile
End Sub
Same thing programmed in C++
-----------------------------
void Converter::convertPPT(const string &s1, const string &s2)
{
CDhInitialize init;
CDispPtr ppApp, ppPres, ppSlides, ppSlide, ppShape1, ppShape2;
dhToggleExceptions(TRUE);
//dhToggleExceptions(FALSE);
try
{
const char * inpath = s1.c_str();
const char * outpath = s2.c_str();
dhCheck( dhCreateObject(L"PowerPoint.Application", NULL, &ppApp) );
dhPutValue(ppApp, L".Assistant.On = %b", FALSE);
dhGetValue(L"%o", &ppPres, ppApp, L".Presentations.Open(%s,%d,%d,%d)", inpath,0,0,0);
remove(outpath);
ofstream outfile(outpath, ios::app);
const char * text = "";
bool one, two;
FOR_EACH(ppSlide, ppPres, L".Slides")
{
FOR_EACH(ppShape1, ppSlide, L".Shapes")
{
dhGetValue(L"%b", &one, ppShape1, L".HasTextFrame");
if (one)
{
dhGetValue(L"%b", &two, ppShape1, L".TextFrame.HasText");
if (two)
{
dhGetValue(L"%T", &text, ppShape1, L".TextFrame.TextRange");
outfile << text << endl;
}
}
} NEXT(ppShape1);
FOR_EACH(ppShape2, ppSlide, L".NotesPage.Shapes")
{
dhGetValue(L"%b", &one, ppShape2, L".HasTextFrame");
if (one)
{
dhGetValue(L"%b", &two, ppShape2, L".TextFrame.HasText");
if (two)
{
dhGetValue(L"%T", &text, ppShape2, L".TextFrame.TextRange");
outfile << text << endl;
}
}
} NEXT(ppShape2);
} NEXT (ppSlide);
outfile.close();
}
catch (string errstr)
{ cerr << "Fatal error details:" << endl << errstr << endl; }
dhCallMethod(ppApp, L".Quit");
}
|
|
|
|
|
hello
can someone please tell me what is wrong with this function I wrote:
<br />
<br />
BOOL scan(char *url2search4)<br />
<br />
{<br />
MessageBox(0,url2search4,"a",MB_OK);<br />
<br />
INTERNET_CACHE_ENTRY_INFO icei;<br />
<br />
HANDLE the_cache_handle;<br />
<br />
unsigned long buffer_size=10324;<br />
<br />
the_cache_handle =FindFirstUrlCacheEntry(NULL,&icei,&buffer_size);<br />
<br />
if(the_cache_handle==NULL)<br />
{<br />
DisplayError(GetLastError());<br />
return FALSE;<br />
}<br />
<br />
<br />
while(FindNextUrlCacheEntry(the_cache_handle,&icei,&buffer_size))<br />
<br />
{<br />
MessageBox(0,icei.lpszSourceUrlName,"uite ce am gasit",MB_OK);<br />
<br />
if(strstr(icei.lpszSourceUrlName,url2search4)==0)<br />
{<br />
<br />
MessageBox(0,"egal","equal",MB_OK);<br />
return TRUE;<br />
}<br />
<br />
}<br />
<br />
return FALSE;<br />
}<br />
<br />
everything builds ok and runs but I never get to actually find a url even thought when I go to
C:\Documents and Settings\[MyUserName].000\Local Settings\Temporary Internet Files
I can see it there
Similar functions from Wininet.h work, like DeleteUrlCacheEntry
No matter what I do the_cache_handle is always NULL and the GetLastError fucntion returns "this parrameter is incorect"
here is the Display Error Function also if you think this might help
<br />
<br />
void DisplayError(DWORD dwError ) <br />
{<br />
<br />
LPTSTR lpBuffer = NULL;<br />
<br />
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError,<br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpBuffer, 0, NULL );<br />
if(dwError!=0) MessageBox(GetActiveWindow(), lpBuffer, "Error", MB_OK|MB_ICONERROR);<br />
LocalFree( lpBuffer );<br />
<br />
<br />
}<br />
Please help
thank you in advance
|
|
|
|
|
The first problem I see is you're not seting the dwStructSize member of your INTERNET_CACHE_ENTRY_INFO struct.
You're also telling FindNextUrlCacheEntry() that you are passing in a 10324-byte buffer, but your actual buffer isn't that big (it's just one struct).
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
The INTERNET_CACHE_ENTRY_INFO structure displays two common Windows API features. It contains a structure size member (dwStructSize ) for versioning purposes - compatibility can be maintained if further fields are later added. The declared structure also does not completely describe the returned data - in fact the structure is only a header, with more data following on.
I think you're getting ERROR_INVALID_PARAMETER because the size isn't recognized, because you haven't initialized it. You'll need to allocate memory dynamically because you don't know how big the cache data will be.
Your code probably needs to be something like:
BOOL scan( char* url2search4 )
{
INTERNET_CACHE_ENTRY_INFO* picei = NULL;
DWORD dwBufferSize = 0;
HANDLE cacheHandle = FindFirstUrlCacheEntry( NULL, picei, &dwBufferSize );
BOOL success = FALSE;
while ( cacheHandle == NULL && GetLastError() == ERROR_INSUFFICIENT_BUFFER )
{
delete[] (TCHAR*) picei;
picei = (INTERNET_CACHE_ENTRY_INFO*) new TCHAR[dwBufferSize];
picei->dwStructSize = sizeof( INTERNET_CACHE_ENTRY_INFO );
cacheHandle = FindFirstUrlCacheEntry( NULL, picei, &dwBufferSize );
}
if ( cacheHandle != NULL )
{
for( ; ; )
{
puts( picei->lpszSourceUrlName );
success = FindNextUrlCacheEntry( cacheHandle, picei, &dwBufferSize );
while ( !success && GetLastError() == ERROR_INSUFFICIENT_BUFFER )
{
picei = (INTERNET_CACHE_ENTRY_INFO*) new TCHAR[dwBufferSize];
picei->dwStructSize = sizeof( INTERNET_CACHE_ENTRY_INFO );
success = FindNextUrlCacheEntry( cacheHandle, picei, &dwBufferSize );
}
if ( !success )
break;
}
FindCloseUrlCache( cacheHandle );
}
delete[] (TCHAR*) picei;
return TRUE;
} Hope this helps.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
thank you mister
the code works well except for one thing
I don't know how to compare the string I get from the FindNextUrlCacheEntry function with the one I have as a parameter:
if I do like this
<br />
<br />
if(strcmpi(picei->lpszSourceUrlName,url2search4)==0)<br />
{<br />
MessageBox(0,"egal","equal",MB_OK);<br />
return TRUE;<br />
}<br />
<br />
I get an unhandeled exception error
I also tryed with StrCmpI but it also doesn't work
any ideas on how to make this work
|
|
|
|
|
this works but it takes up a lot of memory
every time this thing completes a cicle the memory usage increases and then after about an hour I get a message from windows telling me that memory is to low
I see that you use delete to delete that structure but it doesn't seem to be working because memory usage just keeps getting bigger and bigger
Is there no way around this?
|
|
|
|
|
i am using an mfc applicaion in cform view and i need to send a custom messge from a dialog in the applicaion to another cform , in another view.
i use the postMessage but it is not working. it work only in the form in which the message processing is done. can any body help me?
thanks and regards
kittu
|
|
|
|
|
1st define your message
#define WM_MYMESSAGE WM_USER+0x100
2nd create your message handler in the window:
in the header:
LRESULT OnMyMessage(WPARAM wParam, LPARAM lParam);
in the cpp define your message call in the message table:
ON_MESSAGE(WM_MYMESSAGE, OnMyMessage)
still in the cpp implement your message handler:
LRESULT CMyWnd::OnMyMessage(WPARAM wParam, LPARAM lParam)<br />
{<br />
...<br />
return ...;<br />
}
have fun.
There is no spoon.
|
|
|
|
|
Actually, WM_APP is preferred over WM_USER . See this[^] article.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
That caught me offgard, I have not looked up WM_USER since the 3.1 days.
WM_USER: Used by private window classes. (it's not obsolete)
WM_APP: Used by applications. (non-class specific)
If you want to define messages that can be meaningful for all classes in your application, then you need to use WM_APP. In this case you should NOT difine two messages with the same value.
If you use WM_APP to difine user specific private window class messages, then you run the risk of clashing with user specific application defined messages.
The creator of the private windows class and the creator of the main application may not be the same person.
Private widows class messages and application wide messages are two different things.
So, do not believe everything you read. Be carefull!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
And then there is alway my favorite - RegisterWindowMessage - MSDN: The RegisterWindowMessage function defines a new window message that is guaranteed to be unique throughout the system. The message value can be used when sending or posting messages.
|
|
|
|
|
Hello,
How can i make a button invisible dynamically and then make it visible again? I think CButton::SetButtonStyle() cannot do.
Thanks in advance..
|
|
|
|
|
ShowWindow(SW_HIDE) , ShowWindow(SW_SHOW) .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
i thought ShowWindow did not work for the controls, but only the windows.
thank you!
|
|
|
|
|
Controls are windows also .
|
|
|
|
|
If you make a button on a form/dialog invisible, you might also want to disable it as well, because otherwise, the user might still tab to it or otherwise activate the window.
ControlWindow.EnableWidnow(FALSE);
ControlWindow.ShowWindow(SW_HIDE);
...
ControlWindow.ShowWindow(SW_SHOW);
ControlWindow.EnableWidnow(TRUE);
|
|
|
|
|
I'm trying to use a macro to include/exclude a function based on another define.
e.g.
#ifdef CK_DUMP
#define CKOBJ_DUMP_HEAD(CkClass) \
void FkObjDump( const CkClass &OBJ, CkFile &F ) \
{
#define CKOBJ_DUMP_TAIL \
}
#else // !CK_DUMP
#define CKOBJ_DUMP_HEAD(CkClass) /*
#define CKOBJ_DUMP_TAIL */
#endif
And use like:
CKOBJ_DUMP_HEAD(MyClass)
F.Write("blah blah blah");
CKOBJ_DUMP_TAIL
What i want is to comment out the block of code, but it doesn't like the /* */, nor does it like #if 0 #endif, nor anything else i've tried.
Any ideas ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hello,
This certainly looks strange! I can see what you are trying to do and I'll show you a good solution in a moment.
First, your CKOBJ_DUMP_HEAD(CkClass) is a single line macro. The problem here is that you have placed a multiline comment there that comments out everything until a '*/' is found. Therefore the CKOBJ_DUMP_TAIL does not exist. Therefore your solution will never work.
Now, a solution that will work is the following and this is applied often in a class design. I assume here that you have objects that you want to dump.
1) Add a dump method to all the classes that need one. (in the CKDUMP section)
2) Define the following maco
<br />
#ifdef CKDUMP<br />
# define CK_DUMP_OBJ(OBJ) OBJ->Dump(); <br />
#else // !CK_DUMP<br />
# define CK_DUMP_OBJ(OBJ) <br />
#endif // CKDUMP<br />
Hope this helps.
I also got the blogging virus..[^]
|
|
|
|
|
Bob Stanneveld wrote:
The problem here is that you have placed a multiline comment there that comments out everything until a '*/' is found.
Yes, i knew what the problem was.
What i am looking for is a way to comment out the entire dump function, not just a call to it.
While i appreciate the reply, your solution doesn't do what i want.
It still requires that a dump function gets compiled - the method in the class.
What i was doing was:
MyClass.cpp
-----------
#ifdef CKDUMP
void FkObjDump( const MyClass &OBJ, CkFile &F )
{
...
}
#endif
which works fine.
I am trying to remove the #ifdef's from each source file and was looking for a way to move the equivalent functionality to a macro.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
http://www.codeproject.com/com/outlookaddin.asp[^] the above article has a line
spCmdButton2->PutFaceId(1758); where spCmdButton2 is Office::_CommandBarButton.
Thi loads the bitmap resource with id 1758 from somewhere ! Can some body help me to find out from which file it loads the resource.
|
|
|
|
|
helloo......great people......
i want to use "ObjectFromLresult" but problem is this:->
Windows 95/98/Me: Unsupported......
So what should i do??????? plz help me ASAP...
Thanx .
__________________________________________________________________________
keep smilling.....b'coz smile is the shortest distance between people....
|
|
|
|
|
The Redistributable line in MSDN Library documentation indicates that support for older operating systems is available by installing a redistributable library.
For this feature, use the Active Accessibility 2.0 RDK[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
hi,
I have created one service called MyService. In this service, I want to
run an executable file which resides in Shared folder of remote
machine. i.e. \\COMP1\share\file.exe
For that I want to use CreateProcessWithLogonW() method.
In MSDN, it is mentioned that CreateProcessWithLogonW() is declared in
WINBASE.H. But when i searched WINBASE.H, it was not there.
Please help .
bhavesh
|
|
|
|
|
CreateProcessWithLogonW is only available on Windows 2000 and later. Visual C++ 6.0 predates Windows 2000. Download the latest Platform SDK[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|