|
|
What VS version are you using? VS2003 .NET has "Monochrome, 16, 256, True Color" options.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I have more of a design type of question.
Can anyone tell me if it is possible to :
I have a win 32 dll and a C# web service. Instead of creating a c# client, i would like to use my win 32 dll as the client. I use this dll for other things that are all file related. Is it possible for me to make the dll the client and to be able to call the c# web service and send and receive data from it? If so, does anyone have any examples of how to turn an already existing win 32 dll into a client accessing a c# web service?
|
|
|
|
|
I just did that and here is how I did it.
First, we created the Web Service.
Second, I generated the C# proxy class source code file using WSDL
Third, I created a Class Library C# project and added the proxy class to it
Finally, I changed the Win32 DLL project to a mixed mode C++/CLI project and referenced the dll with the proxy class in it.
led mike
|
|
|
|
|
Wow, thanks for the input.
I already have steps 1 and 2.
However, is the third step a dll that you are creating?
And the 4th step. How would you change your win32 project to c++/cli?
Are there any gotchas while you were doing this or was it pretty straightforward?
|
|
|
|
|
LCI wrote: However, is the third step a dll that you are creating?
Yes
led mike wrote: Third, I created a Class Library C# project and added the proxy class to it
LCI wrote: And the 4th step. How would you change your win32 project to c++/cli?
Don't remember all the details, you set the /clr switch then have to #include a header file for the CLI stuff and you have to include all your System.XXXX refrences and of course your C# DLL with the Proxy class in it. You can find all sorts of information about C++/CLI project requirements using Google. There are C++/CLI articles on CodeProject as well.
led mike
|
|
|
|
|
Off topic hijack - I thought you'd like this: click[^]
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Yikes... give him this link[^]
led mike
|
|
|
|
|
I recieved an email from this thread but your post is missing. Did you delete it? Does that mean you resolved your problems with this issue?
led mike
|
|
|
|
|
Sorry about that ... here is what i wrote in the email:
Hi there, i appreciate your response but i find myself in this situation. I brand new to web services. As a result, the steps that you responded with gives me sort of an understanding , but it is not crytsal clear yet. The second step, i am not 100 % sure as to which files you are referring to. Is this the .asmx file? If i change my WIN32 dll, will i have to change the app that talks to it as well?
You see, i have a C++ app that needs the data from the web service. This C++ app currently gets data from another source through a win 32 dll. So my attempt is to link this dll to the web service as a client so that i can send queries from my C++ app to the dll, the dll will compile the query and send to web service. Web service will process and return a reponse, either to the dll, or write to a file somewhere. C++ app is on a client machine and the web service is on a server. These two will have a network connection.
That is the big picture of what i am trying to accomplish . You gave me hope with your response but can you give me just a little more detail since i am pretty new to all this.
Thanks,
cw
|
|
|
|
|
C++/CLI looks like it is closer to C#. My win32 dll uses std::string in particular as the main purpose of the dll is to parse strings of data. If this were to be converted, the code would have to be re-written right?
|
|
|
|
|
LCI wrote: The second step, i am not 100 % sure as to which files you are referring to.
When you execute the WSDL utility on a WebService it generates a C# code file that "is" a proxy class for the WebService. By Proxy class we mean (among other things) a class that a WebService Client can use to envoke the WebService. This is the file you put into a C# class library project. That project produces a "Managed" DLL which you will be able to "reference" from your C++/CLI DLL Project.
LCI wrote: If i change my WIN32 dll, will i have to change the app that talks to it as well?
In my case I did NOT. I had a VC6 executable that used my DLL. The original version of my DLL was a VC6 project as well. The new version of the DLL is a VC8 project and therefore requires new CRT DLL's be present on the machine, as well as the .NET Platform of course. However the DLL interface did not change and therefore the consuming exectuable code was not changed. In fact the EXE was not even re-built, I just installed the new DLL and ran the executable and everything worked.
LCI wrote: My win32 dll uses std::string in particular as the main purpose of the dll is to parse strings of data. If this were to be converted, the code would have to be re-written right?
No. Your new DLL is a "mixed mode" project. This means you can use both native code and managed code, therefore your existing native C++ (std::string) code is fine. However the C# proxy class you will use in your CLI DLL is a "managed" object. This means the memory is managed by the .NET platform and garbage collector. The response from the WebService will be in this Proxy class and therefore will be in managed memory. You will Marshal [^]the data into native memory and will then be able to use your existing C++ code "as is".
led mike
|
|
|
|
|
Is the proxy class that you are refering to called a web reference\reference.cs?
|
|
|
|
|
Probably not. This subject might not be optimal for a forum based tutorial. You will probably need to read some documentation on a few things like the WSDL Utility. WSDL.exe[^] is a utility that comes with the .NET Platform SDK, and Developing WebServices for IIS using Visual Studio.
When you give WSDL.exe the URL to your WebService (asmx) file on IIS. It will generate a C# source code file. The class generated in that file will derive from System.Web.Services.Protocols.SoapHttpClientProtocol.
led mike
|
|
|
|
|
I am still having problems creating an application using menus. I created a dialog based application that has an embedded dialog in the main dialog. The embedded dialog contains two tabs, one tab displays a dialog showing temperature readings (among other things), the other tab displays database values.
I placed a menu on the main dialog. When I select celsius from the menu of the main dialog I want the celsius value to display on one of the embedded dialogs. I have tried different strategies, but none seem to work. I tried to use the ON_COMMAND function, but I am not getting any results. My code works if I put buttons on the embedded dialog, however, I want to use the menu resource instead of buttons.
Specifically, I select celsius from the menu of the main dialog, I want the raw units currently displayed in the embedded dialog to be changed to celsius values. Any suggestions will be appreciated.
Thanks
Trevy
|
|
|
|
|
I would assume you handle the menu by your main dialog, and pass the message down to your embedded dialog for further process. say,
CMyMainDialog::OnMenuCelsius ()
{
SendMessage (pEmbedDialog->m_hwnd, WUM_MENU_CELCIUS);
}
CMyEmbedDialog::WindowProc (UINT message, WPARAM wParam, LPARAM lParam )
{
if (message == WUM_MENU_CELCIUS)
{
/* display raw units to celcius values */
}
}
|
|
|
|
|
Thanks Lucy for your help.
I am a beginner using MFC and I am still having problems with the concept of using messages. Can you tell me what I am doing wrong. I am getting the error C3861: 'WM_MENU_CELSIUS' identifier not found, even with argument-dependent lookup
In my header file:
// Create and assign pointers to each embedded window
_3DSEmbeddedDialog *m_dPointer[2];
In my .cpp file for main dialog:
BEGIN_MESSAGE_MAP(CMotionAnalyzerDlg, CDialog)
......
ON_COMMAND(ID_TEMPERATURE_CELSIUS, OnTemperatureCelsius)
WM_MENU_CELSIUS()
END_MESSAGE_MAP()
//2 embedded dialogs. Celsius temperature should display in the
//moteDataDlg dialog box
m_dPointer[0] = &moteDataDlg;
m_dPointer[1] = &databaseDlg;
void CMotionAnalyzerDlg::OnTemperatureCelsius()
{
SendMessage(m_dPointer[0], WM_MENU_CELSIUS);
}
In my .cpp file for embedded dialog moteDataDlg:
void MoteDataDlg::WindowProc(UINT message, WPARAM wParam,
LPARAM lParam)
{
if (message==WM_MENU_CELSIUS)
{
celsiusFlag = !celsiusFlag;
AfxBeginThread(MyThreadProc, this);
}
}
Thanks for taking the time to help me.
Trevy
|
|
|
|
|
WM_MENU_CELSIUS is not a standard message. It's a user message. You have to define it.
For example, in your header file moteDataDlg.h, add the following:
#define WM_MENU_CELSIUS (WM_USER + 100)
for more information on WM_USER, check its entry in MSDN.
All the best!
|
|
|
|
|
That really should be WM_APP not WM_USER. I've had instances where WM_USER has been used by some of the newer MFC classes. I don't remember off-hand which one it was but I had a problem in one of my apps that was do to something else also using WM_USER. When I changed my define to WM_APP the problem went away.
Judy
|
|
|
|
|
thank you. that's good to know. I read wm_app again, and noticed it's said as follows:
"Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.
"
|
|
|
|
|
Still having problems. I know this should be simple, however, this is the second day I have been working on this problem and I still cannot seem to solve the problem.
Thank you for your help or I would not have gotten this far.
Thanks to Judy also.
void CMotionAnalyzerDlg::OnTemperatureCelsius()
{
//m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0);
SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS);
}
In the function OnTemperatureCelsius() of the main dialog, if I use the statement SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS);
I get error C2664: CWnd::SendMessageA: cannot convert parameter 1 from HWND to UINT. m_dPointer[0] refers to the embedded dialog (moteDataDlg).
I tried an alternate statement that I saw when searching for an answer. If I use the statement m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0), my application compiles but do not run.
Also, I am using the WindowProc correctly in my embedded dialog (moteDataDlg), I use LRESULT for the return value, initially, I used void. In the header file I declared:
protected: LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
LRESULT MoteDataDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message==WM_MENU_CELSIUS)
{
celsiusFlag = !celsiusFlag;
AfxBeginThread(MyThreadProc, this);
}
return 0;
}
Trevy
|
|
|
|
|
It looks ok to me. Time to break out the debugger. Put a breakpoint on your SendMessage and follow the execution to see where it doesn't work.
Judy
|
|
|
|
|
Trevy wrote: BEGIN_MESSAGE_MAP(CMotionAnalyzerDlg, CDialog)
......
ON_COMMAND(ID_TEMPERATURE_CELSIUS, OnTemperatureCelsius)
WM_MENU_CELSIUS()
END_MESSAGE_MAP()
First, remove WM_MENU_CELSIUS from the MessageMap - you're handling it yourself from the WindowProc.
Next, WM_MENU_CELSIUS a user-defined windows message. You need to define it.
#define WM_MENU_CELSIUS WM_APP
Lastly, I would change your SendMessage to PostMesasge. The difference is whether you wait for the message to be processed.
Judy
|
|
|
|
|
Hi have written an addin for the Outlook 2003. All in-coming mails are proparelly backup in the .Msg file at particular location on the disk. The objective of the saving the file in the .MSG format is that on double clicking on the .Msg file it will open in the MS Outlook, or even if we do drag and drop it will open in MS Outlook. The basic thing i want to do is to set passward to .Msg file for opening in MS Outlook. It should either ask for user name and password or any other strategy of authetication. Once it passes this user name and password it should open in MS Outlook, Help me...
-- modified at 8:20 Wednesday 14th March, 2007
Ganesh Paul SPIAN
|
|
|
|
|
Hi guys, I'm new in VS2005 and I can't find the Memory Window that I could open with "View->debug Windows->Memory" in VS6.
Where can I find that window ?
Thanks a lot
|
|
|
|