|
I guess you got errors when compile this code,right? it was better you used of pre tags for your code.;)
|
|
|
|
|
Hi
I am preparing an .asmx file that calls a c++ class using its .dll
and generates output in .xml format.But I want output in HTML format.
To ganarate HTML output I have used wsdl "useService" and "callService" functions in html file.
But when i run this from from localhost it gives error "Client Service unavailable" Can anyone tell me plz how to resolve this problem.:
I m giving my html file
//CPPWebService.html
var n = 10;
var iCallID;
var callObj;
function init1()
{
s.useService("http://localhost/MyWebServices/CPPWebService.asmx?WSDL","yyy");
var headObj = new Object();
callObj = s.createCallOptions();
callObj.async = false;
callObj.funcName = "MyMethod";
callObj.SOAPHeader = new Array();
callObj.SOAPHeader[0] = headObj;
oSPAN.innerText = "Number returned is";
iCallID = s.yyy.callService(MyResults, callObj);
MyResults(iCallID);
alert("Over");
alert(iCallID.value);
}
function MyResults(result)
{
alert(result.value);
if(result.error){
var xfaultcode = result.errorDetail.code;
var xfaultstring = result.errorDetail.string;
var xfaultsoap = result.errorDetail.raw;
oSPAN.innerText = xfaultcode + " " + xfaultstring + " " + xfaultsoap;
alert(xfaultcode +xfaultstring +xfaultsoap);
}
else{
// Show the arithmetic
oSPAN.innerText += result.value;
alert(result.value);
}
}
function aaa()
{
alert(event.result.value + ' ' + event.result.id);
}
Equation :
//CPPWebService.asmx
<%@ WebService Language="C#" Class=CPPWebService.MyService %>
it use c++ class
that is as follows
#include "stdafx.h"
#using <mscorlib.dll>
#using "System.Web.dll"
#using "System.Web.Services.dll"
using namespace System;
using namespace System::Web;
using namespace System::Web::Services;
#include "CPPWebService.h"
namespace CPPWebService
{
int MyService::MyMethod()
{
return 42;
}
};
Thax in advance
Pankaj Jain
|
|
|
|
|
Hi,
In my application i need customized menu.(i.e)i need only one menu .
So that i delete the menus already in IDR_MAINFAME like i delete help,view etc.
Thus i leave File menu as it is and delete other than that.
And i coded OnCreateClient() fucntion as
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CMenu* pMenu = NULL;
if (m_hMenuDefault == NULL)
{
pMenu = GetMenu();
ASSERT(pMenu != NULL);
int iMenu = pMenu->GetMenuItemCount() - 2;
ASSERT(iMenu <= 0);
pMenu = pMenu->GetSubMenu(iMenu);
ASSERT(pMenu == NULL);
}
return CMDIFrameWnd::OnCreateClient(lpcs, pContext);
}
But i got assertion error in CMainFrame::Oncreate().
My requirement is i need only one menu.
How can i get that.Pls help me.
Anu
|
|
|
|
|
Try after putting all your code in or after CMainFrame::Oncreate() function.
I don't know whether the function:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
is called before or after the OnCreate function. You can access the menu programmatically only after your frame window and menu has been created.
|
|
|
|
|
Try doing this
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
return CMDIFrameWnd::CreateClient(lpcs, NULL);
}
|
|
|
|
|
I tried but the same error occurs.
I changed againg by following code.It works.
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CMenu* pMenu = NULL;
return CreateClient(lpcs, pMenu);
}
Now i got it.
Anu
|
|
|
|
|
//first create the client
CMDIFrameWnd::OnCreateClient(lpcs, pContext);
//AND THEN you can delete some of its parts
CMenu* pMenu = NULL;
if (m_hMenuDefault == NULL)
{
pMenu = GetMenu();
ASSERT(pMenu != NULL);
int iMenu = pMenu->GetMenuItemCount() - 2;
ASSERT(iMenu <= 0);
pMenu = pMenu->GetSubMenu(iMenu);
ASSERT(pMenu == NULL);
}
}
Greetings from Germany
|
|
|
|
|
hi,
Is there a way to resize the mfc's dialog.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
Yes. Set the dialog border to resizable, and then handle the WM_SIZE message to do any size/position adjustments of the dialog controls. Look in the dialog section here on CP for some examples.
|
|
|
|
|
In the continue with Hans use of MoveWindow on the WM_SIZE.
|
|
|
|
|
in addiction...
you can also use the function
CWnd::SetWindowPos(...)
to move and resize every kind of windows.
Russell
|
|
|
|
|
Hi
Recommend any vanilla C++ classes which help me parses string like
"north america\canada\ontario\toronto"
Into something like:
result1.array[0] = "north america"
result1.array[1] = "canada"
...
And:
result2.parse("north america\canada\ontario");
if(result2.IsParentOf(result1))
{
...
}
else
{
...
}
that's basically management of hierachical information... sounds like an Xml DOM...
|
|
|
|
|
There are several tokenizer classes here on CP. Take a look at this one.
|
|
|
|
|
Thanks - but anything that's just ANSI vanilla C without MFC baggage? It's for use in one base project for historical in C++/WIN32 (but not MFC).
ANSI vanilla C means when time comes to upgrade it to .NET we have such option.
Thanks again
|
|
|
|
|
u could use the CRT function strtok ...
|
|
|
|
|
hi all,
please anybody help me in solving this..........
thanks in advance
swaroop
|
|
|
|
|
|
The easiest way i thinnk is:
Open the excel sheet programmetically, save it as .cvs or .csv format or whatever format you want.
To do that you need to improt excel class from type library.
For details go to MSDN.
Please let me know if you find the better way at soft.gandhi@gmail.com.
Anurag Gandhi.
http://www.softgandhi.co.nr
|
|
|
|
|
Using Excel Automation, do something like:
_Application app;
Workbooks books;
_Workbook book;
if (app.CreateDispatch("Excel.Application") == TRUE)
{
books = app.GetWorkbooks();
book = books.Open("c:\\book1.xls", ...);
book.SaveAs(COleVariant("c:\\book1.cvs"), ...);
app.Quit();
}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
If I only has a HWND for an unknown window, and I want its icon, currently I use CWnd::GetIcon, but this requires the application to SetIcon previously, if not, the icon is incorrect, however, the icons on the corresonding buttons of taskbar are always correct, so how to get them?
|
|
|
|
|
try calling the GetClassLong() function with the value GCL_HICONSM.
|
|
|
|
|
|
i am new to vc++.Can anybody tell me how to read the data from an excel file using vc++.I heard it has to be changed to .cvs format.but i dont know that.....can anybody help me out
Thank in advance
|
|
|
|
|
No need to create .csv file.
You can directly Create, edit or Read the excel file from your VC++ application using ODBC.
Here is the sample code which I have created but it is specific to my project. You need to do the changes accordingly.
<br />
#include "StdAfx.h"<br />
#include "Excel.h"<br />
<br />
CExcel::CExcel(void)<br />
{<br />
m_rc = new CRecordset(&m_database);<br />
m_driver = "MICROSOFT EXCEL DRIVER (*.XLS)" ;
}<br />
<br />
CExcel::~CExcel(void)<br />
{<br />
}<br />
<br />
int CExcel::CreateSheet(CString strFileName, CString strTableName, CString strColumns)<br />
{<br />
CString sql;<br />
CString strTableCol;<br />
CString strBlank;<br />
<br />
strFileName= CString("Data\\") + strFileName;<br />
strTableCol= strColumns;<br />
strTableCol.Trim();<br />
strTableCol.Insert(0,CString("["));<br />
strTableCol.Replace(_T(", "),_T("] TEXT, ["));<br />
strTableCol.Replace(_T("."),_T("] TEXT"));<br />
strColumns.Replace('.',' ');<br />
<br />
<br />
int iLen=strColumns.GetLength();<br />
for(int i=0;i<iLen;i++)<br />
{<br />
if(strColumns[i]==',')<br />
strBlank+="'',";<br />
}<br />
strBlank+="''";<br />
<br />
sql.Format(_T("DRIVER={%s};DSN='';FIRSTROWHASNAMES=1;READONLY=FALSE;CREATE_DB=\"%s\";DBQ=%s"), <br />
m_driver, strFileName, strFileName);<br />
<br />
try<br />
{<br />
m_database.OpenEx ( sql, CDatabase::noOdbcDialog ) ;<br />
sql.Format(_T("CREATE TABLE %s (%s)"), strTableName, strTableCol);<br />
m_database.ExecuteSQL(sql);<br />
sql.Format(_T("INSERT INTO %s VALUES (%s)"), strTableName, strBlank);<br />
for(int iCount=0;iCount<500;iCount++)
m_database.ExecuteSQL(sql);<br />
m_database.Close();<br />
}<br />
catch(CDBException e)<br />
{<br />
CString str;<br />
str.Format(_T("Driver not installed: %s"), m_driver ) ; <br />
AfxMessageBox(str);<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
int CExcel::OpenSheet(CString strFileName, CString strTableName, CString strColumns)<br />
{<br />
CString sql, str;<br />
strFileName= CString("Data\\") + strFileName;<br />
<br />
sql.Format(_T("DRIVER={%s};DSN='';READONLY=TRUE;DBQ=%s"), m_driver, strFileName ) ;<br />
<br />
try<br />
{<br />
if ( m_database.OpenEx( sql, CDatabase::noOdbcDialog ) )<br />
{<br />
sql.Format (_T("SELECT * FROM %s"), strTableName);<br />
m_database.ExecuteSQL ( sql );<br />
<br />
m_rc -> Open(CRecordset::snapshot, sql, CRecordset::none);<br />
} <br />
}<br />
catch ( CDBException e )<br />
{<br />
CString str;<br />
str.Format(_T("Driver not installed: %s"), m_driver);<br />
AfxMessageBox(str);<br />
}<br />
return 0;<br />
}<br />
<br />
int CExcel::CloseSheet(void)<br />
{<br />
m_rc->Close();<br />
m_database.Close();<br />
return 0;<br />
}<br />
You need to understand the code properly before applying it to your project as you are new to VC++.
Anurag Gandhi.
http://www.softgandhi.co.nr
|
|
|
|
|
thanks.... ill try with it
|
|
|
|