|
Sorry, couldn't tell how much you knew from the initial question. If you're compiling the code with any Microsoft tool, it assumes the x86 class of processors unless otherwise specified. I'm going to assume you're not asking about the define for x86 compilation but rather the define for regular desktop windows compilation versus mobile compilation. It's been a while, but last time I had a GUI that was written to compile under both VS for regular desktop and eVC for handheld (same source code files with a unique solution / workspace for each IDE), I used the handheld desktop define as the key for both situations. Stuff that was handheld only was #ifdef <handheld define> and desktop only stuff was #ifndef <handheld define> .
My memory may be faulty, but you could also try _WIN32 versus _WIN32_WINCE. I don't have eVC loaded to see if the _WIN32_WINCE is defined for all the different system selections.
Hope this answers your question, since I'm not sure exactly what you need.
Judy
|
|
|
|
|
When we inherit a class from another, as protected what happens how the protected and public members will be derived into this class.
KIRAN PINJARLA
|
|
|
|
|
see here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thank you.
KIRAN PINJARLA
|
|
|
|
|
Is it possible to learn MFC without learning or without going through Win32.
|
|
|
|
|
IMHO
MFC is a library that allow you to do a lot of things, but not all of them, yes, you can use MFC, but soon you'll be using win32 instructions and, who knows ATL or any other library that would allow you to do different things that you'll need...
hope this helps.
|
|
|
|
|
SumitMandal wrote: Is it possible to learn MFC without learning or without going through Win32
You will either pick up a lot of Win32 in the process or not learn MFC at all.
MFC ist for the most part just a C++ layer around the Win32-C API.
Failure is not an option - it's built right in.
|
|
|
|
|
Mostly likely learning C++ without going through C.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
MFC is nothing but the C++ wraper classes written over WIN 32. For example in SDK we have HWND , here in MFC we have a class CWnd . There are ready made classes and macros available for you.
Regards,
Paresh.
|
|
|
|
|
Yes.
BUT you will have to stay within the constraints of MFC structure and limitations.
if you want to do UI things that are not directly supported by MFC, then you will have to learn a little bit of Win32.
|
|
|
|
|
SumitMandal wrote: Is it possible to learn MFC without learning or without going through Win32.
Yes but IMO only if you never want to write your own code.
If you will only be using copied code you'd be ok.
In other words, you need to understand Windows programming to understand what MFC is doing.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I need to call ActiveX function from a thread so while it elaborate my app can go on.
I made my CMyThread class derived from CWinThread class, in which I and create the thread in my app when I need to call the ActiveX functions.
I have some problem:
1. In code when I need to create the Thread attach this code:
CMyThread * thread = AfxBeginThread(RUNTIME_CLASS(C4Thread));
but at compile-time it said "It's impossible to convert from 'CWinThread *' to 'CMyThread *'.
WHY this?
2. In which method of my CMyThread class I must put the code to peform (the call to the ActiveX functions) or I need to implement a new function? In thi case how?
Thanks a lot.
|
|
|
|
|
A little out of context: see this thread[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
For starters, you need something like this...
CSomeThread* pThread=(CsomeThread*)AfxBeginThread(RUNTIME_CLASS(CSomeThread));
it's much more advisable to start the thread suspended so you can prep the thread before it takes off to do work...
pThread=(CSomeThread*)AfxBeginThread(RUNTIME_CLASS(CSomeThread),
THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
// Set up the thread members (if any)
// Then call resume thread to let it loose
pThread->ResumeThread();
However, you have a slight issue with what you are trying to do. As far as I know, most ActiveX controls (if not all) expect to have a parent container so they can feed off of it's ambient properties. There are many different types of COM objects and some aren't designed to need a container. If your COM object is indeed an ActiveX control, it will likely need some sort of container to appease it. If I need to get the functionality of an ActiveX control but don't necessarily want it to show itself, I create a dummy container for it...
// Need a parent container window to host the ActiveX control.
// Make it invisible and popup
CWnd wndInvisible;
CString sWndClass=AfxRegisterWndClass(0);
if (wnd.CreateEx(0,sWndClass,NULL,WS_POPUP,CRect(),NULL,0)) {
// Use the dummy CWnd as a container for the control
}
|
|
|
|
|
Sorry, I want to say that I try your second solution...
I don't have access to the source code for the ActiveX, so I try the UI-Thread.
I try to explain my problem: on my thread I must fill a grid control (the ActiveX) and while this i need to refresh a progress bar.
This is the code I use:
Start the thread in which I'll fill the grid
C4ThrGrid * thread = (C4ThrGrid *)AfxBeginThread(RUNTIME_CLASS(C4ThrGrid));
Call the thread's function that fill the grid
thread->openGrid(&m_wndGrid,str,m_inUseSource);
Close the thread is it right
thread->PostThreadMessage(WM_QUIT, 0, 0);
Is it the right way to obtain what I need?
Why at runtime when I create the thread appear a message box that said "Insufficent Memory"
Help!!!!
|
|
|
|
|
Wow, that was the exact same post, word for word, that you posted as a reply to Roger Stoltz yesterday Your response from yesterday[^]
I see Mr. Stoltz has summed it all up by basically saying you may want to further investigate COM and threads before you go any further with this.
I am starting to feel this way myself. Maybe give those topics some more research and it may seem easier the second time around.
I hope that helps.
|
|
|
|
|
Hi
All
i can change font of menu item but the font of Top menu items like File,Edit,Help etc is unchanged.So how can i do this.Is there any specific way to change font of top menu.
Thanks and Regards
Atool
|
|
|
|
|
I think you aksed this question yesterday.
|
|
|
|
|
well I have build entire application but some where I got failure to encode the file.
can any body help me?
The application working nice for the console application.
but failure for window.
when I run the application first time it can made the converted file but no data.
and when I click button "Encode File" second time. no result i havent got the file.
welcome for look at code.
its simple one function.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
What kind of encoding are you using ? Could you please share your code ?
Regards,
Paresh.
|
|
|
|
|
Encoding from any format to wmv/wma by encoder sdk by c++
please check the link
http://www.codeproject.com/Purgatory/ConvertVideoFileFormats.asp[^]
this in c# while i am in vc++
pEncoder->PrepareToEncode-failed most time
HRESULT Encoder :: convertintowma_wmv(WCHAR *source,WCHAR * destionation,WCHAR * w_encoderprofile,BOOL b_MultiPass,UINT top ,UINT bottom ,UINT left,UINT right,HACCEL hAccelTable)
{
HRESULT hr;
IWMEncoder* pEncoder;
IWMEncSourceGroupCollection* pSrcGrpColl=NULL;
IWMEncSourceGroup* pSrcGrp=NULL;
IWMEncSource* pSrc=NULL;
IWMEncSource* pSrcAud=NULL;
IWMEncVideoSource* pSrcVid=NULL;
IWMEncProfileCollection* pProColl=NULL;
IWMEncProfile* pPro=NULL;
IWMEncFile* pFile=NULL;
IWMEncAttributes* pAttr=NULL;
IWMEncDisplayInfo* pDispInfo=NULL;
CComBSTR bstrName = NULL;
CComVariant varIndex;
CCallBack EventSink;
WMENC_ENCODER_STATE enumCurState;
WMENC_ENCODER_STATE enumPrvState;
short iAudCount, iVidCount;
long lCount=0;
int i=0;
hr = CoInitialize(NULL);
if ( SUCCEEDED( hr ) )
{
hr = CoCreateInstance(CLSID_WMEncoder,
NULL,
CLSCTX_INPROC_SERVER,
IID_IWMEncoder,
(void**) &pEncoder);
}else
{
MessageBox(0,L"FAIL CREATE instance",L"FAIL CREATE instance",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->get_SourceGroupCollection(&pSrcGrpColl);
}else
{
MessageBox(0,L"pEncoder->get_SourceGroupCollection Fail",L"get_SourceGroupCollection",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pSrcGrpColl->Add(CComBSTR("SG_1"), &pSrcGrp);
}
else
{
MessageBox(0,L"pSrcGrpColl->Add",L"pSrcGrpColl->Add",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pSrcGrp->AddSource(WMENC_AUDIO, &pSrcAud);
}else
{
MessageBox(0,L"pSrcGrp->AddSource",L"pSrcGrp->AddSource",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pSrcGrp->AddSource(WMENC_VIDEO, &pSrc);
}else
{
MessageBox(0,L"pSrcGrp->AddSource(WMENC_VIDEO",L"pSrcGrp->AddSource(WMENC_VIDEO",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pSrc->QueryInterface(IID_IWMEncVideoSource, (void**)&pSrcVid);
}else
{
MessageBox(0,L"pSrc->QueryInterface",L"pSrc->QueryInterface",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pSrcAud->SetInput(source);
}else
{
MessageBox(0,L"pSrcAud->SetInput",L"pSrcAud->SetInput",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pSrcVid->SetInput(source);
}else
{
MessageBox(0,L"pSrcVid->SetInput(source);",L"pSrcVid->SetInput(source);",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->get_DisplayInfo(&pDispInfo);
}else
{
MessageBox(0,L"pEncoder->get_DisplayInfo",L"pEncoder->get_DisplayInfo",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pDispInfo->put_Author(CComBSTR("Author Name"));
}else
{
MessageBox(0,L"pDispInfo->put_Author",L"pDispInfo->put_Author",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pDispInfo->put_Copyright(CComBSTR("Copyright"));
}else
{
MessageBox(0,L"pDispInfo->put_Copyright",L"pDispInfo->put_Copyright",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pDispInfo->put_Description(CComBSTR("A description"));
}else
{
MessageBox(0,L"pDispInfo->put_Description",L"pDispInfo->put_Description",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pDispInfo->put_Rating(CComBSTR("Rating"));
}else
{
MessageBox(0,L"pDispInfo->put_Rating",L"pDispInfo->put_Rating",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pDispInfo->put_Title(CComBSTR("The Title"));
}else
{
MessageBox(0,L"pDispInfo->put_Title",L"pDispInfo->put_Title",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->get_Attributes(&pAttr);
}else
{
MessageBox(0,L"source group",L"source group ",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pAttr->Add(CComBSTR("URL"), CComVariant("IP Address"));
}else
{
MessageBox(0,L"pAttr->Add",L"pAttr->Add",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->get_File(&pFile);
}else
{
MessageBox(0,L"pEncoder->get_File",L"pEncoder->get_File",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pFile->put_LocalFileName(destionation);
}else
{
MessageBox(0,L"pFile->put_LocalFileName",L"pFile->put_LocalFileName",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->get_ProfileCollection(&pProColl);
}else
{
MessageBox(0,L"pEncoder->get_ProfileCollection",L"pEncoder->get_ProfileCollection",0);
}
if ( SUCCEEDED( hr ) )
{
hr = pProColl->get_Count(&lCount);
}else
{
MessageBox(0,L"pProColl->get_Count",L"pProColl->get_Count",0);
}
for (i=0; i<lCount; i++)
{
if ( SUCCEEDED( hr ) )
{
hr = pProColl->Item(i, &pPro);
}
if ( SUCCEEDED( hr ) )
{
hr = pPro->get_Name(&bstrName);
}
if (_wcsicmp(bstrName,w_encoderprofile)==0)
{
if ( SUCCEEDED( hr ) )
{
hr = pSrcGrp->put_Profile(CComVariant(pPro));
}else
{
MessageBox(0,L"pSrcGrp->put_Profile(CComVariant(pPro)",L"source group ",0);
}
break;
}
}
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->PrepareToEncode(VARIANT_FALSE);
}else
{
MessageBox(0,L"pEncoder->PrepareToEncode",L"pEncoder->PrepareToEncode",0);
}
<code>if ( SUCCEEDED( hr ) )
{
hr = pEncoder->PrepareToEncode(VARIANT_TRUE);
}else
{
MessageBox(0,L"PrepareToEncode fail",L"PrepareToEncode fail",0);
}</code> if ( SUCCEEDED( hr ) )
{
hr = pEncoder->Start();
if ( SUCCEEDED( hr ) )
{
bool glbboolStartNext=false;
bool b_forfirsttime=false;
MSG msg;
while(!glbboolStartNext)
{
while(PeekMessage(&msg,NULL,NULL,NULL,PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if(b_forfirsttime)
{
enumPrvState = enumCurState;
}
b_forfirsttime=true;
enumCurState = EventSink.State();
if( EventSink.SrcState() == WMENC_SOURCE_STOP )
enumCurState = WMENC_ENCODER_STOPPED;
{
switch ( enumCurState )
{
case WMENC_ENCODER_STARTING:
break;
case WMENC_ENCODER_RUNNING:
break;
case WMENC_ENCODER_PAUSING:
break;
case WMENC_ENCODER_PAUSED:
break;
case WMENC_ENCODER_STOPPING:
break;
case WMENC_ENCODER_STOPPED:
glbboolStartNext=true;
goto EXIT;
case WMENC_ENCODER_END_PREPROCESS:
break;
}
}
}
EXIT:
hr = pEncoder->Stop();
hr = EventSink.Shutdown( pEncoder );
}
}
varIndex.vt = VT_I2;
if ( SUCCEEDED( hr ) )
{
hr = pSrcGrpColl->get_Count(&lCount);
}
for (i=0; i<lCount; i++)
{
varIndex.iVal = i;
hr = pSrcGrpColl->Remove(varIndex);
}
{
hr = pSrcGrp->get_SourceCount(WMENC_AUDIO, &iAudCount);
}
{
hr = pSrcGrp->get_SourceCount(WMENC_VIDEO, &iVidCount);
}
varIndex.vt = VT_I2;
varIndex.iVal = 0;
if (iVidCount != 0)
{
{
hr = pSrcGrp->RemoveSource(WMENC_VIDEO, varIndex);
}
}
if(iAudCount!=0)
{
hr = pSrcGrp->RemoveSource(WMENC_AUDIO, varIndex);
}
{
hr = pEncoder->PrepareToEncode(VARIANT_FALSE);
}
if ( pSrcGrpColl )
{
pSrcGrpColl->Release();
pSrcGrpColl = NULL;
}
if ( pSrcGrp )
{
pSrcGrp->Release();
pSrcGrp = NULL;
}
if ( pProColl )
{
pProColl->Release();
pProColl = NULL;
}
if ( pPro )
{
pPro->Release();
pPro = NULL;
}
if ( pFile )
{
pFile->Release();
pFile = NULL;
}
if ( pSrcAud )
{
pSrcAud->Release();
pSrcAud = NULL;
}
if ( pSrcVid )
{
pSrcVid->Release();
pSrcVid = NULL;
}
if ( pSrc )
{
pSrc->Release();
pSrc = NULL;
}
if ( pAttr )
{
pAttr->Release();
pAttr = NULL;
}
if ( pDispInfo )
{
pDispInfo->Release();
pDispInfo = NULL;
}
if ( pEncoder )
{
pEncoder->Release();
pEncoder = NULL;
}
CoUninitialize();
return(hr);
}
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Have you stepped through the entire function in the debugger to make sure all preceding calls
were successful?
I can't tell entirely what's going on because of indentation, but is PrepareToEncode(VARIANT_FALSE)
being called before PrepareToEncode(VARIANT_TRUE)? If so, that seems odd to me.
When IWMEncoder::PrepareToEncode() fails, you can use the IErrorInfo interface to get a
description of the error:
#include <atlbase.h>
#include <atlcomcli.h>
...
hr = pEncoder->PrepareToEncode(VARIANT_TRUE);
if (FAILED(hr)
{
CComPtr<IErrorInfo> pEO;
if(S_OK == GetErrorInfo(NULL, &pEO))
{
CComBSTR bstrDesc;
pEO->GetDescription(&bstrDesc); <code>
}
}
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Dear Mark.
Thank you very much for your help and I appreciate that, but what are the basic reasons for
unproperwork (pEncoder->PrepareToEncode(VARIANT_TRUE); ) of this function because you know some time its working properly even when the exe is running on my desktop after few seconds its working fine and after few second when i trying to encode its again gone fail.
Some time working nice and some time failure.
When I debug I got E_UNEXCEPTED at failture time . I have try to check this error with encoder sdk help but no fruitful result
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Most of the code you posted looks like it's taken directly from the "Encoding a File (C++)"
example in the WME SDK.
Calling PrepareToEncode(VARIANT_FALSE) ENDS an encoding session so it makes no sense that the
call is in your code (it's not in the example code).
Maybe compare your code to the sample code in the SDK and see what you are doing differently.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: Calling PrepareToEncode(VARIANT_FALSE) ENDS an encoding session so it makes no sense that the
call is in your code (it's not in the example code).
I have wrote that thing becoz of suppose in any case if any old file havent stop then prior it can stop and reset for new one.
I have check it without writing this code but it was given the same error.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|