Async calls to WebService in MFC

Hey guys,

I use a webservice over the net which is scripted in VB.Net. This web
service receives a username and a password and returns a string
structure with multiples infos. If the string is empty, I had the wrong
username and/or password. Pretty simple isn't?

Ok now the problem is a bit more complex. I'm using an MFC client to
connect to these web services, and since they're on the internet,
there's a delay between sending the data and receiving an answer. I
don't know really how I can tell me client to "wait for the string".
The wrapper MFC created for the webservice returns a HRESULT that tells
if the webservice was found, but not if I was authentificated.

Here's the prototype :

GetSession (BSTR username, BSTR password, BSTR** Results);

I'm just throwing a BSTR pointer to GetSession into it's 3rd parameter
and it should write the results there. But it doesn't. My BSTR is empty
and not initialized (no new has been made). Let's say this is how it
works :

BSTR* bstrResults;
GetSession("leonard.guillaume", "GoogleGroups!", &bstrResults);

if (!bstrResults)
    AfxMessageBox("Couldn't get Results");

The MessageBox always pop and my bstrResults adress is still
0x00000000...well nothing.

So I'm thinking, I might need an async function, because once the call
has been made to GetSession, the client doesn't wait the answer and
goes straight to the if and shows the MessageBox.

I'm a newbie into Async and Internet stuff under non-managed stuff (not
..Net), so any help would be really appreciated...I've been searching
for hours on how to do that and it's depressing :(

Thank you,

Guillaume :)

0
3/21/2006 7:37:53 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
914 Views

Similar Articles

[PageSpeed] 9

Reply:

Similar Artilces:

redistributing MFC
Dear All! I have problem to add MFC library to setup project created by Visual Studio Net. When I adding MFC71.dll the studio propose me to add merge module. I adding merge module instead dll. The DLLs installed in application folder, but I want install in windows system folder(for using by all my exe files). How to solve this problem? With best regards. Victor AFAIK, Microsoft's policy is now to distribute your DLLs with the application ( in the apps dir ), so you don't break other applications by copying what *you* think it the correct MFC71.DLL version into the system directory. ...

CRM Cisco call connector
I've installed Cisco's Unified call connector 4.0.3 on our CRM 4.0 server, and the client on my PC. The client is talking to the server OK as it will search for a phone number and pick out the relevent Contact details from the Server. However When I click the Dial button ( from my client ) on a contact , the webpage it brings up is an http://localhost:5556............ . Question is why is my client looking for a localhost page, is there a config somewhere that i've missed that should be pointing it to the CRM server or Cisco Callmanager? For anyone who might hit the same pr...

Calling sysdm.cpl from MFC....
Hello once again, Today I am here asking if anyone has ever called SYSDM.cpl from an MFC program. I have written my application to invoke sysdm.cpl from a button inside the About Dialog box. To be honest, I was being lazy and rather than define a bunch of system related fields for a "systems Information" type of display, I thought I could simply pop open the system dialog box. This all works fine one time. When I click the button subsequent times, nothing appears to happen. The click is processed, and the call is executed, but that is all I have seen. Here is the code fragmen...

Do WIA scan without calling IWiaDevMgr->DeviceDlg()
I am trying to do a wia scan using the IWiaDevMgr, IWiaItem and IWiaDataTransfer Created the IWiaDevMgr as in the following code CComPtr<IWiaDevMgr> pWiaDevMgr hr = pWiaDevMgr.CoCreateInstance(CLSID_WiaDevMgr); then call the CreateDevice on that object with the correct device id hr=pWiaDevMgr->CreateDevice(str,&pItemRoot); and then i call DeviceDlg on the pItemRoot CComPtrArray<IWiaItem> ppIWiaItem; hr = pItemRoot->DeviceDlg( hWndParent, lFlags, lIntent, &ppIWiaItem.Count(), &ppIWiaItem ); make IWiaDataTransfer using the ...

