|
FreeEagle wrote: I searched the whole day in the Internet, but without any success.
Your post suggests your reading skills are not strong enough to be a software developer. You posted this in the wrong forum, also because you apparently can't read. You should consider a career change.
This site has 10s of articles that give examples of everything you likely need to know about working with databases from C++, not to mention the miles of them on the MSDN web site. If you can't find any of them it seems doubtful you have the capacity to develop working software.
|
|
|
|
|
@ Led mike:
Is that your way to help people? It is arrogant and unashamed to treat people this way.
What a pity, that I got such an answer,which did not help me, but just want to bring me down.
Notices or any Tips to any Web Pages, which could show me how can I solve the problem, would be helpful more than your stupid comment. I wrote from the beginning that I am a beginner, and did not claim that I am a great Software developer. I just started to learn this, and I will never ever let anyone (especially a person like you) to bring me down.
Thanks God that there are many people in other Forums,which are not like you, and could help me in this matter.
FreeEagle
|
|
|
|
|
I started to reply to your post but then I remembered you can't read
|
|
|
|
|
I create a windows form apllication, p2pport.
My form file name is Dlg.I get some errors.
error C2027: use of undefined type 'p2pport::CParams'
error C2227: left of '->setValue' must point to class/struct/union/generic type
in Dlg.cpp
params->setValue("Y", "123");
in my Dlg.h file
#include "params.h";
namespace p2pport {
using namespace System;
...............................
public ref class Dlg : public System::Windows::Forms::Form
{
CParams* params;
}
}
in my param.h file
class CParams{
void setvalue(char* k, char* v);
}
in my params.cpp
void CParams::setValue(char* k, char* v){ ..... return; }
Can anybody tell me what's wrong with it?
Appreciate your reply.
Jane
|
|
|
|
|
minihotto wrote: Can anybody tell me what's wrong with it?
Jane one of your compiler errors....
minihotto wrote: error C2027: use of undefined type 'p2pport::CParams'
"use of undefined type" is a beginner level error. Using forums to learn novice programming skills is sub-optimal. I strongly urge you to find some novice level books for programming and learn from them. When you need help understanding something from a book you can post the statement you don't understand in a forum and ask for clarification.
|
|
|
|
|
Jane, please note:
1. C++ and C++/CLI are case-sensitive.
2. C++ and C++/CLI classes are private by default.
3. Your CParams class is not int the p2pport namespace
4. Please use more descriptive subject line.
5. Don't disregard Mike's comments.
-- modified at 19:49 Wednesday 7th November, 2007
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
How can one implement a COM event sink with 'Windows Forms Application' with .NET 2005? Found plenty of examples on how to do it using MFC, but no luck witn CLI yet.
Anyone solved this tricky operation yet? I managed to implement one solution with 2003-version (it's not using CLR:pure or :safe, but CLR:oldformat), yet a problem exists on how to tell the Forms application the parameters (i.e. how to display the received parameters in controls).
|
|
|
|
|
eero_p wrote: with 2003-version (it's not using CLR:pure or :safe, but CLR:oldformat), yet a problem exists on how to tell the Forms application the parameters (i.e. how to display the received parameters in controls).
I don't understand. Perhaps you could post the relevant code that is problematic along with the compiler errors.
|
|
|
|
|
No errors, just don't know how can I make the sink object 'see' the main form or its controls.
Here's the sink that is created in:
public __gc class Form1 : public System::Windows::Forms::Form -style form.
Connecting to COM and reveiving an event is no problem, but how do I pass the parameter received in 'OnEvent' into a control on the form?
#ifndef __SINKBASE
#define __SINKBASE
#include <atlbase.h>
#include <atlhost.h>
#import "xxx.dll" named_guids raw_interfaces_only
#include "xxx.h"
template <UINT nID, class T, const IID* pdiid>
class SinkBase : public IDispEventSimpleImpl<nID, T, pdiid>
{
public:
SinkBase()
{
}
// fill in the _ATL_FUNC_INFO structured depending on DISPID
virtual HRESULT GetFuncInfoFromId(const IID& iid, DISPID dispidMember, LCID lcid, _ATL_FUNC_INFO& info)=0;
};
class MySink : public SinkBase<0, MySink, &DIID__IxxxEvents>
{
public:
MySink()
{
}
BEGIN_SINK_MAP(MySink)
SINK_ENTRY_EX(0, DIID__IxxxEvents, 1, OnEvent)
END_SINK_MAP()
HRESULT GetFuncInfoFromId(const IID& iid, DISPID dispidMember, LCID lcid, _ATL_FUNC_INFO& info)
{
if (InlineIsEqualGUID(iid, DIID__IxxxEvents))
{
info.cc = CC_STDCALL;
switch(dispidMember)
{
case 1:
info.vtReturn = VT_I4;
info.nParams = 1;
info.pVarTypes[0] = VT_BSTR;
return S_OK;
default:
return E_FAIL;
}
}
return E_FAIL;
}
HRESULT __stdcall OnEvent(BSTR eventString)
{
return S_OK;
}
};
|
|
|
|
|
eero_p wrote: but how do I pass the parameter received in 'OnEvent' into a control on the form?
eero_p, your english seems fine but your choice of words is less than optimal in terms of clear communications.
"how do I pass the parameter" ? What the heck does that mean. If you want assistance from texting forums you must give clear specific information. We can't see what you see on your monitor.
For example that might mean that on your form you have a System::Windows::Forms::TextBox and you want to assign the string value received in eventString to the .Text property of the TextBox .
If you had asked that question I would know exactly what you are asking. Also my answer would be that marshaling data from native memory to managed memory is a fundamental aspect of developing with C++/CLI. Therefore if you have not taken the time to study that aspect until you clearly understand it, I strongly suggest you do so now. There are excellent introductory resources both here on CodeProject (Articles) and on MSDN that provide all the C++/CLI information you require.
|
|
|
|
|
Sorry about that. It is sometimes a bit tricky to dig up the correct terms, when you get a new tool in your right hand and task to do in your left. Some sort of guidance on the tool and terminology would be optimal, but unfortunately in this case there were none. Example would have helped a lot.
However, you guessed just fine, and that gives me nice keywords to hit into the google search-field. Thanks!
|
|
|
|
|
I create a "Windows Form Application" projects that names p2pport.
Dlg is my form file name.
The following two lines are in Dlg.h.
struct sockaddr_in addrLoop;
CClient *cnList[5];
But it comes some errors.
error C4368: cannot define 'addrLoop' as a member of managed 'p2pport::Dlg': mixed types are not supported
error C4368: cannot define 'cnList' as a member of managed 'p2pport::Dlg': mixed types are not supported
Do anybody know what's wrong?
Appreciate your reply. Thx.
|
|
|
|
|
minihotto wrote: Do anybody know what's wrong?
Yes, mixed types are not supported. If you had studied C++/CLI, this means reading things likes books and articles you would know what that means. There is actually a great series of introductory articles on the subject right here on Code Project. I suggest you read them.
|
|
|
|
|
|
Hi,
I have to get handle for a process.I am doing as below.
Process^ pc = Process::Start("AcroRd32.exe", strCmdArgs);
IntPtr ProcHandle = pc->Handle;
HWND hwndProc = (HWND)ProcHandle.GetHashCode();
HMENU hMenu = ::GetMenu((HWND)&hwndProc);
// When I debug Iam getting Undefined Value in hMenu.
Is my code correct? Any suggestions would be helpful.
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
narayanagvs wrote: Is my code correct?
Just guessing... HWND hwndProc = (HWND)ProcHandle.GetHashCode();
That doesn't seem right to me, I don't remember ever using GetHashCode to obtain a HWND.
|
|
|
|
|
First, I know there is a known bug related to this warning message, and I know I have to call Microsoft to get the hotfix. My project is written in C++/CLI, with reference to 3 small C# DLLs. I've been working with the project for 6 months with NO warning messages. As soon as I installed VS 2008 Beta 2, BOOM! 350 warning messages, all C4945.
I am positive VS2008 is at fault, because on my other machine, which has ONLY VS2005, the project still builds with no errors.
Has anyone else ever encountered the same problem once VS2008 is installed? Does anyone know if uninstalling VS2008 will roll things back effectively enough to alleviate my problems? I'm just not excited about having to sit on hold with MS support for half an hour to get a hotfix because they're too darn stubborn to just post a !%@#($*&!@#($ download link.
|
|
|
|
|
If you can put together a small project that demonstrates/reproduces this as a legitimate
VS 2008 bug, I can forward it to MS for you. If it's a bug, this should be simple -
you know the symbols involved.
This issue is currently NOT reported for the VS 2008 Release Candidate, so if it's still
an issue, we should get it in there!
Also check and make sure you don't have a genuine namespace/symbol-name collision
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark,
I appreciate the offer, but it sounds like I didn't clearly express my problem and suspicions.
I am not claiming to have found a VS2008 bug. My idea is that the VS2008 INSTALLER somehow blows up my installed VS2005. The build problems occur in VS2005 -- the environment my project was created in. I have not tried porting the code over to VS2008.
There are 2 reasons I'm blaming the VS2008 installer: (1.) my project built fine before I installed 2008, (2.) on my other machine, where I have NOT installed 2008, the project continues to build fine without the aid of a hotfix (as addressed in KB922271). This seems to rule out any coding or project configuration problems.
|
|
|
|
|
Ohhh, ok. Sorry for the confusion.
I'm not sure what's up with a side-by-side install of 2008 B2 with 2005.
I never installed the B2 version.
What does the readme say about installing with 2005?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I am using Visual studio 2008, but still i have the following error.
Warning 1 warning C4945: cannot import symbol from '.\X.dll': as 'X module' has already been imported from another assembly 'Y' .\Y.dll .
I am using C++ dll in the .NET project.
Please do the needful.
Thanks and Reagrds,
Savitha
|
|
|
|
|
I need to be able to track a mouse's mmovement within a dialog that has several (10) EditBoxes. Since it would not be practical for the User to have to tab several EditBoxes to get to the one he/she wants to enter data into; the EditBoxes are not Tabed. I need to know where the User is (in what EditBox) so that the proper function call is active for the users input. This is actually a Wizard-style property page so there is no OK button to poll for; and the User is not required to use any of the EditBoxes on any given page. Hence the need to know when ther User has Started entering data in what EditBox.
Help with usable code examples would be appreciated. (Note: I am using VS 6.0 in MFC.)
A C++ programming language novice, but striving to learn
|
|
|
|
|
|
I am creating a function two string as input and return the concatenated of the string. How can i write these code. I tried but my program crashes
can any one reply for this
karthickbabu
|
|
|
|
|
String ^Str1 = "Concatenated";
String ^Str2 = "String";
String ^ConcatenatedStr = String::Concat(Str1, Str2);
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|