SVG.DLL Bitmap to unmanaged code - svg

I have acquired the .NET SVG.DLL and written a test harness to see if this DLL will solve an SVG problem I have, and in fact it has. Now ... for this BIG hurdle, I need to marshall or return the Bitmap, Image, or what ever is easiest method back to the main C++ code that needs the Bitmap.
Can anyone please help.
Al Harper

Well I seemed have have finally figure out how to get bitmap from managed to unmanaged cpp code. In short I used the HBITMAP handle retrieved in the managed code, then re hydrated a bitmap in the CPP code from it.
Let me know if anyone wants a code snippet.
Al Harper

Related

CMultiReportTemplate assert

Sorry about the short title, but I honestly can't get a better description of what is happening because I don't know enough...
Some background first, I am "converting" a multi-byte application to support unicode and I've made the standard char/string wchar_t/wstring changes and the my code is building without problems.
What happens is that when the application is being initialized it hits an assert when it registers the applications's document templates. The code is the standard
CMultiDocTemplate* pRepDocTemplate = NULL;
pRepDocTemplate = new CMultiDocTemplate(IDR_DIAGNOSTIC_REPORT_TYPE,
RUNTIME_CLASS(CDiagnosticReportDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CDiagnosticReportView));
and CDiagnosticsReportView has the standard DECLARE_DYNCREATE and IMPLEMENT_DYNCREATE in the header and source.
The assert is at doctmpl.cpp line 29 (mfc120ud.dll - at least is using the correct dll), but I can't find the source code anywhere to actually know what is happening.
The inheritance tree is pretty straightforward:
CDiagnosticReportView
\->CReportViewBase
\->CXTPReportView
\->CView
CXTPReportView is part of a framework that we are using which is provided by Codejock (Codejock extreme toolkitPro). From the build pane I know that it's linking against it's unicode debug dll (ToolkitPro1631vc120UD.dll)
Suffice to say that in the multibyte configuration this problem doesn't occur.
The project is configured to use the UNICODE character set (Project properties->Configuration Properties->General->Character Set).
Any help would be appreciated!
Thanks in advance!
It all had to do with the fact that I was linking against the non UNICODE build of Codejock. Even though I saw a reference to the UNICODE dll, the lib wasn't the correct one!
Problem was solved when I opened my eyes ;)

PCL Visualizer demo interaction customization crashing on spinonce

I'm trying to get the PCL Visualizer demo examples to work (all code here: http://pointclouds.org/documentation/tutorials/pcl_visualizer.php) for Windows, PCL 1.6, 32 bits version.
It works fine except for the Interaction Customization part, which is ironically the one i'm most interested on. An unhandled exception occurs at the spinOnce(100) line on the main method. From the long search I've done, it looks like it is deeply connected to VTK not being thread safe and keyboard/mouse callbacks interfering with the VTK window. However, I don't think I've completely understood this and could be mistaken. I have found a very similar question here in stackoverflow (using "pcl::visualization" in different threads from different instance of a class) and I tried using scoped_locks around the spinonce, as he suggests, but I think I'm not doing it right.
Has anyone managed to fully use this example on win32? For reference, here is my poor attempt at locking the spinonce:
while (!viewer->wasStopped ())
{
boost::mutex vis_mutex; //storage for static lock
boost::mutex::scoped_lock lock(vis_mutex);
viewer->spinOnce ();
boost::this_thread::sleep (boost::posix_time::microseconds (100000));
}
Thanks in advance!
I am afraid that it may be related to the version of PCL.
Tutorials are made to match latest versions of PCL and since 1.6 things might have changed.
I recommend you to update to the latest PCL from github. (actually I use code from this tutorial on win64 right out of the box, no issues)

Java Card program using GPJ

So I was tasked to create a java client to communicate with java card.
Right now I can authenticate, write and read data using javax.smartcardio but having a bit of trouble trying to upload cap file and install it.
So after googling around, I found that I can use gpj as a library and use it in my java application to upload and install the cap file.
The problem is I can't find any documentation for gpj and I can't understand the code without one.
Here's one that I have trouble to understand public void installAndMakeSelecatable(AID paramAID1, AID paramAID2, AID paramAID3, byte paramByte, byte[] paramArrayOfByte1, byte[] paramArrayOfByte2)
Even when I look on the other part of the code, I can't find out the last parameter since all that use these method will pass null.
So if anyone know where can I find the documentation, I would be really glad. Or better yet, another library that can upload cap file and have some documentation with it.
so far, I've found gpj,jpcsc,jcManager and opal.
Nevermind, it seems that I'm not a clever guy.
For future reference, you can find out what to pass to what method by looking through the main method of the Global Platform Services class. For parameter that you are not sure what to pass, just use null.

Mono.Cecil Modifying the RVA of a method

I would like to modify the RVA of a method using Mono.Cecil. I noticed a similar question asked back in 2007 but is this doable in 0.95?
For eg: methodA.RVA = 0x1234;
I understand Mono.Cecil compute and write RVA during compilation but
are there anyways to go about modifying the RVA?
It can be done using CFF explorer though.
Thank You.
No this is not possible: that's simply not the goal of Mono.Cecil.
Cecil let you read, modify and write the managed code and metadata, but when it comes to the PE file organization, that's considered an implementation detail.

Getting a hDib from a CBitmap*

I have a Bitmap* (this is Visual C++ 6.0).
I need to save this Bitmap* to a bmp file. I've seen code on the internet that allows me to do this if I have an hDib. (handle to Dib). Given that I already have a CBitmap*, how can I obtain the hDib?
Or, if someone has an easier way to save a bitmap to a file, that would be great too. (This is VC++ 6.0 (1998) and I don't (think) I have access to CImage.
I'm going to assume you're actually asking about CBitmap and not Bitmap, as they're two different things.
CBitmap derives from CGdiObject, which has a member m_hObject that contains the handle.
It also has an operator HBITMAP which returns the handle - all you have to do is a cast.
HBITMAP hbmp = (HBITMAP) mybitmap;
Whether this handle is a DIB or not will depend on how you created the bitmap.

Resources