|
Hello folks,
I trying to instatiate a activex control, print template from Internet Explorer. The argv[1] parameter it's a path string to a HTML file(like these: c:\MyTemplate.htm). But it seems the type of vTemplatePath don't match and an exception is launched:
Error on line 474 atlbase.h
Expression: p!=0
I'm sorry to post this question here, but I'm a noob in C++. I'm a web programer(PHP, javascript, action script II), and I need very much of this.
Someone can help me to solve this?
Thanks a lot!
//Microsoft reference
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html/beyondprintpreview.asp
//code
int main(int argc, char * argv[])
{
int i;
IOleCommandTarget* pCmdTarg;
CComPtr<iwebbrowser2> pWB;
pWB->QueryInterface(IID_IOleCommandTarget, (void**)&pCmdTarg);
VARIANT vTemplatePath;
V_VT(&vTemplatePath) = VT_BSTR;
CComVariant vPTPath = argv[1];
pCmdTarg->Exec(&CGID_MSHTML, IDM_PRINTPREVIEW, NULL, &vPTPath, NULL);
return 0;
}
|
|
|
|
|
pWB is NULL.
No Webbrowser conrol bas been created.
COM hasn't been initialized (by calling CoInitialize or friends).
Steve
|
|
|
|
|
Use:
CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (void**)&pWB);
received same error.
|
|
|
|
|
Call CoInitialize - It should be the first (or close to) thing your program does. The WebBrowser in an ActiveX control - Do you plan in implementing ActiveX control containment youself? I suggest looking up ActiveX controls and how to host them.
Steve
|
|
|
|
|
|
hi all
i had used the code from msdn for making menu with icons/bitmap. which is listed below.
ASSERT(m_CheckBitmap.LoadBitmap(IDB_CHECKBITMAP));
ASSERT(m_UnCheckBitmap.LoadBitmap(IDB_UNCHECKBITMAP));
// Associate bitmaps with the "Test" menu item.
CMenu* mmenu = GetMenu();
CMenu* submenu = mmenu->GetSubMenu(3);
ASSERT(submenu->SetMenuItemBitmaps(ID_HELP_TEST, MF_BYCOMMAND,
&m_CheckBitmap, &m_UnCheckBitmap));
it works fine. but when i click/select the menu item then the color of the bitmaps changes to somewhat like blue. tell me what to do with this.
ddd
|
|
|
|
|
I think that is normal behavior because the system is trying to combine the icon/bitmap with the selection color.
I think you have to do your own owner-drawn menus to get around that. There are articles here on CP (I think) that can demonstrate how.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
thanks for reply
when i use the menu that r by default means geberated by wizard first time then it works fine no color changes but when i write new menu(own) then this problem occur.
ddd
|
|
|
|
|
I created a dialog based application. My monitor was set to 1024x768. Now when i change it to 800x600 all the buttons are misaligned. How can i write an application that works in all the screen resolution
|
|
|
|
|
size and location?
if yes I suggestion use movewindow in the wm_size
|
|
|
|
|
Did you create the buttons at runtime?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
i also have the simillar problem
but its quite different
Button displayed without misalignment 1024*768 in windows xp of my computer
But it misaligns in windows xp of other computer.
I used skin
can any one help me
JAYARAJ
|
|
|
|
|
J5121982 wrote: i also have the simillar problem
but its quite different
If you have a similar problem, how can it also be quite different?
J5121982 wrote: But it misaligns in windows xp of other computer.
What is the resolution of this computer?
Are you creating the buttons/controls at runtime?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I think the buttons are created without movewindow(no runtime)
so if resol from 800 to 1024 then location buttons isnt good
|
|
|
|
|
DavidCrow wrote: If you have a similar problem, how can it also be quite different?
Regards,
Nish
|
|
|
|
|
I created the buttons using the resource editor ie dropping the button on the dialog..
|
|
|
|
|
If you placed a button 5 DLUs from the top-left corner of the dialog, it will remain at that position regardless of the screen's resolution. If it's not, you are doing something else.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: 5 DLUs
What is DLU
The position of the buttons with respect to the dialog hasnt changed but the dialog is so big tat it doesnt fit in the screen and so the buttons are not visible.
DavidCrow wrote: you are doing something else
I have not done anything
-- modified at 13:38 Tuesday 7th March, 2006
|
|
|
|
|
nripun wrote: What is DLU
Dialog coordinates are measured in DiaLog Units, or Dialog Box Unit. It is device independent. They allow the dialog box and its controls to be sized correctly when the development and target machines are different.
nripun wrote: The position of the buttons with respect to the dialog hasnt changed but the dialog is so big tat it doesnt fit in the screen and so the buttons are not visible.
That's a different problem altogether. You can't expect a dialog designed for 1024x768 to fit on a 640x480 monitor. You need to design for the least common denominator.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Is there a way to check and change the monitor resolution from the VC++ program.
I needed a big dialog to previwe 4 camera feeds on the dialog box each occupying a display area of 352x288 and with adequate spacing between each display area. the dialog has a few buttons also. So i cant fit all of these in a dialog if the monitor 800x600 resolution.
So when i run the application in a diff machine i can check the resolution and fix it.
|
|
|
|
|
nripun wrote: Is there a way to...change the monitor resolution from the VC++ program.
See ChangeDisplaySettings() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Can you send me an example that I run it an HTML file run .
tnks
|
|
|
|
|
ShellExecute(NULL,"open","yourHTMLFilePath.html",NULL,NULL,SW_SHOWNORMAL);
Nibu thomas
Software Developer
|
|
|
|
|
|
man ! do you look at your answers[^] when asking for something ?!
[edit]
ah I see, you deleted your post after my second reply to make people think I'm dumb ?
but you failed...
[/edit]
-- modified at 7:52 Tuesday 7th March, 2006
|
|
|
|