Click here to Skip to main content
15,898,968 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: picture box problem Pin
Hamid_RT2-Feb-08 2:09
Hamid_RT2-Feb-08 2:09 
QuestionHow to share controls between property pages Pin
tigre2151-Feb-08 17:37
tigre2151-Feb-08 17:37 
AnswerRe: How to share controls between property pages Pin
Joan M2-Feb-08 5:04
professionalJoan M2-Feb-08 5:04 
GeneralRe: How to share controls between property pages Pin
tigre2154-Feb-08 8:13
tigre2154-Feb-08 8:13 
GeneralRe: How to share controls between property pages Pin
Joan M4-Feb-08 9:21
professionalJoan M4-Feb-08 9:21 
Questionhow to read windows2003 IPsec Settings Pin
jianxin08051-Feb-08 15:14
jianxin08051-Feb-08 15:14 
GeneralRunning Software on a remote machine Pin
Bram van Kampen1-Feb-08 14:44
Bram van Kampen1-Feb-08 14:44 
GeneralCreateHardwareEventMoniker Pin
act_x1-Feb-08 12:54
act_x1-Feb-08 12:54 
I am using some code to develop an Autoplay handler based on this application note.
http://msdn2.microsoft.com/en-us/library/bb776827.aspx

As described in this article, I would want to enable or disable the Autoplay feature by using code like this .

<br />
typedef HRESULT (*CREATEHARDWAREEVENTMONIKER)(REFCLSID clsid, LPCWSTR pszEventHandler, IMoniker **ppmoniker);<br />
<br />
HRESULT RegisterComponent(IUnknown* punk, DWORD* dpwToken)<br />
{<br />
    HRESULT hr = E_FAIL;<br />
    HINSTANCE hinstShSvcs = LoadLibrary(TEXT("shsvcs.dll"));<br />
	<br />
    if (hinstShSvcs)<br />
    {	<br />
        CREATEHARDWAREEVENTMONIKER fct = (CREATEHARDWAREEVENTMONIKER)GetProcAddress(hinstShSvcs, "CreateHardwareEventMoniker");<br />
        if (fct)<br />
        {<br />
            IMoniker* pmoniker;<br />
			<br />
            <big>hr = fct(CLSID_App, TEXT("VideoCameraArrival"), &pmoniker);</big><br />
<br />
            if (SUCCEEDED(hr))<br />
            {<br />
                IRunningObjectTable *prot;<br />
					<br />
                if (SUCCEEDED(GetRunningObjectTable(0, &prot)))<br />
                {<br />
                    hr = prot->Register(ROTFLAGS_ALLOWANYCLIENT | ROTFLAGS_REGISTRATIONKEEPSALIVE, punk, pmoniker, &_dwRegisterROT);<br />
                    prot->Release();<br />
                }<br />
                pmoniker->Release();<br />
            }<br />
            CoRegisterClassObject(CLSID_App, static_cast<IClassFactory *>(this), CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &_dwRegisterClass;<br />
        }<br />
        FreeLibrary(hinstShSvcs);<br />
    }<br />
    return hr;<br />
}<br />
<br />


However I find that there is an exception occuring in this line
hr = fct(CLSID_App, TEXT("VideoCameraArrival"), &pmoniker);

The exception is as follows :
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.


I am debugging this on Visual Studio 2005 and have no clue as to why this is happenning .

help is appreciated .

Engineering is the effort !

Questiona question of c++ primer in chaper 10 Pin
jianfengshxy1-Feb-08 11:03
jianfengshxy1-Feb-08 11:03 
GeneralRe: a question of c++ primer in chaper 10 Pin
Mark Salsbery1-Feb-08 11:30
Mark Salsbery1-Feb-08 11:30 
GeneralRe: a question of c++ primer in chaper 10 Pin
David Crow1-Feb-08 12:08
David Crow1-Feb-08 12:08 
GeneralRe: a question of c++ primer in chaper 10 Pin
Luc Pattyn1-Feb-08 12:09
sitebuilderLuc Pattyn1-Feb-08 12:09 
QuestionComm Timeout problem Pin
jonsey298471-Feb-08 10:18
jonsey298471-Feb-08 10:18 
GeneralRe: Comm Timeout problem Pin
Luc Pattyn1-Feb-08 12:13
sitebuilderLuc Pattyn1-Feb-08 12:13 
GeneralRe: Comm Timeout problem Pin
jonsey298471-Feb-08 23:24
jonsey298471-Feb-08 23:24 
GeneralRe: Comm Timeout problem Pin
Luc Pattyn2-Feb-08 2:31
sitebuilderLuc Pattyn2-Feb-08 2:31 
GeneralRe: Comm Timeout problem Pin
jonsey298472-Feb-08 7:56
jonsey298472-Feb-08 7:56 
GeneralRe: Comm Timeout problem Pin
Luc Pattyn2-Feb-08 8:01
sitebuilderLuc Pattyn2-Feb-08 8:01 
GeneralRe: Comm Timeout problem Pin
CPallini2-Feb-08 11:04
mveCPallini2-Feb-08 11:04 
GeneralRe: Comm Timeout problem Pin
Luc Pattyn2-Feb-08 11:38
sitebuilderLuc Pattyn2-Feb-08 11:38 
GeneralRe: Comm Timeout problem Pin
CPallini2-Feb-08 22:10
mveCPallini2-Feb-08 22:10 
GeneralMFC component gallery Pin
MFCfun1-Feb-08 7:37
MFCfun1-Feb-08 7:37 
GeneralRe: MFC component gallery Pin
Dave Calkins1-Feb-08 7:52
Dave Calkins1-Feb-08 7:52 
GeneralRe: MFC component gallery Pin
MFCfun1-Feb-08 8:04
MFCfun1-Feb-08 8:04 
GeneralRe: MFC component gallery Pin
Dave Calkins1-Feb-08 9:12
Dave Calkins1-Feb-08 9:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.