|
Hi
Now I can access to CMOS registers by device driver. Only a pity is that the century value is not very right. For the data read from 0x32 register is not the realtime value.
Thanks for your attention!
|
|
|
|
|
I am trying to set a window to process notifications from directoshow like so:
cTrailer.pEvent->SetNotifyWindow((OAHWND) hwndNotify, WM_GRAPHNOTIFY, 0);
But I keep getting the following compile error:
error C2039: 'SetNotifyWindow' : is not a member of 'IMediaEvent'
I am using Visual C++ 6.0 and Direct X SDK 9.0
The strange thing is that in the sample code and the documentation, this is how it is done. What little settings am I missing here?
|
|
|
|
|
It is the IMediaEventEx interface that defines the SetNotifyWindow() method. IMediaEvent does not define it. If you get IMediaEvent try QI-ing for IMediaEventEx.
|
|
|
|
|
Arghhh stupid bug...I had queried it using IMediaEventEx but pEvent was defined as IMediaEvent in my class...stupid, stupid, stupid...thanks for the help.
|
|
|
|
|
I write an ATL control to implement the onunload event of the html.
I set the onunload handle through IHTMLBodyElement. But it did not work.
Source code as follow:
//definition of IDHTMLTest2 in IDL
interface IDHTMLTest2 : IDispatch
{
[id(1), helpstring("method ShowMsg")] HRESULT ShowMsg();
};
//selection of the source code
CComPtrspIE;
m_spClientSite->GetContainer(&spIE);
CComQIPtrspDoc(spIE);
if (spDoc){
CComPtr spElement;
spDoc->get_body(&spElement);
CComQIPtr spBody(spElement);
IDispatch* pShowMsg;
QueryInterface(IID_IDHTMLTest2,(void**)&pShowMsg);
VARIANT v;
v.vt=VT_DISPATCH;
v.pdispVal=pShowMsg;
//this event can't be invoke ,when close the ie-window
spBody->put_onunload(v);
//this invoke works well
((IDHTMLTest2*)pShowMsg)->ShowMsg();
//code below can works well
// v.vt=VT_BSTR;
// v.bstrVal = L"#DA70D6";
// spBody->put_bgColor(v);
}
Thank you for your advanced help.
Regards.
|
|
|
|
|
If I were to decide, this code should work. Some remarks:
1.Shouldn't you write
CComQIPtr<IID_IHTMLBodyElement> spBody(spElement);
Otherwise how does QI know wich interface to query for? Same with spDoc.
2.I would reccomend you to use smart dispatch pointer: IDispatchPtr. This way you don't have the trouble with QI and releasing it.
3.Since
spBody->put_bgColor(v);
((IDHTMLTest2*)pShowMsg)->ShowMsg();
seem to work, the problem should be with "v" or put_onunload.
Maybe 2. will solve the issue? Eventuelly you could try a CComVariant on "v".
4.What if setting with spElement's setAttribute onunload=ExitFunction, additionally inserting the ExitFunction with an alert?
Peter Molnar
|
|
|
|
|
I have tried by your advice. But it sitll not work.
And I set the default method.
[id(0), helpstring("method Prompt")] HRESULT ShowMsg();
The DHTML will invoke the default method with DISPID=0;
It still not work. Have you any source code which can run
smoothly .Could you send me for reference ?
Thank You.
Email: fengrux@hotmail.com
|
|
|
|
|
The last resort I see is to implement 4./
For this you will have to insert another attribute into the body tag with the name onunload.
you have two choices:
<body onunload="alert('This is my onunload message!')">
or
<script language=javascript>
function ExitFunction()
{
alert('This my ExitFunction message');
}
</script>
<body onunload=ExitFunction()>
Your code:
spElement->setAttribute(CComBSTR("onunload"),CComVariant("\"alert('This is my onunload message!')\""),0);
or
spElement->insertAdjacentHTML(CComBSTR("beforeBegin"),CComBSTR("...the entire script tag..."));
spElement->setAttribute(CComBSTR("onunload"),CComVariant("ExitFunction()"),0);
Peter Molnar
|
|
|
|
|
You mean insert code in the HTML ??
My intention is to fire the Event in the ActiveX control .
Thus , web designer without konwing about the Activex can simply using "<object>" tag to deploy the ActiveX.
|
|
|
|
|
Yes, you should definitly insert code into the HTML.
Of course this is not the HTML the user of your ActiveX creates but the HTML your ActiveX "perceives" of the user's HTML code or "thinks" the user wrote.
All this has the aim to fire the onunload event.
You know: the aim justifies the means...
Peter Molnar
|
|
|
|
|
OK I am watching tv like a scout and here is this fellow selling a book on hacking. He went on to show how to over-run a buffer and loading the stack with his code to cause the return to be over written.
Question 1: In dialogs we can force the command line to be read and set upon the stack, and in MDI - SDI they come naturally in InitInstance, should we place code in argv argc to limit the size of the argument.
Question 2: Should we disable or send argv and argc to a function the dump(s) them.
This is a real concern for me if the small man in the TV is right because I have applications written in vc and lcc since 1990 that scream with this flaw.
Please let me know what to do, I need your help on this one, any idea's will be appreicated.
Best Wishes,
ez_way
|
|
|
|
|
any Windows application uses GetCommandLine() API
to receive a pointer to its command line arguments,
or uses a parameter which is passed to its WinMain
function that points to the program command line.
After that,if you have a main function,
C Run-Time Libraries (CRT) formats the
arguments, seperates them, and counts them and then
sends them to your main function using argv and
argc.
if you use MFC, it has some wrappers around this
command line(but you can use __argc & __argv which are globally defined),anyway the
WinApp::m_lpCmdLine contains the raw command line.
Up to here no stack overflow or other flaws exist.
now it depends on your code to how to deal with
these arguments.
if you do something like:
char myparams[100];
strcpy(myparams, AfxGetApp()->m_lpCmdLine);
or even:
printf(AfxGetApp()->m_lpCmdLine);
then you have to review your old codes.
|
|
|
|
|
Yes but you miss the point. I understand how it works but let me explain that if someone overfloes the buffer with their code, that code is placed on the stack (near), when the app returns it will execute their code period. All they have to do is figure out how many bytes to oplace in the overrun.
Best Wishes,
ez_way
|
|
|
|
|
You're both saying the same thing. While it may be possible to break your older applications (only you know the answer to this), the bigger question you have to ask is "Would anyone bother?". If the payoff is small, a "hacker" is not going to bother.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi all:
please give me some information about using GDI+ in MFC model.
When I declare an Image pointer variabe 'myImage' in my XXDoc.h and,
I new an Image in XXDoc.c::OnOpenDocument() like that:
myImage = new Image (L"xxxxfilename", 0);
But I got an error message when compiling
error C2660: Gdiplus::GdiplusBase::operator new: no function declared in 3 parameters.
|
|
|
|
|
It only does that in DEBUG builds, one way around the problem is to use the ::new instead of DEBUG_NEW
myImage = ::new Image(L"xxxxfilename", 0);
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I would like to be able to distinguish Network Interface Cards installed on the system and Virtaul Adapters that are software or driver based (i.e. VMWare adapters). Does anybody know of a way to do this? Your help is greatly appreciated.
|
|
|
|
|
Hi,
How do you detect that a view window has been minimized (as by clicking on the view window's minimize button)? Should be an easy one, but none of the view's filtering functions like WindowProc and DefWindowProc seem to handle the WM_SYSCOMMAND messages. Is there a function you can call from the view to determine if it has been minimized or maximized?
Thanks for any help on this.
Terry
|
|
|
|
|
CWnd::IsIconic()
CWnd::IsZoomed()
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
CWnd::IsIconic()
CWnd::IsZoomed()
How are these functions used? I've tried putting the IsIconic function in the view's Idle (On Update)function, "minimize=IsIconic();" and it always returns 0, whether the view is minimized or not. Very frustrating that a simple thing like this is so obscure in MFC.
Terry
|
|
|
|
|
PJ Arends wrote:
CWnd::IsIconic()
CWnd::IsZoomed()
Well, it turned out to be slightly more complicated than this. IsIconic does work for views, but only if you use it in GetParentFrame->IsIconic().
Terry
|
|
|
|
|
I am fairly new (again) to VC++, I have seen alot of posts on memory leaks here, what do you use to check memory leaks? Is it a program that comes with VC? and does it tell you what lines the leaks accur in?
Thanks,...
Josh
|
|
|
|
|
If you run the application in debug mode,and then dismiss it, you will get fair bit of information about the memory leak in the debug window at the bottom, if you want detail analyis of memory leaks, rational purify is a good tool for that.
The World is getting smaller and so are the people.
|
|
|
|
|
|
I am new to programming and I am in a class right now, a beginners course to programming with C++, I usually would never ask for help like this, but I have a group project due tonight, and none of the other team members have posted their part of the project, so I have written all of them, except one, and I am sure it is simple, but I can't seem to get it, if anyone could show me this code, I would owe you big time.
Problem: a while loop to obtain and display the sum of sqaured even integers between a given range.
The mimimum aqnd maximum integer values of the rane are input by the user.
The program uses a subprogram to read the two integers.
The program uses a function with two parameters (the mimimum and maximum value of the range) to compute the result.
The program uses a subprogram to output the result.
I know this is a long shot, and not expecting a thing, but if you can help, I would greatly apprectiate it. Thank you in advance.
Cory renfrow
|
|
|
|