|
Hi,
AS you know already we have option called Use Managed Extensions in MFC ActiveX VC++.Net project property to enable the programmers to use managed namespace like System.. etc. Im enabling this option to write Socket Programming and write listner code as like follows,
System::Net::Sockets::TcpListener * pTcpListener;
--------
-------
Is it right/good practice? or is will it create any issues after a while.
|
|
|
|
|
Yes can do it this way. in facat this is one of the feature microsoft provides for VC++ developers. We can mix unmanaged code with managed and the reverse as well.
chers..milton kb
|
|
|
|
|
Anybody please send me a code of searching of a keyword in all files and folders and displaying file names containing that keyword in c++ or in qt 3.3.2
malya
-- modified at 5:35 Monday 29th May, 2006
|
|
|
|
|
use System::IO::Directory::Getfiles or FindFirstfile and Findnextfile recursively for iterating the directories and files.
Then read content of files into an STL string/ System::String^ and call Find() method to chk for the string.
or else you can use the grep utility under the hood.
rgds...Milton KB
|
|
|
|
|
Anybody please send me a code of how to concatenate 2 .wav files with different frequencies in c++ or in qt3.3.2
malya
-- modified at 5:32 Monday 29th May, 2006
|
|
|
|
|
I have a software implemented in java which i have to plugin into MS Word....so it helps in word searching??????
Does MS word provide plugin for java ????? if so hw do i go about doing it???
i have the same software plugged in Acrobat reader, which is in C++???
please tell me which will be more easier to implement????
where can access the source code of MS word API??
ismail
|
|
|
|
|
Hi,
I am trying to convert a managed String^ to a LPCTSTR, but not having much luck. I have tried the following (filename is my String^ variable):
LPCTSTR lpFilename = static_cast<LPCTSTR>(Marshal::StringToHGlobalAnsi(filename).ToPointer());
Marshal::FreeHGlobal(static_cast<IntPtr>(const_cast<void*>(static_cast<const void*>(lpFilename))));
Unfortunately, lpFilename ends up pointing at nonsense. I think that it is pointing to the beginning of the managed string and not the actual string data. I think that I need to offset the pointer to the start of the actual string data since the managed string contains some extra stuff at the beginning?
I had this working under .net 1.1 but everything changed under 2.0. Here is my code under .net 1.1:
const Byte *bp = reinterpret_cast<const Byte*>(filename);
if(bp != 0)
{
unsigned int offset = RuntimeHelpers::OffsetToStringData;
bp += offset;
}
const Char* cFilename = reinterpret_cast<const Char*>(bp);
char* bitmapFilename = static_cast<char*>(Marshal::StringToHGlobalAnsi(cFilename).ToPointer());
Marshal::FreeHGlobal(bitmapFilename);
Any help would be greatly appreciated.
zenzero
|
|
|
|
|
zenzero wrote: LPCTSTR lpFilename = static_cast(Marshal::StringToHGlobalAnsi(filename).ToPointer());
IF you build this with unicode support this won't work as LPCTSTR will point to wide string but StringToHGlobalAnsi return's an ANSI string. If you want unicode string then use StringToHGlobalUni and if you want to build using both ANSI and UNICODE then use StringToHGlobalAuto.
-Saurabh
|
|
|
|
|
Thank you so much.
It's amazing how such a little thing can cause so much trouble!
Regards,
zenzero
|
|
|
|
|
Hi,
I have an ActiveX control and i am using it in my managed C++. What happens is when ever i am compiling my client application i need to crete interops by using Aximp exe and manually copy it to my bin directory is there any way to automate this like post build script. Like when ever i'm compiling my client application interops need to created automatiocally and that sould be copied in the bin directory.
|
|
|
|
|
You can wrap this in a script and set it to be run as a post-build event.
To do that, check out Project->Properties->configuration Properties->Build Events->Pre-Post-Build Event
gmileka
|
|
|
|
|
CString *str = ASCIIEncoding::GetString (resultArray);
I am working in VC++.Net; when i was trying to use the above statement to convert the unsigned character array to string i am getting
error C2352: 'System::Text::ASCIIEncoding::GetString' : illegal call of non-static member function
How to resolve this.
|
|
|
|
|
Create an instance of ASCIIEncoding and then use GetString from that object.
|
|
|
|
|
|
In recent days I have been investigating SSPI for a C# .NET remoting app that I have do for work. I came across the Microsoft sample SSPI dll which written in C++.
Has anyone sucessfully built it using Visual Studio 2005? If so how? I keep getting a build error and can't find any reference on how to fix it either by casting or using a different API. It does build with VS 2003.
The error is as follows
error C2440: '=' : cannot convert from '__const_Char_ptr' to 'wchar_t __pin *'
in
pwszServerPrincipalName = PtrToStringChars(serverPrincipalName);
where:
wchar_t __pin* pwszServerPrincipalName = NULL;
and
serverPrincipalName is a String * passed into the ClientContext(...) method.
Otherwise if someone could point me in the right direction I would be most grateful. I need to perform a simple authentication of the client which includes licence check, hence the need for custom authentication.
Thanking you advance.
Happy programming!!
|
|
|
|
|
Isn't always the way? You ask a question because you're at a loss at what to do and within the hour or so you are made to feel real small cause you find the answer.. "why didn't I look in that place in the first instance you think."
Anyway the answer is here
http://support.microsoft.com/default.aspx?scid=kb;EN-US;311259
Happy programming!!
|
|
|
|
|
Hi,
I'm going to start learning C++/CLI after the next 2 weeks. As a beginner thought to myself I need to be fammilier with COM before starting . But learning COM will take a long time (I think).
Could some one guide me please:
Is it better to learn (basic) COM before .Net CLI, or there is no need?
//This is not a signature
while (I'm_alive) {
printf("I Love Programming");
}
|
|
|
|
|
Depending on your goal of learning C++/CLI.
You can think of C++/CLI as a language/technology just like C# - which means you don't have to learn COM to be able to write meaningful applications.
However, in many cases, the reason people learn C++/CLI is to cross between the native and managed worlds... So, this means that the user need to understand their native code base and what technologies it is relying on to make the decision on what to learn...
So, I think you won't 'have to' to learn COM unless you have some native C++ code that relies on COM... And for most native applications this is the case...
The "Pro Visual C++/CLI and the .NET 2.0 Platform" book by Fraser and published by Apress is a good start...
gmileka
|
|
|
|
|
Thanks alot.
So, I think it's better to start with CLI now and forget COM unless it was needed.
//This is not a signature
while (I'm_alive) {
printf("I Love Programming");
}
|
|
|
|
|
|
Hi Nishant and thanks.
I already read 'A first look at C++/CLI' (forgot to vote then) and gave a 5 now (after 2 years!)
As a newbie I should say your articles are great alone, but together, well I need a more essential starter! Some thing to start with .net basics and it's usages for a c++ developers, benefits and how to impelements, all together. I think I need to read a book.
And, It's funny, you wrote most of the articles in C++/CLI. Author Nishant Sivakumar and I'm still scrolling ...
//This is not a signature
while (I'm_alive) {
printf("I Love Programming");
}
|
|
|
|
|
Hamed Mosavi wrote: well I need a more essential starter!
I am writing a book on C++/CLI now for Manning Publications. See my sig for more info. It'll be another 4 months before the book will become available though.
Regards,
Nish
|
|
|
|
|
|
Hamed Mosavi wrote: However I'll probably can't buy that:
Don't you have banks in Iran that issue credit cards? Even in India, we've had them for decades now.
Regards,
Nish
|
|
|
|
|
Hamed Mosavi wrote: From your signature, I found that out already and added a comment there;)
Yep, saw that.
Regards,
Nish
|
|
|
|