|
George_George wrote: (wchar_t*)L"FOO"
Because the above is a cast operator plus a string literal , not a string literal alone.
BTW you don't need the cast operator at all:
#define PREFIX(x) _TEXT("GOO_") x
int main (int argc, char** argv)
{
static wchar_t* p[1] = {PREFIX(_TEXT("FOO"))};
return 0;
}
compiles fine.
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.
|
|
|
|
|
Thanks CPallini,
My question is answered.
regards,
George
|
|
|
|
|
Then please put [solved] in the start message So future people looking for something similiar can quickly know that there is a solution in this thread.
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
|
|
|
|
|
Hi Experts,
I have written a function that display the Html Content in HtmlView, this code is working fine on all the OS except Vista .This is working for some strings but does not work for some other string.And gives a unhandled exception.
I describe with code where the function throw exception.
void CDisplayBody::NavigateText(CString pszText)<br />
{<br />
try<br />
{<br />
if (!m_bHasDocument)
{<br />
Navigate(_T("about:blank"));
return;<br />
}<br />
<br />
<br />
if (GetBusy())
Stop(); <br />
<br />
IDispatch * pDisp = GetHtmlDocument();<br />
if (!pDisp)<br />
return;<br />
<br />
IHTMLDocument2* pDoc;<br />
if (SUCCEEDED(pDisp->QueryInterface( IID_IHTMLDocument2, (void**)&pDoc )))<br />
{<br />
CComBSTR bstrURL;<br />
CComVariant varDummy;<br />
pDoc->open(bstrURL, varDummy, varDummy, varDummy, NULL);<br />
<br />
SAFEARRAY *pSA;<br />
SAFEARRAYBOUND saBound = {1, 0};<br />
pSA = SafeArrayCreate(VT_VARIANT, 1, &saBound);<br />
<br />
VARIANT *pVar;<br />
CComBSTR bstrHTML = pszText;
varDummy = bstrHTML;
<br />
SafeArrayAccessData(pSA, (void**)&pVar);
pVar[0] = varDummy;
SafeArrayUnaccessData(pSA);
<br />
pDoc->write(pSA);
pDoc->close();
<br />
SafeArrayDestroy(pSA);
pDoc->Release();
}<br />
<br />
<br />
pDisp->Release();<br />
pDisp=NULL;<br />
}<br />
catch (...)<br />
{<br />
AfxMessageBox(_T("CDisplayBody::NavigateText"));<br />
}<br />
}
As the fuction comes out the last if statement scope , it throw a exception.
Could you help me to resolve it or handle this error.
|
|
|
|
|
Hi,
I am using _snprintf_s instead of _snprintf to supress VS8 warnings. The app runs in Windows Embedded XP. Though I dont see any problems( No crashes)during run, I want to know if it is wise to use _snprintf_s in Embedded XP. Please kindly suggest any alternatives that can be considered.
Thanks in Advance.
Thanks & Regards,
Dhana
|
|
|
|
|
jana_dhana wrote: I want to know if it is wise to use _snprintf_s in Embedded XP
Given that the creator of your image has to include the C Runtime Library in order to give you support for any of the printf class of functions, embedded XP is the same as XP with respect to the CRT. If you'd use the _s functions in XP, use them in XPe.
Judy
|
|
|
|
|
Hi everybody,
just asking how am i going to go through codec (h264)... i wanted to capture live video from web camera and transmits this data over the internet... how am i going to connect the codec (h264) for encoding and decoding live video frames...dont know what to do with the source code for codec (h264)...i mean connecting the codec to my main source code..? ... please help me....
thank you,
reno
|
|
|
|
|
This is really a vague question.
What part are you having trouble with?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark,
i am planning to use COM interfaces... i know the basic on graph editplus i can see that i can capture live video from my camera... by the way in graph edit plus i can generate code but dont know how to handle them in my code?
thanks for your immediate reply....
reno
|
|
|
|
|
So you're using DirectShow, right?
If so, is your h264 codec already in a directshow filter or do you need to
somehow get video frames from a DirectShow stream into the codec?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark,
So you're using DirectShow, right?
- yes, i am
If so, is your h264 codec already in a directshow filter or do you need to
somehow get video frames from a DirectShow stream into the codec?
- yes, i ned to get video frames from directshow stream into my codec, in the outcome my directshow diagram would be like this:
-->Analog Video in Capture>------>XvidMPEG4 CODEC>--->XvidMPEG4 decoder>----->Renderer
preview>------>Renderer 0001
(hope u can picture out the directshow graph i cannot copy and paste the diagram...or even attach it here...)
and the code for this is:
<code>
//Don't forget to change project settings:
//1. C++: add include path to DirectShow include folder (such as c:\dxsdk\include)
//2. Link: add link path to DirectShow lib folder (such as c:\dxsdk\lib).
//3. Link: add strmiids.lib and quartz.lib
#include "stdafx.h"
#include <DShow.h>
#include <atlbase.h>
#include <initguid.h>
BOOL hrcheck(HRESULT hr, TCHAR* errtext)
{
if (hr >= S_OK)
return FALSE;
TCHAR szErr[MAX_ERROR_TEXT_LEN];
DWORD res = AMGetErrorText(hr, szErr, MAX_ERROR_TEXT_LEN);
if (res)
printf("Error %x: %s\n%s\n",hr, errtext,szErr);
else
printf("Error %x: %s\n", hr, errtext);
return TRUE;
}
//change this macro to fit your style of error handling
#define CHECK_HR(hr, msg) if (hrcheck(hr, msg)) return hr;
CComPtr<IBaseFilter> CreateFilter(WCHAR* displayName)
{
IBindCtx *pBindCtx;
HRESULT hr = CreateBindCtx(0, &pBindCtx);
if (hrcheck(hr, "Can't create bind context"))
return NULL;
ULONG chEaten = 0;
IMoniker *pMoniker = 0;
hr = MkParseDisplayName(pBindCtx, displayName, &chEaten, &pMoniker);
pBindCtx->Release();
if (hrcheck(hr, "Can't create parse display name of the filter"))
return NULL;
IBaseFilter *pFilter = NULL;
if (SUCCEEDED(hr))
{
hr = pMoniker->BindToObject(pBindCtx, NULL, IID_IBaseFilter, (void**)&pFilter);
pMoniker->Release();
if (hrcheck(hr, "Can't bind moniker to filter object"))
return NULL;
}
return CComPtr<IBaseFilter>(pFilter);
}
// {B87BEB7B-8D29-423F-AE4D-6582C10175AC}
DEFINE_GUID(CLSID_VideoRenderer,
0xB87BEB7B, 0x8D29, 0x423F, 0xAE, 0x4D, 0x65, 0x82, 0xC1, 0x01, 0x75, 0xAC); //quartz.dll
// {17CCA71B-ECD7-11D0-B908-00A0C9223196}
DEFINE_GUID(CLSID_Conexant2388xVideoCapture,
0x17CCA71B, 0xECD7, 0x11D0, 0xB9, 0x08, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96); //ksproxy.ax
// {64697678-0000-0010-8000-00AA00389B71}
DEFINE_GUID(CLSID_XvidMPEG4VideoDecoder,
0x64697678, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); //xvid.ax
HRESULT BuildGraph(IGraphBuilder *pGraph)
{
HRESULT hr = S_OK;
//graph builder
CComPtr<ICaptureGraphBuilder2> pBuilder;
hr = pBuilder.CoCreateInstance(CLSID_CaptureGraphBuilder2);
CHECK_HR(hr, "Can't create Capture Graph Builder");
hr = pBuilder->SetFiltergraph(pGraph);
CHECK_HR(hr, "Can't SetFiltergraph");
//add Video Renderer
CComPtr<IBaseFilter> pVideoRenderer;
hr = pVideoRenderer.CoCreateInstance(CLSID_VideoRenderer);
CHECK_HR(hr, "Can't create Video Renderer");
hr = pGraph->AddFilter(pVideoRenderer, L"Video Renderer");
CHECK_HR(hr, "Can't add Video Renderer to graph");
//add Conexant 2388x Video Capture
CComPtr<IBaseFilter> pConexant2388xVideoCapture;
hr = pConexant2388xVideoCapture.CoCreateInstance(CLSID_Conexant2388xVideoCapture);
CHECK_HR(hr, "Can't create Conexant 2388x Video Capture");
hr = pGraph->AddFilter(pConexant2388xVideoCapture, L"Conexant 2388x Video Capture");
CHECK_HR(hr, "Can't add Conexant 2388x Video Capture to graph");
//add Xvid MPEG-4 Video Decoder
CComPtr<IBaseFilter> pXvidMPEG4VideoDecoder;
hr = pXvidMPEG4VideoDecoder.CoCreateInstance(CLSID_XvidMPEG4VideoDecoder);
CHECK_HR(hr, "Can't create Xvid MPEG-4 Video Decoder");
hr = pGraph->AddFilter(pXvidMPEG4VideoDecoder, L"Xvid MPEG-4 Video Decoder");
CHECK_HR(hr, "Can't add Xvid MPEG-4 Video Decoder to graph");
//add Xvid MPEG-4 Codec
CComPtr<IBaseFilter> pXvidMPEG4Codec = CreateFilter(L"@device:cm:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\\xvid");
hr = pGraph->AddFilter(pXvidMPEG4Codec, L"Xvid MPEG-4 Codec");
CHECK_HR(hr, "Can't add Xvid MPEG-4 Codec to graph");
//add Video Renderer
CComPtr<IBaseFilter> pVideoRenderer2;
hr = pVideoRenderer2.CoCreateInstance(CLSID_VideoRenderer);
CHECK_HR(hr, "Can't create Video Renderer");
hr = pGraph->AddFilter(pVideoRenderer2, L"Video Renderer");
CHECK_HR(hr, "Can't add Video Renderer to graph");
//connect Conexant 2388x Video Capture and Xvid MPEG-4 Video Decoder
hr = pBuilder->RenderStream(NULL, &MEDIATYPE_Video, pConexant2388xVideoCapture, NULL, pXvidMPEG4VideoDecoder);
CHECK_HR(hr, "Can't connect Conexant 2388x Video Capture and Xvid MPEG-4 Video Decoder");
//connect Conexant 2388x Video Capture and Xvid MPEG-4 Codec
hr = pBuilder->RenderStream(NULL, &MEDIATYPE_Video, pConexant2388xVideoCapture, NULL, pXvidMPEG4Codec);
CHECK_HR(hr, "Can't connect Conexant 2388x Video Capture and Xvid MPEG-4 Codec");
//connect Xvid MPEG-4 Video Decoder and Video Renderer
hr = pBuilder->RenderStream(NULL, &MEDIATYPE_Video, pXvidMPEG4VideoDecoder, NULL, pVideoRenderer);
CHECK_HR(hr, "Can't connect Xvid MPEG-4 Video Decoder and Video Renderer");
//connect Conexant 2388x Video Capture and Video Renderer
hr = pBuilder->RenderStream(NULL, &MEDIATYPE_Video, pConexant2388xVideoCapture, NULL, pVideoRenderer2);
CHECK_HR(hr, "Can't connect Conexant 2388x Video Capture and Video Renderer");
//connect Xvid MPEG-4 Codec and Xvid MPEG-4 Video Decoder
hr = pBuilder->RenderStream(NULL, &MEDIATYPE_Video, pXvidMPEG4Codec, NULL, pXvidMPEG4VideoDecoder);
CHECK_HR(hr, "Can't connect Xvid MPEG-4 Codec and Xvid MPEG-4 Video Decoder");
return S_OK;
}
int main(int argc, char* argv[])
{
CoInitialize(NULL);
CComPtr<IGraphBuilder> graph;
graph.CoCreateInstance(CLSID_FilterGraph);
printf("Building graph...\n");
HRESULT hr = BuildGraph(graph);
if (hr==S_OK) {
printf("Running");
CComQIPtr<IMediaControl, &IID_IMediaControl> mediaControl(graph);
hr = mediaControl->Run();
CHECK_HR(hr, "Can't run the graph");
CComQIPtr<IMediaEvent, &IID_IMediaEvent> mediaEvent(graph);
BOOL stop = FALSE;
while(!stop)
{
long ev=0, p1=0, p2=0;
Sleep(500);
printf(".");
if (mediaEvent->GetEvent(&ev, &p1, &p2, 0)==S_OK)
{
if (ev == EC_COMPLETE || ev == EC_USERABORT)
{
printf("Done!\n");
stop = TRUE;
}
else
if (ev == EC_ERRORABORT)
{
printf("An error occured: HRESULT=%x\n", p1);
mediaControl->Stop();
stop = TRUE;
}
mediaEvent->FreeEventParams(ev, p1, p2);
}
}
}
CoUninitialize();
return 0;
}
</code>
now, my problem is how am i going to put this into my code in order that this will make sense, even just display this two video on my screen before transmitting this to the medium. i try this already but it didnt display, isnt it that i didnt envoke the Release(); function call? or etc....?
please suggest me or help me on how toget through with this....
thank you...
reno
|
|
|
|
|
Who knows?
CChildView::CWnd
CChildView2::CWnd
CChildView m_wndView;
CChildView2 m_wndView2;
How to switch between them dynamically? Any way?
It's very important to my program.
Thanks a lot.
|
|
|
|
|
How to compute the angle(skew) of the image in vc++???
|
|
|
|
|
????
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
|
|
|
|
|
Try:
useGoniometer(image, x_axis);
i.e. As it stands, your post is a bit meaningless.
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.
|
|
|
|
|
CPallini wrote: As it stands, your post is a bit meaningless.
actually, it's not. skew = "when you scanned that document, by how much was the paper rotated?"
|
|
|
|
|
You're guessing the image was a scanned document.
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.
|
|
|
|
|
the typical case is a scanned document. but image skew is a common term, and correcting image skew is a common problem.
|
|
|
|
|
I guess it's too late to answer, but here is a link:
http://www.codeproject.com/KB/graphics/deskewimg.aspx?artkw=deskew image
|
|
|
|
|
you'll need to find an image processing toolkit that can do a Hough Transform.
i don't know of any free ones, but i do know where you can find an inexpensive non-free one...
|
|
|
|
|
Hello,
How to initialize an unsigned char* ?
Prithaa
|
|
|
|
|
You mean something like that?
unsigned char* pTemp = NULL;
|
|
|
|
|
Hello,
I have to use unsigned char* in the following
int retcode = SQLConnect(hdbc1,"MyDSN", SQL_NTS,"sa",
SQL_NTS,"MyPassWord", SQL_NTS);
where the 2nd parameter is an unsigned char*
Now I want something like this
unsigned char* MyDSN = "MyDSN";
but the above definition gives error
so how should I initialize unsigned char*?
Prithaa
|
|
|
|
|
There is an exemple in the documentation[^] (your first reflex should be to open MSDN and read some information there).
If you look at the example, a cast is enough:
int retcode = SQLConnect(hdbc1,(SQLCHAR*)"MyDSN", SQL_NTS,(SQLCHAR*)"sa", <br />
SQL_NTS,(SQLCHAR*)"MyPassWord", SQL_NTS);<br />
|
|
|
|
|
Cedric Moonen wrote: There is an exemple in the documentation[^]
Isn't that hidden?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|