I just found a C# example for creating a word document using OpenXML format which I've linked below. Can you please help me write the same in C++/CLI or suggest me any links where I can find c++\cli openxml sdk creating a word doc examples or any tutorial related to this.
Rather you write code to produce that. In either C++ or C#.
The basic format is XML. So any C++ library that allows you to output XML would assist you in writing XML allows you to do that.
Actually for the tutorial link given you do not even need a library. One can use simple output statements.
And that should be sufficient if you understand how to program in C++ and have a basic understanding of XML and are willing to learn the standard for OpenXML.
If not then you have a different problem. You certainly can't do anything if you do not have a basic grasp of C++. To use OpenXML you do need a basic understanding of XML and if you do not have it then attempting OpenXML is NOT the way to start. Additionally that is not the only way to create a Word doc if that is your actual requirement.
If you have Windows 7 Ultimate or Enterprise, you can install the 'Subsystem for Unix-based Applications' (SUA) which you get a Windows compatible gcc compiler with g++ and all the Unix/Linux goodies. You will have to re-compile your C++ file in this new Posix environment for it to run in Windows.
1. Recode it so it is a windows code, and then recompile. This could be a lot of work or little work depending on what the executable does.
2. Find/write a simulator/virtual machine that 'runs' an execuble from the targeted system on windows.
3. Create a server that runs on a linux box. It runs the executable. It has a communications API. Your Windows app talks to that server.
In the above 2 is probably the most difficult solution by far.
Hi, I'm traying to use Berkeley DB in C++/CLI with /clr mode. I wrote two applications, one will store to a database and another one will try to read the contents of that database, but i failed in doing that!
This the first code (first app) for writing to a database:
#include "stdafx.h"#pragma comment(lib,"libdb51")
int main(array<System::String ^> ^args)
unsigned int oFlags= DB_CREATE;
wchar_t* a=( wchar_t* )Marshal::StringToHGlobalUni(HexSig).ToPointer() ;
wchar_t* A=( wchar_t* )Marshal::StringToHGlobalUni(HexSig).ToPointer();;
int ret= SigDb.put(NULL,&key1,&data1, DB_NOOVERWRITE);
Console::WriteLine("You are trying to insert an exist key!");
and this is the second code for reading from the database:
always the second app says "Not found"! On the other hand when i tried to write the same data twise in the database using the first code, it says "You are trying to insert an exist key!" and that proves that the data was written! Any idea pls!
hello i'm trying to convert this piece of code from vb
Private Structure IconInfo
Public fIcon As Boolean
Public xHotspot As Int32
Public yHotspot As Int32
Public hbmMask As IntPtr
Public hbmColor As IntPtr
<DllImport("user32.dll", EntryPoint:="CreateIconIndirect")> _
Private Shared Function CreateIconIndirect(ByVal iconInfo As IntPtr) As IntPtr
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function DestroyIcon(ByVal handle As IntPtr) As Boolean
Public Shared Function DeleteObject(ByVal hObject As IntPtr) As Boolean
Public Function CreateCursor(ByVal bmp As Bitmap) As Cursor
'Setup the Cursors IconInfo
Dim tmp As New IconInfo
tmp.xHotspot = _gHotSpotPt.X
tmp.yHotspot = _gHotSpotPt.Y
tmp.fIcon = False
If _gBlackBitBack Then
tmp.hbmMask = bmp.GetHbitmap(Color.FromArgb(0, 0, 0, 0))
tmp.hbmColor = bmp.GetHbitmap(Color.FromArgb(0, 0, 0, 0))
tmp.hbmMask = bmp.GetHbitmap()
tmp.hbmColor = bmp.GetHbitmap()
'Create the Pointer for the Cursor Icon
Dim pnt As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(tmp))
Marshal.StructureToPtr(tmp, pnt, True)
Dim curPtr As IntPtr = CreateIconIndirect(pnt)
'Save the image of the cursor with the _gBlackBitBack effect
'Not really needed for normal use.
'I use it to create a screen shot with the gCursor included
_gCursorImage = Icon.FromHandle(curPtr).ToBitmap
Return New Cursor(curPtr)
the problem is that i get the following error and i don't know how to get it solved:
error C2665: 'System::Runtime::InteropServices::Marshal::SizeOf' : none of the 2 overloads could convert all the argument types
1> c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll: could be 'int System::Runtime::InteropServices::Marshal::SizeOf(System::Object ^)'
1> c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll: or 'int System::Runtime::InteropServices::Marshal::SizeOf(System::Type ^)'
1> while trying to match the argument list '(test_cursor::IconInfo)'
error C2664: 'System::Runtime::InteropServices::Marshal::StructureToPtr' : cannot convert parameter 1 from 'test_cursor::IconInfo' to 'System::Object ^'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
I've created an application using Managed C++. I've created a setup file using Visual Studio Deployment Project. In the "Dependencies" properties of the ".exe" and "Active Project Output", there is one entry called "Microsoft .NET FrameWork". What to do to run the setup on a machine where Visual Studio and .NET Framework is not installed? Do I need to install .NET Framework at all the machines where I install my setup file?
I am facing a strange problem with the existing code. it suddenly started failing. The problem happens only in one of the machines, while the same code works in other machines.
It fails at the below line.
obj1 = new _objifptr(_uuidof(objif));
I did check that __uuidof returns the correct uuid. but fails when "new _objifprt" is called. The .dll, .tlb and .pdb are all available in the working directory. They have been registered using regasm successfully.
I see that the errors thrown are
FileLoadException followed by TypeInitializationException.