OnSetActive not called
Hello NG, I have an MDI app. The view has a property page. There I have OnSetActive that calls a function "FillEditCtrl" to showsvalues in an edit control. I call a menu that opens a dialog. The user can edit values that are shown in the edit control of the property page of the view. The user closes the dialog. But OnSetActive of my property page is not called, so the values are not shown in my view. After closing the dialog, what afx msg is called instead? void CMainFrame::OnMenuEditValues() { CWnd* pw = GetActiveWindow(); CTheDialog dlg; dlg.DoModal(); ...

Creating a DLL that would bridge an unmanaged Delphi call to managed C#
Hello, I'm trying to create this DLL that will get called from a Delphi program. In order to interface the unmanaged Delphi program with the managed C#, I'm trying to make an intermediary bridge DLL. So far I've been able to make it accessible to the Delphi program, but I'm having problems returning a string which is passed as a pchar parameter. Delphi signature for the function I'm implementing: function ElectronicPay(const input :pchar, var output :pchar): boolean; export; stdcall; C# bridge implementation so far: [DllExport] // http://www.codeprojec...

Pls help with embedding wmp in a non-dialog mfc view
Hi, I'd like to add mpeg, avi, and wmv playback capability to my mfc app. I thought that this would be quite simple if I decide to use Windows Media Player ActiveX instead of DirectShow filtergraph. Unfortunately that did not happen (i.e. the 'simple' part). First I struggled with Visual Studio ..NET - inserting wmp into the project did not generate CWnd derived wrapper class (as stated in sdk docs). Instead it generated COleDispatchDriver derived class. I did not want to waste any time on typing (clsid, create, etc.) so I decided to use VC6 and generated CWnd derived wrapper...

How to display Checkbox MenuItem in MFC??
File Edit View O Checkbox1 O Checkbox2 How do I display Checkbox Menu Item in MFC like the one above?? Normal menu items on CMenu on the left and checkbox on the right on the same menu bar? Steve wrote: > File Edit View O Checkbox1 O Checkbox2 > > How do I display Checkbox Menu Item in MFC like the one above?? Normal > menu items on CMenu on the left and checkbox on the right on the same > menu bar? I don't think there is a way to do this on the standard menu. You can do almost anything you want with custom menus on a...

Button Control calling CFormView #2
hi everyone, I Have a CFormview (FormB) that has a button. When this button is click, It will call another CFormView (FormA). How to do it? I am using VC++ 6.0. Newbie & Noobie wrote: > hi everyone, > > I Have a CFormview (FormB) that has a button. When this button is click, It > will call another CFormView (FormA). > > How to do it? I am using VC++ 6.0. I assume you have created your project with the aid of the class wizard from the IDE. if you double click your button in the resource editor class wizard should suggest a click handler method for your button. Within...

could i customize the dialog that popups up when calling SHBrowserForFolder
i wanna add a checkbox to the dialog, could i?how? thanks in advance I guess there is no way to customize the common dialog, you must create a new dialog and provide the required functionality in it /Kiran thinktwice wrote: > i wanna add a checkbox to the dialog, could i?how? > thanks in advance Take a look at this article. I'm not sure this is what you want, but it's cheap to look. http://www.codeproject.com/dialog/yabffwcp.asp Tom "thinktwice" <memorialday@gmail.com> wrote in message news:1158055405.669054.272220@d34g2000cwd.googlegroups.com... >i...

MFC & Class Wizard
I' wondering if someone could shed some light on MFC and/or the classwizard. I don't understand why in class wizard that some functions are implemented as message handlers, some are virtual functions and some (such as OnOK) are not supported at all and I have to add them as regular member functions. Is it just a poor implementation of MFC that the class wizard writers were forced to adhere to? Or is MFC a good implementation and class wizard just didn't go all the way there? Another example is that there is no way to add a variable for a radio control and some things like t...

why destructor is not called
Hi, How is this possible that destructor is not called when I quit my application? This is toolbar for IE. For one of my classes destructor is not called causing memory leaks. Class was created on the stack and there is no inheritance. thanks for advice write part of the source code. which is the class and where it is used. andrew wrote: > Hi, > How is this possible that destructor is not called > when I quit my application? This is toolbar for IE. > For one of my classes destructor is not called causing > memory leaks. Class was created on the stack and there is no inherit...

Query that calls value from one table field to another table field
I have a query where I need the table (Station) first name field and last name field to populate to another table (Admin) field. The query is linked by "Phone Template". The purpose of this is due to needing the data field from the second table to import into a tool used by my company. The field names are CPND_FIRST_NAME and CPND_LAST_NAME, which come up blank when the query is run. Is there a way to have the names from from Station Table field to populate in the Admin Table field within the query? Thanks in Advance, Lisa W. Lisa I may not use the same definition of th...

POS- Invalid procedure call or argument-URGENT
newly installed RMS POS 2.0 it was working fine now if i'm trying to open POS i'm getting this error and the POS wont start. I'm getting the same error when starting the client, SO is working no problems This is a multi-part message in MIME format. ------=_NextPart_000_0A85_01C7720C.72FE9750 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dani, Need more info, but did you install as an Administrator? =20 Have you tried running a repair install or install on top of itself? Did it run through the registration process? --=20 Je...

Want to call a Web Service from a C++/MFC App in VS.NET 2003
I need to connect to a Web Service from a C++/MFC app. I created a Web Reference to my Web Service on localhost. There was a localhost.h created and in there was my class defined as a template as follows; template <typename TClient = CSoapSocketClientT<> > class CRegistrationInfoT : public TClient, public CSoapRootHandler { ... } In this class is a definition of the routines that I want to call, one of which is defined as: HRESULT GetClasses( ClassInfo** GetClassesResult, int* GetClassesResult_nSizeIs ); I can't figure out how to instantiate...

Sending binary data via a GET or POST REST call
Hello Everyone, I'm creating a program that will use a REST interface to send a binary file to the server but I'm really not sure how to do that. I know how to do the REST call but how do I send binary data? The documentation says I will send it as file_data=<raw_binary_data> in my GET request. I'm using the HTTPWebRequest() and HTTPWebResponse() classes to do this from the client. Can anyone help? Also, is the process much different to send via POST? Can anyone point me in the right direction? Thanks! Anthony Small Correction: The method is actually O...

MFC to Console.
Hello Group. I need to convert the code of WiniNet Async Demo from microsoft samples from MFC to a console function.. Someone can help me with the changes.. The code is posted here Regards /* Microsoft Corporation Copyright 1999-2002 */ /******************************************************************** ProjectName : AsyncDemo Purpose : This sample demonstrates how to submit two WinInet requests, using InternentOpenUrl, asynchronously. Notes : This sample does not handle any authentication. To properly handle authentication, the functions that handle specific protocols (like Ht...

Async Pluggable Protocol
Can I create an Asynchronous Pluggable Protocol to simply launch an external program ? What I'm trying to do is when the user enters a url or clicks on a link like myapp:xyz A call will be made to my DLL and then depending on what xyz is I will launch an external EXE. What is an "asynchronous pluggable protocol" and how would anyone find out what this means? Under what context would this apply? Why do you need to launch an external .exe? (Note: this is a clear security violation in any number of contexts, and in any sane world it would be forbidden for a browser to lau...

XML and DOM through MFC?
I am new to DOM and XML. 1. Certain device commands are to be stored in a reference file. The commands exchanged between the device and the PC should be trapped. The trapping component must parse through the reference file. It is recommended that the reference file be XML. Can I access Microsoft DOM through MFC? 2. The commands that are exchanged are to be stored as HTML and RTF. How can I do it through MFC? Harish wrote: > I am new to DOM and XML. > 1. Certain device commands are to be stored in a reference file. The > commands exchanged between the device and the PC should be...

Invalid procedure call?
Hello All This is a re-post of a problem I posted a while ago, but to which I got no suggestions: hopefully I'll be more lucky this time!? I have the following code in a Private Sub: If InStr([ResponseXML], "element") > 0 Then errorfield = "Invalid " & Mid([ResponseXML], InStr([ResponseXML], "element"), InStr(InStr(InStr([ResponseXML], "element"), [ResponseXML], "'") + 1, [ResponseXML], "'") - InStr([ResponseXML], "element") + 1) Else .... Most of the time this works fine, but for some da...

Async I/O and blocking
I cannot find (even on google groups) a discussion thread a while back where someone gave a reference to an article describing when asynchronous I/O is actually blocking. Conditions such as appending to a file were among the reasons. I'm having trouble remembering appropriate keywords that might have appeared in the article, and my attempts have been futile. Anyone remember the article referenced? thanks joe Joseph M. Newcomer [MVP] email: newcomer@flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm There is a KB article. I guess the search ...

I implemented a grid control in a big MFC project.
Grid, a rect filled with cells, no line nor row. If some one has time to purify it and put it to www.codeproject.com,contact me. If you need the code ,send me a mail. > Grid, a rect filled with cells, no line nor row. > > If some one has time to purify it and put it to > www.codeproject.com,contact me. > > If you need the code ,send me a mail. Why not contact codeproject directly or at least post in its own newsgroup over there. Keep in mind though that codeproject has the Chris Maunder's famous MFC grid control. --- Ajay It can not be merged and split illimitably...

What is the cell data reference for 5th row and 7th column called
Can someone help me with this question? I need to get the answer for my homework. Thanks for your help. I'm guessing, but might it be G5? -- Regards, RD --------------------------------------------------------------------------- Please keep all correspondence within the NewsGroup, so all may benefit ! --------------------------------------------------------------------------- "Shy-di@verizon.net" <Shy-di@verizon.net@discussions.microsoft.com> wrote in message news:A0979494-228B-435E-98F7-6BD26C900266@microsoft.com... > Can someone help me with this question? I nee...

Possible to call Linux machine from MFC?
Hi, I've been searching for some answers to this online but it's really outside my experience, which is mostly with MFC. I'm trying to figure out if it's possible to call an executable that resides on a machine running linux and pass both input arguments and get return values from the linux executable. ( The hardware we want to interact with is only accessible from the linux machine.) TIA for any help or pointers. Regards, Gerry Murphy > I've been searching for some answers to this online but it's really > outside > my experience, which is mostly...

Gdi+ (Mfc) & Scrolling
Gdi+ (Mfc) & Scrolling - any pointers to examples please I need to update an MFC project to use Gdi+. Can anyone point me to an example. My IDEAL example would be an undated non-ole version of Scribble which would use MFC GDI+ Scrolling Zooming :) Double Buffering :) :) :) But and other help and or hints even good C# !!! examples would be better than nothing. I tried working from the final (non-ole) Scribble example (VC6) but I could not get the GDI+ DC to display :( Sigh hence my request. Many Than...