|
univega_r304 wrote: AfxMessageBox(_T(cstring));
The _T() macro is for string literals.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
univega_r304 wrote:
If you want to test this you can do do very easily by going to this link:
http://www.codeproject.com/com/webbrowser.asp[^]
This is basically something similar to what I have. Just edit the code, change the default site if you wish and add the event for the NewWindow3 compile and have at it to see what you can find...
I already had an application that uses this control, but for some reason it does not support the NewWindow3 event. What version of shdocvw.dll do you have? Mine is 6.0.2900.2937.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Unless it's on mulitple locations on my drive the version I have appears to be older... I have 6.0.2900.2919. According to the article on MSDN: NewWindow3 is available only in Microsoft Windows XP Service Pack 2 (SP2) or later. So if you have that, it should work...
FYI, after messing around a bit and not getting anywhere I put the code back that was showing me the proper URL in the debugger stopped working again. Same code, but bad results. I have't been able to get it to reproduce the proper URL in the debugger since.
|
|
|
|
|
Would you believe I *FINALLY* got it working?
Here's the code to make it work....
ON_EVENT(CLoadWebSite, IDC_EXPLORER, 273 /* NewWindow3 */, OnNewWindow3Explorer1, VTS_DISPATCH VTS_PBOOL VTS_BSTR VTS_BSTR VTS_BSTR)
void CLoadWebSite::OnNewWindow3Explorer1(LPDISPATCH FAR* ppDisp, BOOL FAR* Cancel, BSTR Flags, BSTR URLContext, BSTR URL)
{
CString strURL;
// capture URL of any link clicked that would attempt to open in a new window
if (URL != NULL)
strURL = (LPCTSTR)URL;
*Cancel = TRUE; // prevent IE from spawning
Browser.Navigate(strURL,NULL,NULL,NULL,NULL); // loads resulting URL into the web browser control instead of a spawned IE window
}
|
|
|
|
|
univega_r304 wrote: strURL = (LPCTSTR)URL;
This makes sense since a BSTR is really a type of char* . Could you have also done:
strURL = URL; as the assignment operator should handle the typecast automatically? If not, oh well.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Have a look at following code :
-----------------------------------------------------------------------------------------------------------------------
#include <afx.h>
#include <afxwin.h>
#include <conio.h>
#include <iostream>
using namespace std;
int main( int, char* [] )
{
CRect rc( 100,100, 500, 500 );
CRect rcOld;
CPoint pt;
GetCursorPos(&pt);
cout << "Current Position " << pt.x << ", " << pt.y << endl;
GetClipCursor(&rcOld);
ClipCursor( &rc );
cout << "Press any key to restore.." << endl;
getch();
ClipCursor( &rcOld );
return 0;
}
-----------------------------------------------------------------------------------------------------------------------
Looks foolproof.
Just build and run this application.
You will find that cursor indeed gets clipped in the area specified.
But, just do a right click and all clipping goes away !!!!
How can I resolve this? I dont want the clipped rect to go away till I restore the original rectangle back...
|
|
|
|
|
This is the correct behavior. The cursor is a shared system resource, no one app is allowed total control over it. Imagine if ClipCursor() worked 100% of the time. All you'd have to do was write an app that calls ClipCursor(0,0,1,1) and boom - instant denial of service.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I know that this question is not really related to Visual C++ but hopefully there will be someone here who has experience in real-time programming.
I'd like to allocate memory using malloc( ) function which allocates it on the internal SRAM. Does anyone know how I could do dynamic memory allocation on the SDRAM?
Time is the fire in which we burn.
|
|
|
|
|
where else do you think you can dynamically allocate some memory ?
use malloc(), it will do the job for you, unless you use C++, then, use new instead.
but never forget : when you dynamically allocate some memory, you have to free it yourself, otherwise you'll get into memory leaks hell...
|
|
|
|
|
ohhhhh! nice memory leaks never clean it after yourself!
is in C++ 'new' is a stub to call 'malloc'. by the way malloc is much faster than 'new' when called several hundred times.
9ine
|
|
|
|
|
9ine wrote: by the way malloc is much faster than 'new' when called several hundred times
but non reentrant... so, bad !
|
|
|
|
|
toxcct wrote: where else do you think you can dynamically allocate some memory ?
In multiple heap scenarios you can define your own memory segments to specify which area of memory is used to allocate various elements such as messages, semaphores etc. I have a feeling that this is processor dependend and not something that I can do with C standard functions. Is there a way of doing this without depending on the platform being used? I realize that my previous question is not clear enough and I apologize for that. I must stress that this is a Real-Time programming related question.
Time is the fire in which we burn.
|
|
|
|
|
That is platform dependent.
|
|
|
|
|
toxcct wrote: where else do you think you can dynamically allocate some memory ?
In real-time/embedded systems, where you allocate memory is often just as important as the memory you actually allocate. I believe the OP is asking how he can allocate memory in SDRAM instead of SRAM.
I think that is system dependent. I'm trying to remember my VxWorks stuff (haven't used it in a while) ... but I think you have to make a OS API call to allocate memory outside the default heap.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Thank you so much Zac. That answers my question.
Time is the fire in which we burn.
|
|
|
|
|
|
In my Form1 (VC++ .NET framework), I first need to add prototype of WindowProc in header file. Which section shall it be added private, protect, or public??
Is following prototype correct??
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
Is following implementation function header correct??
LRESULT CALLBACK Form1::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
}
|
|
|
|
|
if the function is a member of a class, you must declare it static, so that it wont have the implicit this parameter...
by the way, i may be wrong (i see you're talking about the .NET Framework) but the C++/CLI forum may be more appropriate for your question.
|
|
|
|
|
it should be either global or public static of a class.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
Last modified: Wednesday, August 09, 2006 9:20:41 AM --
|
|
|
|
|
Sarath. wrote: either
nope. it should be both !!!
|
|
|
|
|
ooops.. sorry man.. it was a mistake I meant either in global or in public static scope. I shall correct it
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
It should be a static function.
|
|
|
|
|
i think answering something that was posted about 2 hours before is not the best thing to do, especially if you don't provide much info...
|
|
|
|
|
hehe, I did not read the other answers
|
|
|
|
|
I'm writing VC++ .net framework code.
I need to retrieve the windows WM_DEVCHANGE message
Shall I use virtual void WndProc( Message* m ) override function or LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) function??
How shall I add either of them to my Form class???
May you write down the format?
|
|
|
|