|
Have a look at TB_ENABLEBUTTON in MSDN.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
hi please tell
How i can change custom level of security (for example ActiveX control and plugins) of trusted sites , programmatically?
Is it possible by using IInternetSecurityManager interface?
Thanks.
-- modified at 0:43 Monday 19th November, 2007
-- modified at 5:02 Monday 19th November, 2007
destined to win
|
|
|
|
|
I took the code form http://www.gdcl.co.uk/downloads.htm for mpeg1 parser filter and registered the sample parser with the help of regsvr32. then i wrote the following program to create an exe file to play the sample parser.
here CLSID_SampleWaveParser is the guid that is used for samplewave parser in the mpeg1 file.
When i execute the following code it executes successifully untill the end of the file which ever i have selected but after completion of the file it give the following error.
4 objects left active. in 316 line of dllentry.cpp.
can u tell me how can i remove this error.
or is there any other method to create an executable file for the dll which is created by the mpeg1 wave parser.
#include <InitGuid.h>
#include <DShow.h>
//0xD84E3EC9, 0x3233, 0x4177, 0xA3, 0xAF, 0x13, 0xB6, 0xF9,0x33, 0x49, 0x8D);
// our own definition of Wave Parser based on CLSID we found in registry
#define INITGUID // have to define this so next line actually creates GUID structure
DEFINE_GUID(CLSID_SampleWaveParser,0xD84E3EC9, 0x3233, 0x4177, 0xA3, 0xAF, 0x13, 0xB6, 0xF9,0x33, 0x49, 0x8D);
void main(void)
{
HRESULT hr;
IGraphBuilder* g_pGraphBuilder = NULL; // assume graph builder already created
IBaseFilter* g_pSource = NULL;
IBaseFilter* g_pWaveParser = NULL;
IBaseFilter* g_pSoundRender = NULL;
IFileSourceFilter *pFileSourceInt = NULL;
IMediaControl *gControl = NULL;
IMediaEvent *gEvent = NULL;
IEnumPins* EnumPins = NULL;
IPin* OutPin = NULL;
IPin* InPin = NULL;
ULONG fetched;
PIN_INFO pinfo;
long evCode=10;
CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph, NULL,CLSCTX_INPROC_SERVER,IID_IGraphBuilder, (void **)&g_pGraphBuilder);
CoCreateInstance(CLSID_SampleWaveParser, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&g_pWaveParser);
CoCreateInstance(CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&g_pSource);
CoCreateInstance(CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&g_pSoundRender);
g_pGraphBuilder->AddFilter(g_pSource,NULL);
g_pGraphBuilder->AddFilter(g_pWaveParser, NULL);
g_pGraphBuilder->AddFilter(g_pSoundRender,NULL);
hr = g_pSource->QueryInterface(IID_IFileSourceFilter, (void**)&pFileSourceInt);
hr = pFileSourceInt->Load(L"D:\\test.rpm",NULL);
if( hr == E_FAIL)
printf("\n Failed to open the file\n");
// find source output
g_pSource->EnumPins(&EnumPins);
EnumPins->Reset();
EnumPins->Next(1, &OutPin, &fetched); // only 1 pin for source, so we know this is the one we need
EnumPins->Release();
// find wave parser input
g_pWaveParser->EnumPins(&EnumPins);
EnumPins->Reset();
EnumPins->Next(1, &InPin, &fetched);
InPin->QueryPinInfo(&pinfo);
pinfo.pFilter->Release(); // make sure you release the returned IBaseFilter interface
if (pinfo.dir == PINDIR_OUTPUT) // check if we have wrong pin (not input pin)
{
InPin->Release();
EnumPins->Next(1, &InPin, &fetched); // if so, get next pin
}
// connect
g_pGraphBuilder->Connect(OutPin, InPin);
InPin->Release();
// OutPin->Release();
// find wave parser audio output pin
EnumPins->Next(1, &OutPin, &fetched);
EnumPins->Next(1, &OutPin, &fetched);
OutPin->QueryPinInfo(&pinfo);
if (pinfo.dir == PINDIR_INPUT)
{
OutPin->Release();
EnumPins->Next(1, &OutPin, &fetched);
OutPin->QueryPinInfo(&pinfo);
}
EnumPins->Release();
OutPin->Release();
// find renderer input
g_pSoundRender->EnumPins(&EnumPins);
EnumPins->Reset();
EnumPins->Next(1, &InPin, &fetched); // renderer has only 1 pin, so this is the pin we need
EnumPins->Release();
// connect
g_pGraphBuilder->Connect(OutPin, InPin);
InPin->Release();
OutPin->Release();
hr = g_pGraphBuilder->QueryInterface(IID_IMediaControl, (void **)&gControl);
hr = g_pGraphBuilder->QueryInterface(IID_IMediaEvent, (void **)&gEvent);
hr = gControl->Run();
gEvent->WaitForCompletion(INFINITE,&evCode);
hr = gControl->Stop();
gControl->Release();
gEvent->Release();
g_pWaveParser->Release();
g_pSoundRender->Release();
g_pSource->Release();
g_pGraphBuilder->Release();
CoUninitialize();
}
amiya kumar das
|
|
|
|
|
here CSharpHelloWorld.netmodule is in the bin folder of the managed c++ project
#include <mscorlib.dll>
#include "CSharpHelloWorld.netmodule"
#include namespace System;
public __gc class HelloWorldC
{
public:
CSharpHelloWorld __gc *t; // Provide .NET interop and garbage collecting to the pointer.
HelloWorldC() {
t = new CSharpHelloWorld(); // Assign the reference a new instance of the object
}
// This inline function is called from the C++ Code
void callCSharpHelloWorld() {
t->displayHelloWorld();
}
};
thanks in advance
|
|
|
|
|
Mmmm, what about if you ask in the correct forum? Maybe you get a better answer.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Which should I use to delete the instance of class CLadder? OPTION1 or OPTION2? Or something else? CLadder is a dialog class.
//OPTION 1
CLadder* pLD;
pLD = new CLadder:
...
...
...
delete pLD;
//OPTION 2
CLadder* pLD;
pLD = new CLadder:
...
...
...
pLD->DestroyWindow();
|
|
|
|
|
DestroyWindow before delete it.
|
|
|
|
|
It's my understanding that DestroyWindow really just destroy's the HWND (releases the window handle).
The window object should still be intact.
It's very handy to step into that code with the debugger.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
DestroyWindow is the counterpart to Create and is about the windows-window, the thing you see on screen.
delete is the counterpart of new and is about C++ classes and memory management.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hi all,
I want to create a data connection in my MFC application, as follows
ADODB::_ConnectionPtr pConn;
Import the dll,
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \<br />
no_namespace \<br />
rename( "EOF", "adoEOF" )
in the stdafx.h header file. But it gives the compile error,
'ADODB' : is not a class or namespace name
Can you tell me why is that. I do the same thing on my early projects and work fine. I can't find where I'm going wrong.
I appreciate your help all the time...
Eranga
|
|
|
|
|
|
Thanks,
actually I do it in much more this way.
HRESULT hr;<br />
ADODB::_ConnectionPtr connection;<br />
hr = connection.CreateInstance(__uuidof(ADODB::Connection));
But still got the same error.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hi all,
I want to pass parameter from one exe to another using ShellExecute (parameter is a CString variable). Can anybody please tell me how to pass the parameter through ShellExecute and how to recieve this parameter in second exe file(i.e the file we are opening through ShellExecute)
Thanks in advance
|
|
|
|
|
You can pass the null terminated string using lpParameters parameter of ShellExecute function. The destination EXE should process the command line arguments using GetCommandLine and CommandLineToArgvW functions. Please check MSDN for more information.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
CString is an MFC class. What is the executable that you're trying to run built with? Will it be able to understand a CString?
Last modified: 11mins after originally posted --
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
Both the applications are mfc dialog based application
in first application i have passed parameter through ShellExecute like this:
CString index_File = "C:\\Documents and Settings\\Mayank\\My Documents\\ppnam\\Debug\\ppnam.exe";
CString pass_val = "neha";
ShellExecute(NULL,"open",index_File,pass_val,NULL,SW_SHOW);
<\pre>
and in second application i have done this
<pre>
LPSTR wtr = GetCommandLine();
AfxMessageBox(wtr);
it gives output as
"C:\\Documents and Settings\\Mayank\\My Documents\\ppnam\\Debug\\ppnam.exe"neha
but i want only passed value....How to get it???
|
|
|
|
|
Instead of GetCommandLine() , try the following:
AfxMessageBox(m_lpCmdLine);
|
|
|
|
|
Its giving this error:
error C2065: 'm_lpCmdLine' : undeclared identifier
|
|
|
|
|
It is a CWinAapp member. You must put that message box in your InitInstance() , where it has meaning. ( ...NOT in InitDialog() )
BOOL CTestestApp::InitInstance()
{
AfxMessageBox(m_lpCmdLine);
}
|
|
|
|
|
i have done this...
but my application is not printing anything.....
|
|
|
|
|
Tried a message box in the InitInstance()? It doesn't display anything? Show me the relevant code, in both executables.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
Calling exe
void CShellexeDlg::OnButton1()
{
CDialog::OnOK();
CString index_File = "C:\\Documents and Settings\\Mayank\\My Documents\\ppnam\\Debug\\ppnam.exe";
CString pass_val = "neha";
ShellExecute(NULL,"open",index_File,pass_val,NULL,SW_SHOW);
}
<\pre>
Called Exe :
a) On InitInstance
BOOL CPpnamApp::InitInstance()
{
AfxEnableControlContainer();
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
CPpnamDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
AfxMessageBox(m_lpCmdLine);
return FALSE;
}
<\pre>
b) On InitDialog:
BOOL CPpnamDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
LPSTR wtr = GetCommandLine();
return TRUE;
}
<\pre>
|
|
|
|
|
GOT IT....
I was placing message box at wrong position.....
can you tell me if i want to pass more then one parameter then what should i do....
|
|
|
|
|
Passing more than one parameter should be easy. Parsing more than one parameter would involve some work.
But there are already good command line parsing classes available at CP, which you could use in your app. Search CP for Command Line Parser.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
Calling Executable:
void CShellexeDlg::OnButton1()
{
CString index_File = "C:\\Documents and Settings\\Mayank\\My Documents\\ppnam\\Debug\\ppnam.exe";
CString pass_val = "neha";
ShellExecute(NULL,"open",index_File,pass_val,NULL,SW_SHOW);
CDialog::OnOK();
}
Called Executable:
BOOL CPpnamApp::InitInstance()
{
AfxEnableControlContainer();
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
AfxMessageBox(m_lpCmdLine);
CPpnamDlg dlg;
m_pMainWnd = &dlg;
}
Also, remove calls to GetCommandLine() from your OnInitDialog() and else where.
|
|
|
|
|