|
Hi Senthil,
MemoryStream^ mst = gcnew MemoryStream();
viewPictureBox->Image->Save(mst,viewPictureBox->Image->RawFormat);
//Byte BinaryImg[] = mst->GetBuffer(); <- doesnt like this line
array<unsigned char="">^ GetBuffer();
MySqlCommand^ cmd = gcnew MySqlCommand("SELECT * FROM Patient", Mycon);
cmd = gcnew MySqlCommand("INSERT INTO patient(Leftimage) VALUES" + "('"+mst+"')", Mycon);
It compiles, but it says it entered system.IO.MemoryStream !!
Im assuming it wasnt inserted correctly. Can u please tell me how to insert it in my code correctly and in the MySQL statement.
Many thanks for your help
regards
hbjs
makaveli
-- modified at 1:14 Monday 6th February, 2006
|
|
|
|
|
Hi Senthil,
MemoryStream^ mst = gcnew MemoryStream();
viewPictureBox->Image->Save(mst,viewPictureBox->Image->RawFormat);
//Byte MEDIUMBLOB= System::Char::Encoding::UTF8; // mst->GetBuffer();
cli::array<unsigned char="">^ BinaryImg = mst->GetBuffer();
It compiles ! MySQL doesnt except it like that so I need to convert Hex I think, still researching.
thanks for ur help
Regards
makaveli
|
|
|
|
|
I need somewhere to help me figure out how to store hex values. I dont think you can store the hex values as hex, but would it be possible to convert decimal values to hex values and convert the hex values to ascii values and store the ascii values as integers. If someone has an easier way let me know. Thanks
|
|
|
|
|
What are you trying to do ? Hex values and decimal values make non-sense. A value is a value and that's it. The only thing that can change is the way you REPRESENT your value: either in a decimal format, or in an haxadecimal format, ... Now, if you want to print your value in an hexadimal representation, just use sprintf, something like that:
int Value = 2000;<br />
char StringVal[50];<br />
sprintf(StringVal,"%x",Value);
|
|
|
|
|
If he is talking about storing base-10 numbers as base-16 in a text-base file such as XML, then he would reduce the size of the file at the cost of the overhead of the conversion. If the storage is a relational database then the conversion would be a waste of time.
If he is talking about storing "System::Decimal" numbers, then there is a different set of issues.
-- modified at 16:06 Friday 3rd February, 2006
|
|
|
|
|
hi,
does anybody know a function to store a registry key and value to a .reg file and an other function to restore the data of this file if necessarry ?
thanks for help
best regards
emmi
|
|
|
|
|
Hey howzit?
I downloaded source code from this artcle: http://www.codeproject.com/internet/SendTo.asp
I am not sure if its C++ code or C++.NET code but I have no idea how to even begin to compile it, but I really need to see how it works.
I have opened the file in VS 2005, what do I do now, please help, I am a newbie!
|
|
|
|
|
This is MFC.
It is class without a program and without a project.
Go to that page and look for a post "Another Way" and there you will see a C# example, and you can esaly convert from C# to C++/CLI (it is only diffrent a syntax)
|
|
|
|
|
Hey Saksida,
I did see the C# code, unfortunately that code only supports Outlook, whereas the C++.NET code is platform independent so I need to use it. Perhaps you could download the snippet and explain to me how to run it? I would really appreciate it. I have never used C++ or C++.NET before so I am like a dummy!
Regards,
David
|
|
|
|
|
Right now, C++.NET code is only platform-independant in theory.
There may be third-party framework implementations (such as Mono), but .NET basically is the only full-fledged CLI-implementation right now.
Therefore, if you want to write platform-independant code, you should try Java. If you are only after Windows and Linux flavours, you could also try Mono. I'd use Java, though, its much easier to install and maintain.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Hi Sebastian,
I think you misunderstood my question in the first place, all I wanna know is how to compile the code!?!?!?
-- modified at 4:09 Thursday 2nd February, 2006
|
|
|
|
|
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 ;-(
|
|
|
|
|
|