|
|
Hi,
I tried to use FormatMessage API to format variable argument that passed to a fuction, but it only delete all '%' characater with no thing else!
please help me.
my code :
void CEllepsisDlg::Log(CString x,...)
{
CString strTempInput;
strTempInput = x;
va_list marker;
va_start( marker, x );
LPTSTR lpFprmatedMessage;
va_start( marker, x );
strTempInput=x;
FormatMessage(FORMAT_MESSAGE_FROM_STRING,
LPCSTR(strTempInput),
NULL,
NULL,
(LPTSTR) &lpFprmatedMessage,
2048,
&marker);
char * tt=(char*)&lpFprmatedMessage;
va_end( marker );
}
|
|
|
|
|
Well looking at your code I think you got the params for FormatMessage slightly wrong. Try changing it to
void CEllepsisDlg::Log(CString x,...)
{
TCHAR fprmatedMessage[2048];
va_list marker;
va_start( marker, x );
FormatMessage(FORMAT_MESSAGE_FROM_STRING, (LPCVOID)((LPCTSTR)x), NULL, NULL,
fprmatedMessage, sizeof(fprmatedMessage), marker);
va_end( marker );
} I havn't tested it, but I think that might work better.
[EDIT]Be aware that in this new scheme that i've created, nothing happens to fprmatedMessage when FormatMessage has finished. Make sure you copy the string into a CString before using outside the Log function, otherwise your program will crash. e.g.
CString myresult = fprmatedMessage; If you only want to use it within the function, then you can use fprmatedMessage just like any LPTSTR.[/EDIT]
Hope this helps.
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
Hi,
I used to see a drop down in my visual studio editor(using vc++) which would list out all the classes in the file and the second dropdown would have the listings of all the methods.
While doing something, those two dropdowns have gone missing, can anybody help me to browse the menu options and add them back into my visual studio.
Thanks,
|
|
|
|
|
you can either right click on the toolbars and select the right menu, or click on the view menu item and select wat you need...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I tried almost all options but was unable to find it!
|
|
|
|
|
are you using visual C++ 6 or .NET 2003 ?
if you're using VS.NET, you will find those comboboxes heading the source files (when you open one...).
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
so, open your source file, and you'll see those ComboBoxes upon the code...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
Might sound quite silly, but I am not able to see the wizard bar. Looked at the customize option to see whether its missing, but could'nt really find it.
THanks,
|
|
|
|
|
|
The Wizard Bar is only available in VS6.
Since you are using the .NET studio, you can activate the drop down combos by :
Tools->Options->Text Editor->C/C++->Navigation Bar
I Dream of Absolute Zero
|
|
|
|
|
I found that the navigation bar option is checked. Relaunched the visual studio but not able to see the combos.
|
|
|
|
|
uncheck the checkbox, quit, then recheck it...
if not, reinstall Visual Studio
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi guys,
I'm kinda new in directx programming and i have to write a application that detects the video info: like video codec, audio bitrate and number of channels, and i have no ideea where to start.
Any hints / code / links would be great.
Thanks.
|
|
|
|
|
Hi
Can anyone please tell me how do i record sound using Directx's DirectSound..
At present i am recording sound (waveforms) using MCI.
thanx
pallavi.
|
|
|
|
|
|
Hi,
I have this project. It is an installer with the following requirments:
1. Enumerate COM Ports and prompt the user to select one to use for a modem.
2. Then programatically install the modem on the COM port selected from either a unimodem .inf file or a Nokia 2285 .inf file without any intervention again.
I need your assistance (even if commercial in nature) to accomplsh this in C/C++ or VB.
Best regards.
Tope Akinniyi
topeakinniyi@yahoo.co.uk
|
|
|
|
|
Hi all,
I am developing a Win32 Console application that reads XML file and displays the data. I am importing msxml4.dll and then usiing the following code to create the instance of the DomDocument class
HRESULT hr;
IXMLDOMDocumentPtr pDocument = NULL;
IXMLDOMParseErrorPtr pParseError = NULL;
BSTR bstr = NULL;
VARIANT_BOOL status = NULL;
VARIANT vsrc;
CoInitialize(NULL);
hr = CoCreateInstance(CLSID_XMLDocument,NULL,_ CLSCTX_INPROC_SERVER,IID_IXMLDocument,(void**)&pDocument);
VariantInit(&vsrc);
V_BSTR(&vsrc) = SysAllocString(L"try.xml");
V_VT(&vsrc) = VT_BSTR;
hr = pDocument->load(vsrc,&status);
hr = pDocument->Getxml(&bstr);
cout << "Try.xml comtents: " << bstr;
if(bstr)
SysFreeString(bstr);
if(&vsrc)
VariantClear(&vsrc);
if(pParseError)
pParseError->Release();
if(pDocument)
pDocument->Release();
CoUninitialize();
when I compiled the program it gives error
'Getxml' : is not a member of 'IXMLDOMDocument'
when I run the application without calling getXML function it gives me run time error that unhandled exception in the application.exe 0xC0000005: Access Violation.
Can anyone tell me where I am wrong.
I ahve the following files in system folder
msxml2.dll,msxml2r.dll,msxml3a.dll,msxml3.dll.msxml3r.dll.msxml4.dll,msxml4r.dll.msxmlr.dll
One point where I suspect error could be as to crete instance using CLSID_DOMDocument40, IXMLDOMDocument4 but in my project it gives me error when I call the CoCreateInstance with the above mentioned parameters.
Thanks in advance.
Ritu Kwatra
|
|
|
|
|
Instead of GetXml() simply use IXmlDomDocument::xml variable. it is BSTR variable which contain whole XML file which is currently loaded in interface.
Anyway from where you got this example Code!
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
|
Here is small example,hope that's work for you.
MSXML2::IXMLDOMDocument *l_pXMLDomDocument;
MSXML2::IXMLDOMElement *l_XMLDomElemnent;
MSXML2::IXMLDOMNode *l_XMLDomFirstNode,*l_XMLDomNextNode;
CLSID clsidXMLDom;
::CLSIDFromProgID(OLESTR"msxml2.domdocument"),&clsidXMLDom);
if(SUCCEEDED(CoCreateInstance(clsidXMLDom,NULL,CLSCTX_ALL,IID_IXMLDOMDocument,reinterpret_cast<LPVOID*>(&l_pXMLDomDocument))))
{
MessageBox("Object Creation successful");
}
CString strXml="<xml><cp>helloo</cp></xml>";
l_pXMLDomDocument->loadXml(_variant_t(strXml.AllocSysString()));
MessageBoxW(NULL,l_pXMLDomDocument->xml,L"XML",MB_OK);
l_pXMLDomDocument->get_firstChild(&l_XMLDomFirstNode);
MessageBoxW(NULL,l_XMLDomFirstNode->GetnodeName(),L"",MB_OK);
l_XMLDomFirstNode->get_firstChild(&l_XMLDomNextNode);
CString str;
while(l_XMLDomNextNode)
{
MessageBoxW(NULL,l_XMLDomNextNode->GetnodeName(),L"",MB_OKCANCEL);
l_XMLDomNextNode->get_firstChild(&l_XMLDomFirstNode);
while(l_XMLDomFirstNode)
{
MessageBoxW(NULL,l_XMLDomFirstNode->GetnodeName(),l_XMLDomFirstNode->GetnodeValue().bstrVal,MB_OK);
l_XMLDomFirstNode->get_nextSibling(&l_XMLDomFirstNode);
}
if(l_XMLDomNextNode->get_nextSibling(&l_XMLDomNextNode)==S_FALSE)
l_XMLDomNextNode=NULL;
}
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
Hi Alok,
Error in the CoCreateInstance is still the same. Error is
D:\Ritu\VC++\Win32XML\xmlsource.cpp(20) : error C2065: 'IID_IXMLDOMDocument' : undeclared identifier
Ritu Kwatra
|
|
|
|
|
Hi Alok,
The type of errors are still same. Errors are:
error C2039: 'loadXml' : is not a member of 'IXMLDOMDocument'
error C2039: 'xml' : is not a member of 'IXMLDOMDocument'
error C2039: 'GetnodeName' : is not a member of 'IXMLDOMNode'
error C2039: 'GetnodeName' : is not a member of 'IXMLDOMNode'
error C2039: 'GetnodeValue' : is not a member of 'IXMLDOMNode'
Ritu Kwatra
|
|
|
|