|
You will need to build a project around it. As that is MFC code, you should create an empty MFC-project and insert the code into the appropiate files.
If you have no clue about C++, it would be a good idea to read a book on the topic first.
The MFC are not the easiest way to get started with C++...
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
If it is C++ code you could possible compile it in a program called Dev C++. Go to this website somewhere at the bottom and download it. http://www.bloodshed.net/dev/devcpp.html[^]. Once your in that program just open it as if it were a text document. After opened, Somewhere within the program there should be a compile and run button just click that.
|
|
|
|
|
Bolow is a very very simple copy program, that is used to copy a helloworld executable.
This program works very well on Linux and Solaris, but gives wrong results on Windows.
The size of the executable to be copied is 18920 but the program halts after coping 1760 bytes.
This happens only on Windows.
# include <stdio.h>
# include <stdlib.h>
int main()
{
FILE* fpReader = fopen("C:\\Temp\\helloworld.exe", "r");
FILE* fpWriter = fopen("C:\\Temp\\helloworld.exe.1", "w");
unsigned char buffer;
while(fread(&buffer, 1, 1, fpReader))
fwrite(&buffer, 1, 1, fpWriter);
fclose(fpWriter);
fclose(fpReader);
return 0;
}
Any help would be appreciated.
|
|
|
|
|
Try
FILE* fpReader = fopen("C:\\Temp\\helloworld.exe", "rb");
Note the extra 'b'.
I expect that the Windows fopen is opening the file in text mode, and finding a Ctrl+Z in the file data, and considering that to be end of file (see the docs on fopen for more info)
|
|
|
|
|
Hello,
IDE: VS .NET 2003.
Problem: Mangled bits of gc class embedded within native C++ class.
Description: I have a gc class, BoxedInfo. This wraps a Value type structure, NotiInfo. Basically, this structure is imported into MC++ library from a C# library.
//gc class in MC++
[StructLayout(LayoutKind::Sequential)]
[Serializable]
public __gc class BoxedInfo
{
public:
CSharpLib::NotiInfo m_Info;
BoxedInfo(CSharpLib::NotiInfo anInfo_in) : m_Info(anInfo_in) {}
CSharpLib::NotiInfo unbox() { return m_Info;}
};
//structure in C# library
public struct NotiInfo
{
public Int32 mode;
public Int32 status;
[MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_I4)]
public Int32[] list;
public Int32 state;
public UInt32 errMsgId;
}
I also have a native C++ class embedding the gc class object pointer
__nogc class CBTemplate
{
public:
CBTemplate();
void notifyGCHandle(BoxedInfo *aInfo);
virtual void notify()=0;
protected:
gcroot<<boxedinfo*>> m_BoxedInfo;
};
When accessed the bits of m_BoxedInfo from native client, the bits were mangled.
When safearray type member in imported structure was commented, everything seemed to be working.
Can you please throw some light on this problem?
If possible Can you please suggest a book that covers C++ Interop issues?
I read on some MSDN articles about the boundary differences in memory layout between managed and native types. Is the mangled memory problem due to improper marshaling? Do I have to do custom marshaling to get around this problem?
Can you please provide an example solution/sample solution link for this problem?
Many Thanks & Best Regards,
-- modified at 15:16 Wednesday 1st February, 2006
|
|
|
|
|
I try to create documentation with NDoc, but i also want that the documentation contains the private managed class (ex. private ref class (new syntax)). I have try the code like this :
///
///This is the sample class.
///
private ref class X
{
};
I have turn on the option XML documentation on project properties, so every time i build it also create the xml file. But then i open the xml file, it doesn't have any xml tag for class X. Am I missing some option or I need to setup something else ???
Thanks.
Simple mind programmers, I don't need a complicated mind.
|
|
|
|
|
please help me:
i have to create an extension for thunderbird not for firefox so i want tutorial for how to create extension and use this.
reply me ASAP.
Bankey Khandelwal
Software Engineer
bankey.khandelwal@solversa.com
|
|
|
|
|
hello everyone.
I need to include a few lines of asm code (crc32 routine) in c++ code. I tried asm(" asm-code-here");, or _asm { ... }, or __asm__ { ...} but none had worked.
The asm code is:
asm ("push esi ;
push edi ;
mov eax, dwCrc32 ;
mov ecx, [eax];
mov edi, Crc32Table ;
lea esi, buf ;
mov ebx, length ;
lea edx, [esi + ebx] ;
crc32loop:
xor eax, eax ;
mov bl, byte ptr [esi] ;
mov al, cl ;
inc esi;
xor al, bl ;
shr ecx, 8 ;
mov ebx, [edi + eax * 4];
xor ecx, ebx ;
cmp edx, esi ;
jne crc32loop ;
pop edi ;
pop esi ;
mov eax, dwCrc32 ;
mov [eax], ecx");
P.S. i tried adding a \ character to each end of line, or make a long line out of it, but i couldn't even compile it.
Please help.
|
|
|
|
|
From memory, in the MS compilers i think you can use inline asm by typing "_asm" where you want to start the assembly, and then "asm_" at the end
it may be the other way around though lol
|
|
|
|
|
the keyword is __asm { ... } (two underscores...)
with gcc, also try this (a little search on google might have help you) :
asm ("pushl %eax\n\t"
"movl $0, %eax\n\t"
"popl %eax");
ps: this is the C++/CLI forum, ,so only Managed C++ questions should be asked here...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
-- modified at 8:27 Tuesday 31st January, 2006
|
|
|
|
|
i tried that out , but didn't work. i even added -masm=intel on the command line but it turned out of no use. That is i don't really like/know at&t (% stuff) conventions, so i preffered to stick with intel. When i use __asm, or asm or _asm_ or __asm__, i get the same error: "syntax error before '}' ... " . i dug in google results, but i didn't worked it out yet ;-(
|
|
|
|
|
|
i tried that too. whith one big string, like
asm ("mov eax, ebx"
"lea ..."
"xor eax, eax"), or like
asm ("mov ... ; \
lea .... ; \
") I tried without the semicolon too, but didn't work ;-(
|
|
|
|
|
|
Can someone tell me some simble code which add my program into startup registry.(english isn`t my first language )
|
|
|
|
|
hyyppa wrote: an someone tell me some simble code which add my program into startup registry
neither mine. And you are not alone in this?
String ^exePath = Application::ExecutablePath;
if ((Registry::GetValue("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "Program Name", ""))->Equals(""))
{
Registry::SetValue("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "Program Name", exePath, RegistryValueKind::String);
}
else
MessageBox::Show("Already in Registry");
-- modified at 16:02 Monday 30th January, 2006
|
|
|
|
|
Thousands thanks for you
|
|
|
|
|
This is a part of project.. can i get help in this project !!
:((
Exercise 1:
A server that echoes client input
You are required to produce client and server programs based on the procedures DoOperation , GetRequest and SendReply (see CDK3 Section 4.4). These operations have been simplified so that client and server exchange messages consisting of strings. In Exercise 2, you will put the arguments of DoOperation (such as the procedure identifier) into a request message.
The client and server behave as follows:
Client: this takes the name of the server computer as an argument. It repeatedly requests a string to be entered by the user, and uses DoOperation to send the string to the server, awaiting a reply. Each reply should be printed out.
Server: repeatedly receives a string using GetRequest, prints it on the screen and replies with SendReply. The server exits when the string consists of the single character `q'.
Use the following (or equivalent C) definitions for Status and SocketAddress , which are in C++.
--------------------------------------------------------------------------------
enum Status
{ Ok, // operation successful
Bad, // unrecoverable error
Wronglength // bad message length supplied
};
typedef sockaddr_in SocketAddress;
--------------------------------------------------------------------------------
Implement DoOperation, GetRequest and SendReply. The recommended prototypes are given in the definitions in the appendices. In the C++ definitions they are included in the classes Client and Server . The Status value returned reflects the values returned by UDPsend and UDPreceive (see below).
DoOperation
sends a given request message to a given socket address and blocks until it returns with a reply message.
GetRequest
receives a request message and the client's socket address.
SendReply
sends a reply message to the given client's socket address.
UDPsend and UDPreceive
The procedures DoOperation, GetRequest and SendReply must use two procedures UDPsend and UDPreceive to be written by you, which respectively send and receive a message over/from a socket. You are to implement these functions using the system calls sendto and recvfrom.
Each procedure returns a value of type Status which reports on the success of its execution. For example, if the sendto or recvfrom system calls return negative values, your procedures should return a Status value of Bad.
UDPsend
sends a given message through a socket to a given socket address.
UDPreceive
receives a message and the socket address of the sender into two arguments.
Use the recommended definitions for SocketAddress and Message and the recommended prototypes for UDPsend and UDPreceive. In the C++ defintions, the latter are to be found in class Socket.
Choosing a server port
You will want to run server processes that can coexist with other people's processes in the same computer. You need to select an agreed port number for the server to receive messages from clients. Two servers on the same computer cannot use the same local port number. You will therefore want to choose a port number that is sure to be different from other people's port numbers. If everybody takes the first unreserved port number and adds their uid, there should be no such clashes - i.e. :
aPort = IPPORT_RESERVED + getuid() ;
How unreliable are datagrams?
As part of this exercise, you should design an experiment to find out whether you can cause datagrams to be dropped. Describe the experiment and discuss its results in a comment in your client program.
please don't forget to help me
|
|
|
|
|
|
realy .. i neeeeeeed help quickly
heeeeeeeeelp help
|
|
|
|
|
|
|
|
|
You really think that people here will do your homework for you ?
Did you even try to get started ?
We can help you if you post SPECIFIC QUESTIONS. So, start to work it out and when you are stuck ask a question.
|
|
|
|
|