|
Hey Guys,
I've been looking at things around the Internet and i'm seeing this:
String* s = S"Hello World!";
the 'S' that precedes the string, what does that do? Is it the same as the @ modifier in C#?
Thanks,
Adam
-- Adam
"If you can't beat your computer in chess, try kickboxing"
|
|
|
|
|
|
I am in a migration project of conversion of COM components written in VC ++ to either Managed VC++ or C#.
Can anyone suggest me how to proceed with this.
Client wants to the development team to use some migration tool and convert it and after that rectify some minor errors and modifications.
I tried open the VC++ project in the MS Visual Studio.Net, but when I tried to build, it didn't worked out giving multiple errors for the header files.
Please suggest as I need to give some solution at the earliest.
|
|
|
|
|
If the design was done properly it should be a simple job to remove the COM layer and replace it with a Managed class or multiple classes that expose the native C++ classe(s) of the project.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Hi,
how can i show an existing image in a c++ window. I mean i want my code to open a window and display an existing image in that window.
In a future work i will try to show an image sequence in that window.
For example, i have image001.bmp, image002.bmp,.. image016.bmp.
I want to open a window and display the images as a slide show in that window. Maybe going to the next image can be assigned to pressing a key on the keyboard. Or maybe a time feature could be used. I mean, in the window, existing images will be displayed each 0.5 seconds with the same order in the sequence.
Could someone help me with an explanatory piece of code?
Thank you ...
|
|
|
|
|
Look at the SDK documentation for the GDI function BitBlt(....)
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
i am creating one file "student.txt" with some fields, and i want to display that file with some fileds and one condition, how to?
-----------------
class student
{
char name[25];
char studentid[25];
chat city[25];
friend istream &operator>>(istream &stream, Student &st);
friend ostream &operator<<(ostream &stream, Student st);
};
ostream &operator<<(ostream &stream, Student st)
{
stream<<st.name <<"\n";
="" stream<<st.studentid="" stream<<st.city<<"\n";
="" return="" stream;
}
istream="" &operator="">>(istream &stream, Student &st)
{
stream>>st.name;
stream>>st.studentid;
stream>>st.city;
cout<<"/n";
return stream;
}
main()
{
Student stud;//student is class
fstream stu_file("Student.txt", ios::in | ios::out|ios::app);
cin>>stud;
stu_file << stud;// saveing in to the file
.........
stu_file.seekg(0, ios::beg);
while(!stu_file.eof())
{
if(!stu_file.eof())
if(stu_file.get(city) == "berlin" )
{
cout<<"Name"<
|
|
|
|
|
Hi,
I have a problem regarding embedded dlls (managed and unmanaged).. Could you help me please ?
My problem is the following..
- my target is a Pocket PC
- I want to export an unmanaged dll that I've done using Embedded Visual C++ 4.0 and wrap it with a managed dll written in C++. My unmanaged class is :
header :
--------
#ifdef UNM
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif
class DLL_API DLLUnmanaged
{
public:
DLLUnmanaged();
DLLUnmanaged(const char * const);
~DLLUnmanaged();
const char * getstring() const {return str;}
char * suffix(int n);
private:
char * str;
unsigned short len;
};
cpp:
#include <windows.h>
#include "stdafx.h"
#pragma warning( disable : 4091 )
#include "UnmanagedDLL.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
DLLUnmanaged::DLLUnmanaged()
{
str = (char *)LocalAlloc(0, sizeof(char));
str[0] = '\0';
len = 0;
}
DLLUnmanaged::DLLUnmanaged(const char * const str0)
{
len = (unsigned short)strlen(str0);
str = (char *) LocalAlloc(0, sizeof(char)*(len+1));
for(unsigned short i = 0; i < len; i++)
str[i] = str0[i];
str[i] = '\0';
}
char * DLLUnmanaged::suffix(int pos)
{
unsigned short suffix_length;
pos--;
if (pos < 0) pos = 0;
suffix_length = len - pos + 1;
if (suffix_length > 0)
{
char * suff = new char[suffix_length];
for(unsigned short i = pos; i < len+1; i++)
suff[i - pos] = str[i];
return suff;
} else
return 0;
}
DLLUnmanaged::~DLLUnmanaged()
{
LocalFree(str);
len = 0;
}
- I want to use the managed extensions of Visual Studio .Net like this :
#using <mscorlib.dll>
using namespace System;
#include <iostream>
using std::cout; using std::endl;
#include "path.../UnmanagedDLL.h"
public __gc class DLLManaged // to avoid using "DLLImport"s..
{
public:
String * find_suffix(String * s, int pos)
{
int length = s->Length;
char * in_string = new char[length+1];
for(unsigned short i = 0; i<length; i++)
{
in_string[i]="(char)s-">Chars[i];
}
in_string[length] = '\0';
DLLUnmanaged * s0 = new DLLUnmanaged(in_string);
delete [ ] in_string;
return s0->suffix(pos);
}
};
... so here is what I've done when doing it only with Visual Studio .Net. I've added to the solution (that has got the unmanaged (I took "DLL MFC") and managed (I took ".Net DLL") ) a C# windows application that simply references the managed dll. All that works fine..
but if I want to make a project like this (actually the unmanaged dll that I use is a bit more complicated that the one I gave you) for a Pocket PC I encounter a lot of problems (please don't blame me, I'm a beginner!)
I tried to do it this way. The thing is that I don't know how to make an EMBEDDED MANAGED C++ DLL...
if I do the unmanaged project with Embedded Visual C++ 4, and if I make a .Net DLL similar to the one I've given to you upper, I get errors like:
ManagedDLL error LNK2020: jeton non résolu (0A000009) _CxxThrowException
ManagedDLL error LNK2020: jeton non résolu (0A00000B) delete
ManagedDLL fatal error LNK1120: 2 externes non résolus
(sorry, I've the French version of VS .Net)
obviously the linkage goes wrong..
So..what is the thing I've to do ? could you help me please, since I'm trying to fix the problem for many days now!
thanks to pay attention to it,
Julien (IT student)
|
|
|
|
|
hi
i try to write program for installing RamDrive Driver by using SetupAPI Function , but i can't Because i have not Good Sample code or Document about SetupAPI Functions ,like SetupInstallFile and ...
please help me
mtaghiloo@yahoo.com
majid taghiloo
|
|
|
|
|
I have been racking my brain on trying to finish this homework.
I am getting an error right where I start my FOR loop. (subscript requires array or pointer type)
I don't know what I am doing wrong, I modified a working code and added my code to it, but I can't compile it. Anyone please help!!
thanks!
<br />
<br />
<br />
{ <br />
struct felix <br />
{ <br />
int empno; <br />
float wages; <br />
}; <br />
felix record; <br />
int i; <br />
FILE *main_file; <br />
main_file = fopen("master_f", "wb"); <br />
fprintf(stdout, "Enter employee numbers and wages: \n"); <br />
fprintf(stdout, "When done, enter a zero twice \n"); <br />
fscanf(stdin, " %s %f", &record.empno, &record.wages);
for(i = 0; record.empno[0] != '0'; ++i) <br />
{ <br />
fprintf(main_file, " %s %f \n", record.empno, record.wages);
fscanf(stdin, " %s %f", &record.empno, &record.wages); <br />
} <br />
fclose(main_file);
fprintf(stdout, "There were %d records entered\n", i); <br />
} <br />
|
|
|
|
|
I think you need "int" before "i = 0" in the for loop. Otherwise, "i" is undefined.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
It may be simple question but i need an urgent help.
I have to use some image sequence as the input to my code. for example:
image001.bmp
image002.bmp
image003.bmp
....
and so on. But there are 200 images and i have to use a function to read these images. How can i name a string in a for loop as I wanted?
for(int i=0;i<200;i++)
{
nextImageName = image(i).bmp
.....
}
I want the code to increase the string name as if it is a number. Could you please help me?
|
|
|
|
|
CString strFilename;
int nTotalImages = 200;
for (int nIndex=1; (nIndex <= nTotalImages); nIndex++) {
strFilename.Format ("image%03d.bmp", nIndex);
...
} /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
u can use aray of CString :
CStringArray bitmaps;
CString temp;
while(EOF)
{
temp.format("image%03d.bmp", nIndex);
bitmaps.Add(temp);
}
|
|
|
|
|
Hi All,
I have been asked to compile some existing code in C++ as a DLL, and them call it from a C# project.
I finally compiled the C++ project.
For the C# project, I added the reference using the browse button. It didn't appear under the .NET components.
I can right-click on the reference and view the object browser, but I can't create a "using" command, nor call any of the routines in the C++ dll.
What am I doing wrong?
Josh
|
|
|
|
|
You have to use the dllimport statement:
[System.Runtime.InteropServices.DllImport("mylib.dll"]
public extern void MyCplusPlusMethod();
Regards,
ElDrago.
|
|
|
|
|
Hello,
I'm have problem when i compile my thesis. When I try to build the debug version of the my program in VS.NET2003 (manage C++ project) (on windows XP,vc 7) I get:
C2906: 'PClassObject<hello>' : explicit specialization requires 'template <>'
//C:\Versant\vds605\h\cxxcls\template\pclass.h(87): error C2906: 'PClassObject<pbilink>' : explicit specialization requires 'template <>'
but when i compile in VS.NET2002 the error is :
TestDLL error LNK2001: unresolved external symbol "public: static struct PClass * __cdecl PClassObject<class hello="">::get_Pointer(void)" (?get_Pointer@?$PClassObject@VHello@@@@$$FSAPAUPClass@@XZ)
?????i don't know how it is???and i really don't know how to solve it?Please help me.
Thanks so much, nthevu
|
|
|
|
|
try to remove static before get_Pointer(void) or to use extern(but not static).
|
|
|
|
|
Hai all,
I have a basic doubt when to use the Composite Design Pattern and When to use the Builder Design Pattern.
Do anyone explain me its difference with a scenario.
With Thanks,
Arun Chakaravarthy
|
|
|
|
|
Including the Win32 headers saves a lot of work, but it requires lot of fix such as declaring each Rectangle variable as System::Drawing::Rectangle to prevent ambiguous symbol errors.
Should a MC++ coder include Win32 headers or declare everything as .NET types like in the other languages?
|
|
|
|
|
That depends on what you intend to do. If you want to use "mixed mode" and call Win32 API's directly you will have to have the headers included.
There is a known loading problem for "mixed mode" DLL's. If you are going to do one i recomend reading this article:
http://www.developer.com/net/cplus/article.php/2110291[^]
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Hello..
Does any one know how to use a managed dll in normal c++. I have written a managed dll with c++.net and i want to use it in my normal c++ project (ide c++.net 2003) Could any one tell me if its possible... or how??
Thank you in advance for taking the time to read this message
|
|
|
|
|
You cannot call managed code from unmanaged code (it violates the basic protection principles), but you could compile your c++ project to .NET.
Matt
Visual C++ FE
|
|
|
|
|
Thank you for replying, I thought that was the case, and in fact in the end i did what you suggested.
|
|
|
|
|
I have a small program that connects the computer to a printer, using WNetAddConnection2. We are running Win XP Pro with Novell Netware client. This has been working ok, but now we have a new ghost with the latest versions and service packs of some programs, including the Netware client and this is where the problem started: when the program is run the computer totally dies when calling WNetAddConnection2 -not even Ctrl + Alt + Del helps.
We have figured out that it has some problem connecting to the printer server, because if we establish a connection to the printerserver first, and then run the program it works. And it is not just WNetAddConnection2 that has problem, if we for example set current directory to the printer server or treis reading the creationdate of a folder on the printer server, the computer also 'dies'. Now what makes this really strange is that I made a small test program in C# -and that program does not have the same problem! Am I wrong to think that managed C++ and C# compiles down to essentially the same???
Any clues as to what is going wrong here are most welcome!
Thanks
/EnkelIk
|
|
|
|