|
I want to write an ActiveX shim for a Netscape-style plugin; however, I cannot locate the plugin code Plugins apparently do not contain a type library so #import doesn't work. Can anyone with some experience accessing a plugin dll from C++ give me a tip as to how to accomplish this or point me to some documentation?
David Ness
|
|
|
|
|
I want to create, show, and delete various CWnd or CWnd derived Windows:
<br />
void MyFoo(CRuntimeClass *pWndClass,...)<br />
{<br />
<br />
CWnd* pWnd = pWndClass->CreateObject();<br />
pWnd->Create(..);
...<br />
pWnd->ShowWindow(SW_SHOW);<br />
...<br />
pWnd->DestroyWindow();
delete (pWnd)
}<br />
pWnd can be any type of windows (e.r., CDialog, CFormView, CView,...). The problem is: if pWnd is a dialog or CDialog-derived object, it works ok. But if pWnd is derived from CView or CWnd but not from CDialog, the delete statement in the above function doesn't work with an error message as access denied (0xc0000005). So why doing that?
//
|
|
|
|
|
CView objects delete themselves using a delete this
So you should not delete CView and CView derived classes.
I am confused about your CWnd problem though.
Nish
CPUA # 0x0666
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Do you mean that every CView type class dynamically created should be deleted by itself within its class?
In my original example, the pWnd has a valid memory address, but the members of pWnd are not "valid", e.g., pWnd->hWnd = 0xddddddddd. I don't know how comes that.
|
|
|
|
|
Hi,
could you please answer a simple question:
my view shows initially grayed (not active) vertical and horizontal scrollbars, and I only want the first one.
I tried
BOOL CMyEditView::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &= ~WS_HSCROLL;
return CEditView::PreCreateWindow(cs);
}
but the horizontal scrollbars stayed.
How can I get rid of them?
Thanks
R.
|
|
|
|
|
This is just a guess, but have you tried reversing the order of the lines?
BOOL CMyEditView::PreCreateWindow(CREATESTRUCT& cs)
{
if(!CEditView::PreCreateWindow(cs))return FALSE;
cs.style &= ~WS_HSCROLL;
return TRUE;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Hi there,
I want to write a system tray icon that will recieve a file and then store that file in a specific directory.
I have written system tray icon classes before but I have never done any drag drop type stuff. Can anyone tell me where to start looking? I am not sure of the technologies/APIs/functions that I have to use.
Cheers in advance
Optic
|
|
|
|
|
Hi there,
Please forgive my ignorance, I'm a little new to MFC.
I wish to create an MDI program that uses the CHTMLEditView, to create HTML documents. When the document has been created, and the user wishes to save the document, instead of saving the file out to the file system, I'd like to write it out to a database.
I've thought that the way to go about this is to override the view's ID_FILE_SAVE and ID_FILE_SAVE_AS events.
Given that an HTML document is media rich, into what type of variable would I read the document contents?
I'm assuming that once read, the document content can be written to the database as a BLOB?
Thanx for any input!
skydiving....if at first you don't succeed, you're fecked!
|
|
|
|
|
The HTML portion of the document can be saved in a string because HTML is basically an overblown text file. Any images or media that the document references will have to be parsed for and then the elements found be stored as a BLOB.
Michael
|
|
|
|
|
Hi,
I can't laod a bitmap which is a resource in my exe. To just test a simple image loading, I also tried the MSDN sample:
HICON hIcon = LoadIcon(NULL, IDI_APPLICATION);
Bitmap bitmap(hIcon);
It can't load the icon (hIcon is correct).
bitmap.lastResult = InvalidParameter !!
I have the latest platform SDK update and I call GdiplusStartup() correctly.
Thanks a lot for your help.
Nicolas
|
|
|
|
|
Hello Nicolas!
I just had the same question about bitmap and icon resources the other day. Try this, you need to include the MAKEINTRESOURCEW macro:
HICON hIcon = LoadIcon(NULL, MAKEINTRESOURCEW(IDI_APPLICATION));
Straight from the SDK documentation:
Pointer to a null-terminated string that contains the name of the icon resource to be loaded.
^^^^^ That is what confused me. If your loading the icon from file then use the pointer to a string identifying the icon.
Alternatively, this parameter can contain the resource identifier in the low-order word and zero in the high-order word. Use the MAKEINTRESOURCE macro to create this value.
^^^^ This is what you need.
Cheers.
Jay Beckert
|
|
|
|
|
Good try
But I had already tried that and it doesn't work more. I can only load bitmaps from external files but it never works for resources event with MAKEINTRESOURCEW>
Nicolas
|
|
|
|
|
Sorry Nicolas,
Is the icon a resource of your application or are you trying to load one of the default icons? If the icon is a resource of your app then you need to pass the instance of your app instead of NULL. If its one of the default icons then you pass NULL as the first parameter. I would still use the MAKEINTRESOURCE macro.
Second, I didn't realize your Bitmap was for GDI+ and just realized what your missing. GDI+ is a bit different with respect to GDI. I still confuse the two. I would try this,
HICON hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
Bitmap* bitmap;
bitmap = Bitmap::FromHICON(hIcon);
Then use your graphics object to display your bitmap.
For some reason you just can't call a function alone from any GDI+ class without referencing the class it's from. ie. Bitmap::FromHICON(hIcon). Off the top of my head I can't remember why that is.
This should work if the icon is a resource of your application
HICON hIcon = LoadIcon(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(ID_ICONRESOURCE));
Bitmap* bitmap;
bitmap = Bitmap::FromHICON(hIcon);
Then use a graphics object to display your bitmap.
Let me know what happens.
|
|
|
|
|
The problem is not the icon or the bitmap. I can load a hbitmap or a hicon fron a resource but when passing it to a Bitmap gdi+ object it doesn't work. If I use an external bitmap it works.
Strange no ?
Thanks
Nicolas
|
|
|
|
|
I have a clue :
I am unfortunately on a Silicon Graphics (windows 2000) machine and maybe the display driver gives me this problem. I tested my program on another PC with windows 2000 also and it works.
Thanks anyway for trying to help
Nicolas
|
|
|
|
|
i have this code on a button and it is ment to find the last { and then read the text in front of it and output it to edit4?
s = "this would be the text{ste}";
string l = "{";
a = s.rfind(l);
Edit3->Text = a;
int a;
String s;
for (int i = a;i<=s.Length();i++){
Output = Output + i;
}
Edit4->Text = Output;
and in the end output should = ste on this example
|
|
|
|
|
char abc[100];
strcpy(abc,"abc{ghj{popeye}jjj");
char *t,*y;
t=strrchr(abc,'{');
y=strchr(t,'}');
if(y)
*y=0;
cout << t+1;
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
?????
|
|
|
|
|
The code snippet I posted is a demonstration of an easier way to achieve what you are attempting to do.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
soory i just got it thatnks a lot!!!!!!!!
|
|
|
|
|
The input string was :- abc{ghj{popeye}jjj
The output string is :- popeye
That's what you wanted huh?
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
thanks i just got it!
|
|
|
|
|
i have just got an error wit the line: y=strchr(t,'}'); on running it i changed the code a bit to:
char abc[1000];
char *Input;
strcpy(abc,Input);
char *t,*y;
t=strrchr(abc,'{');
y=strchr(t,'}');
if(y) *y=0;
cout << t+1;
HidPass = t;
does this have anything to do with it?
|
|
|
|
|
You need to do one more pointer validity check.
char abc[1000];
char *Input;
strcpy(abc,Input);
char *t,*y;
t=strrchr(abc,'{');
if (t) y=strchr(t,'}');
if(y) *y=0;
if(t) cout << t+1;
HidPass = t+1;
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|