|
Hi all,
I'm trying to invoke web services written in c# from a VC++ 7.1 app.
The function I'm invoking is quite simple.
<code>
[WebMethod]
public int Foo(int i)
{
return i + 1;
}
</code>
It works fine when I test the client in C#. I then tested in VC++. I added the web reference and SPROXY generate the header files for me. Here's is my client code in c++
<code>
...
if (SUCCEEDED(CoInitialize(NULL))))
{
TestServices::CTestServices ws;
int ret = 0;
HRESULT hr = ws.Foo(3, &ret);
CoUninitialize();
}
</code>
However ws.Foo() returns E_FAIL. I stepped in the generated code and it failed at BeginParse() function in atlsoap.h
<code>
virtual HRESULT BeginParse(IStream *pStream)
{
ATLASSERT( pStream != NULL );
CComVariant varStream;
varStream = static_cast<IUnknown*>(pStream);
HRESULT hr = m_spReader->parse(varStream); //it fails here
if (SUCCEEDED(hr))
{
if (m_refMap.GetCount() != 0)
{
hr = E_FAIL;
}
}
return hr;
}
</code>
And I see following error message in the output window
ATLSOAP: CSoapRootHandler::GetElementEntry -- element not found: Action.
ATLSOAP: CSoapRootHandler::GetElementEntry -- element not found: MessageID.
ATLSOAP: CSoapRootHandler::GetElementEntry -- element not found: To.
ATLSOAP: CSoapRootHandler::GetElementEntry -- element not found: Security.
ATLSOAP: CSoapRootHandler::endElement -- invalid SOAP message format while processing headers.
Also, here is the xml result returned by the web service call
<?xml version="1.0" encoding="utf-8"?>
<int xmlns="http://www.blahblah.com/webservices/">4</int>
What am I missing? Thank you all in advance.
-- modified at 17:41 Wednesday 19th July, 2006
|
|
|
|
|
I'm getting the same error. Please let me know if you got the answer for this problem.
Thanks,
Kapil
|
|
|
|
|
I kind of hate imagelists.
I'm trying to draw transparent images (without masks) from a CImageList with the ILD_TRANSPARENT ILD_NORMAL parameter and obviously it does not work as intended, because the error is between the chair and the keyboard.
This is how I do it :
My bitmap ( IDR_MAINFRAME ) is a 256 colours bitmap with RGB( 192, 192, 192 ) as the background
colour; the dialog BG colour is RGB( 218, 222, 232 )
void CAboutDlg::OnPaint()
{
CPaintDC dc(this);
COLORREF cDialogBG = RGB( 218, 222, 232 );
CRect rect;
GetClientRect( rect );
CBrush brush;
brush.CreateSolidBrush( cDialogBG );
dc.FillRect( rect, &brush );
CBitmap bmp;
bmp.LoadBitmap(IDR_MAINFRAME );
CImageList imageList;
imageList.Create(16,15, ILC_COLOR8, 4, 1);
imageList.SetBkColor( CLR_NONE );
imageList.Add(&bmp, RGB( 192, 192, 192 ));
imageList.Draw( &dc, 0, CPoint( 10, 10 ), ILD_NORMAL );
}
I'm becoming clueless and a bit aggravated because it seems i'm doing all the basics rights, and this should work as advertised.
Thanks.
( modified because I screwed up my post )
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
-- modified at 20:39 Wednesday 19th July, 2006
|
|
|
|
|
You don't say what the problem is. I guess the image is drawing OK but not tranparent?
You say you are using ILD_TRANSPARENT but that is not in the code you posted
You say the image background color (transparent color) is 256,256,256 but that is not in the code you posted
|
|
|
|
|
yeah, that's how I feel, I can't even post a question properly today.
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
You need to use the ILC_MASK flag when creating the image list for it to have a mask (which is how it does transparency). Then when you add the images, use icons (which have built-in trasparency) or a bitmap with one color that indicates the transparent parts.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Is it possible to check if the microphone is in use?
|
|
|
|
|
This sound familiar!
First, how are you opening the microphone device?
Assuming that you are using waveInOpen(...) it will return MMSYSERR_ALLOCATED if someone else already has a handle to the microphone.
If waveInOpen is not the way you are using the Mic then let us know in what context you are using it so that we can give an intelegent answer.
AliR.
Visual C++ MVP
-- modified at 16:59 Wednesday 19th July, 2006
|
|
|
|
|
Hi fellows.
I have a treeview(populated) and I would like to select a single node I have this code:
<br />
case WM_NOTIFY:<br />
{<br />
TV_ITEM tempTvItem;<br />
char cTemp[256]="";<br />
unsigned int uiVal = 0;<br />
LPNMHDR notifyMessageStruct = (LPNMHDR)lParam;<br />
if(notifyMessageStruct->hwndFrom == treeViewHwnd)<br />
{<br />
if(notifyMessageStruct->code == NM_CLICK)<br />
{<br />
nodeSelected = (HTREEITEM)SendDlgItemMessage(treeViewHwnd, IDC_TREE1, TVM_SELECTITEM, TVGN_CARET, (LPARAM)nodeSelected);<br />
tempTvItem.mask = TVIF_TEXT|TVIF_HANDLE;<br />
tempTvItem.hItem = nodeSelected;<br />
tempTvItem.pszText = cTemp;<br />
tempTvItem.cchTextMax = 256;<br />
SendMessage(treeViewHwnd, TVM_GETITEM, 0, (LPARAM)&tempTvItem);<br />
MessageBox(NULL, tempTvItem.pszText, "", MB_OK);<br />
...<br />
My problem is that the select part. The node isn`t selected and in the MessageBox nothing is shown.
What`s the problem? I want when I select the node it remais highlighted and selected.
|
|
|
|
|
Where did you get IDC_TREE1 from??
If you are using a CTreeView view, why aren't you using GetTreeCtrl()->SelectItem(...);?
AliR.
Visual C++ MVP
|
|
|
|
|
I`m not using CTreeView, I`m creating the treeview with CreateWindowEx function. and in the HMENU part
I include the IDC_TREE1 like the ID of the window.....
Like this:
<br />
treeViewHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, "theTreeView", WS_CHILD|WS_VISIBLE|TVS_SHOWSELALWAYS|TVS_TRACKSELECT|TVS_EDITLABELS|TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT, 0, 0, 400, myRect.bottom, hwnd, (HMENU)IDC_TREE1, hCurrentInstance, NULL);<br />
-- modified at 17:19 Wednesday 19th July, 2006
|
|
|
|
|
In that case try this
nodeSelected = (HTREEITEM)SendMessage(treeViewHwnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)nodeSelected);
AliR.
Visual C++ MVP
|
|
|
|
|
Ali unhappilly, this code doesn`t work too....
I`m almost changing to TreeView_SelectItem....
|
|
|
|
|
Hi, am new to MS VC++, and I need to interface a PC to a handeheld GPS device (Garmin etrex). Am using a serial to USB cable, and I can connect using hyperterminal so HW is ok. However, when I try to use some example code supplied on the Garmin website, I cant connect! The relevant code fragment is (I believe):
HDEVINFO theDevInfo = SetupDiGetClassDevs((GUID*) &GUID_DEVINTERFACE_GRMNUSB, NULL, NULL, DIGCF_ALLCLASSES );
SP_DEVICE_INTERFACE_DATA theInterfaceData;
theInterfaceData.cbSize = sizeof( theInterfaceData );
if( !SetupDiEnumDeviceInterfaces( theDevInfo, NULL, (GUID* &GUID_DEVINTERFACE_GRMNUSB, &theInterfaceData ) && GetLastError() == ERROR_NO_MORE_ITEMS )
{
gHandle = 0;
return;
}
--------------
Garmin tech support wont help and any help would be GREATLY appreciated
Thanks! Dinesh
|
|
|
|
|
hey man,
why do you want to do this? Garmin products have features other than navigation?
btw, I have a garmin streetpilot i5 and it works very well.
|
|
|
|
|
dinesh_pam wrote: if( !SetupDiEnumDeviceInterfaces( theDevInfo, NULL, (GUID* &GUID_DEVINTERFACE_GRMNUSB, &theInterfaceData ) && GetLastError() == ERROR_NO_MORE_ITEMS )
{
gHandle = 0;
return;
}
In the above try this so see what the error exactly is:
<br />
if( !SetupDiEnumDeviceInterfaces( theDevInfo, NULL, (GUID* &GUID_DEVINTERFACE_GRMNUSB, &theInterfaceData ) )<br />
{<br />
if(GetLastError()== ERROR_NO_MORE_ITEMS) <br />
{<br />
printf("**Error: couldn't find device(no more items), (0)\n");<br />
SetupDiDestroyDeviceInfoList(theDevInfo);<br />
gHandle = 0;<br />
return -1;<br />
}<br />
else<br />
{<br />
printf("**Error: couldn't enum device, (%d)\n"), GetLastError());<br />
SetupDiDestroyDeviceInfoList(theDevInfo);<br />
gHandle = 0;<br />
return -1;<br />
}<br />
}<br />
Kitty5
|
|
|
|
|
thank you kindly for the reply. The error is couldnt find device. i.e. "**Error: couldn't find device(no more items), (0)"
Is there anyway I could just read the virtual COM port like hyperterminal is doing instead of this?
Dinesh
|
|
|
|
|
Not quite sure how to:
dinesh_pam wrote: Is there anyway I could just read the virtual COM port like hyperterminal is doing instead of this?
However:
Did you include the file that contains the device's GUID?
It's usually a .h file that looks like:
<br />
#ifdef DEFINE_GUID<br />
<br />
DEFINE_GUID(GUID_DEVINTERFACE_ALTGENERIC, 0xaf1b231e, 0x1180, 0x420b, 0x8c, 0xb6, 0x2e, 0xd2, 0xa5, 0x3f, 0x9f, 0x92);<br />
<br />
#endif<br />
If you don't have a GUID for your device the PC will not be able to create a handle to the device. The handle is what give you the ability to communicate to the device.
Also, make sure that you: #include "INITGUID.H" in that GUID .h file.
Kitty5
|
|
|
|
|
Thanks, but all that's done further up in the file.
I'm really frustrated with this. I find it hard to believe such a simple task can be so complicated.. Anybody else help me out please?
Dinesh
|
|
|
|
|
Well your call to SetupDiEnumDeviceInterfaces does not have matching parenthesis so something very wrong is there.
You are not checking the HDEVINFO return value so you may not even have a valid handle to pass to SetupDiEnumDeviceInterfaces
HDEVINFO hDevInfoSet = SetupDiGetClassDevs(&guid, NULL, NULL, DIGCF_ALLCLASSES );
if( INVALID_HANDLE_VALUE == hDevInfoSet)
{
DWORD dwErr = ::GetLastError();
}
else
{ ...}
You are not initializing the SP_DEVICE_INTERFACE_DATA structure which is probably not a problem but you never know.
SP_DEVICE_INTERFACE_DATA devInterfaceData = {0};
devInterfaceData.cbSize = sizeof(devInterfaceData);
|
|
|
|
|
Background:
I first created an MDI MFC application called test.
I then created a dialog named: IDD_MANUAL_CDIN.
This does simple data exchange:
User inputs a string in edit box1 (i.e. hello).
User clicks on "SEND" button.
User should see in edit box2 "I typed: hello".
I then created a class for that dialog which is implemented in manual.cpp:
<br />
#include "stdafx.h"<br />
#include "test.h"<br />
#include "manual.h"<br />
<br />
IMPLEMENT_DYNAMIC(manual, CDialog)<br />
<br />
manual::manual(CWnd* pParent )<br />
: CDialog(manual::IDD, pParent)<br />
, m_nIn(_T("init"))<br />
, m_nSent(_T("I sent "))<br />
{}<br />
<br />
void manual::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
DDX_Text(pDX, IDC_IN, m_nIn);<br />
DDX_Text(pDX, IDC_SENT, m_nSent);<br />
}<br />
<br />
BEGIN_MESSAGE_MAP(manual, CDialog)<br />
ON_BN_CLICKED(IDC_BUTTON_SEND, &manual::OnButtonSend)<br />
END_MESSAGE_MAP()<br />
<br />
void manual::OnManual()<br />
{<br />
manual manualDlg;<br />
manualDlg.DoModal();<br />
}<br />
<br />
void manual::OnButtonSend()<br />
{<br />
AfxMessageBox(tempSend);
AfxMessageBox(m_nIn);
m_nSent += m_nIn;<br />
}<br />
and manual.h:
<br />
class manual : public CDialog<br />
{<br />
DECLARE_DYNAMIC(manual)<br />
<br />
public:<br />
manual(CWnd* pParent = NULL);
virtual ~manual();<br />
afx_msg void OnManual();<br />
<br />
enum { IDD = IDD_MANUAL_CDIN };<br />
<br />
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
<br />
DECLARE_MESSAGE_MAP()<br />
public:<br />
CString m_nIn;<br />
CString m_nSent;<br />
afx_msg void OnButtonSend();<br />
};<br />
I then changed the toolbar created by the MFC App wizard so that when you click one button it will open a dialog that corresponds to that button.
All this code is in the test.cpp file:
I do:
<br />
#include "manual.h"<br />
BEGIN_MESSAGE_MAP(CSpaceCubeDataRxApp, CWinApp)<br />
ON_COMMAND(ID_MCD_INPUT, &manual::OnManual)<br />
ON_COMMAND(ID_APP_ABOUT, &CtestApp::OnAppAbout)<br />
ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)<br />
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)<br />
END_MESSAGE_MAP()<br />
Question:
After compiling I go to type in the string "hello" and click send and nothing pops up in edit box2. I know the "SEND" button function works b/c of the DEBUG AfxMessageBox the I put in it. Nothing is assigned to the variable m_nIn. The data exchange isn't working.
What am I missing?
Kitty5
|
|
|
|
|
|
DUH!
I knew it was something simple...
Kitty5
|
|
|
|
|
Ok, I've figured out how to get the dialog boxes to exchange data.
Now I'm trying to figure out how when you have one dialog box open how you can open another one while the 1st box is still open and functioning.
Right now when I have a dialog box open I can only work in the one box and can't click on anything outside it (i.e. clicking on the toolbar to open another dialog box or getting the about box to come up isn't working...)
I guess I'm looking for making these dialog boxes work like child forms in an MDI MFC App.
Thanks,
Kitty5
-- modified at 9:17 Friday 21st July, 2006
|
|
|
|
|
kitty5 wrote: void manual::OnManual()
{
manual manualDlg;
manualDlg.DoModal();
}
Is this right? I've never seen a dialog's method bring up another instance of itself.
Why do you not have two CEdit member variables in manual , one for each of the edit controls?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|