|
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
|
|
|
|
|
I've noticed that Outlook Express has a very nice compose message window. Wow, It supports
writting you're messages and inserting images and all that great stuff. Nah, its not hard to
write you're own compose mail window supporting the user dragging and dropping images in and
changing font exactly like Microsoft Word and a million other applications...
I am still trying to write my own content view that can support displaying HTML and at the same time allowing it to be activly editable. I tried using the WebBrowser control.. I figured i could
draw a blinking cursor on top of it when it is being editted and then just insert HTML code
relative to what the user is typing.. (ugly code), and as i stated above i tried doing it the bare skeleton code way designing my own HTML display and edit engine from scratch. WOW, AM I CRAZY?
Alright. The question i have is how to accomplish my feat - or am i already or have tried doing it the right way?
[btw] If no replys i'll spend many weeks writting an entire HTML display/edit engine..
------------------------------ editted -----------------------------------
I'm adding a link to a zip file that contains my solution for building a engine that is
able to display text and picture content and other stuff so that anyone wanting to figure
out what i am doing or mabye they could use the content engine.
http://www.freewebs.com/joshmcguire/TMLE.zip
Thats the method i am currently working on to create a mail edit view capable of converting
HTML into it's .NET object format that can be editable. (The edit part is just now being coded).
I hope someone has a easier, quicker, and better way soon.
|
|
|
|
|
Dear forum members,
An object of a managed class (written in C#) is passed to the
clipboard during drag&drop operation. The object has to be
dropped on to a MFC view (written in VC++ .Net).
How do I create/access my object from the COleDataObject
which I get while 'Droping' into a view ?
Is there any other way to do this ?
[Hope I have explained my problem well ...]
Thanks in advance.
svkr.
|
|
|
|
|
i want to implement a firewall in a simplest way
with ability off packet filtering and blocking port
i am a c# programmer and i couldnt do this in c#
if there is a any api for processing a packets in windows please help me
if i want to this with combining manged and unmanaged c++ code what can i do?
koosha
|
|
|
|
|
http://winpcap.polito.it/ - Go there and find the development documentation.
I have used it to capture packets before using C++. However, i do not know if they yet support capturing packets from a modem. I am also unsure if it can allow you to block packets from coming in. Its the best help i can offer.
if i want to this with combining manged and unmanaged c++ code what can i do?
This will require most likely using unmanaged and managed code, however, it is not too hard?
Just, implement as little as possible in unmanaged to talk with the dll for the packet driver.
|
|
|
|
|
Hello, and thanks for reading my post hopefully you can help me.
My problem is i need code or a control that is native with low-overhead using Microsoft Visual C++ .NET that allows a user to add images and text. Exactly like a wordpad, however, it needs to also be able to display (and edit). It seems quite simple but i need to display HTML code. I took a look at the
RichTextBox control and choked, it seemed to have a complicated format for storeing the images and text formatting.. I was hopeing to be able to write
a function that takes a argument of HTML code and convert this into some
cordinates for the text and images (supporting only basic HTML) and use the
System::Drawing2D to draw the text but i run into a problem.
I can not figure out a way to tell how long in pixels or whatever how
long the string will be when it is written out onto the picturebox or form.
Graphics * g = this->CreateGraphics();
g->DrawString( ... blah .. blah , 10, 10 );
No, way i can know where to start drawing my image if for instance i had something like.
"blah blah blah [img src=...]"
btw: This is for the compose form of my mail application. So user can write their email, insert images, and view emails.
|
|
|
|