Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Image DnD into Upp app
Re: Image DnD into Upp app [message #44199 is a reply to message #44189] Thu, 22 January 2015 21:18 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Hello, Mirek,

Splendid! Almost there...

...works great in Win7 now, but still does not drop jpg from MS Word into UWord in Win8.1. Test output creates a blank data.bin and this fmt LOG:
* C:\upp\out\examples\MSC9.Debug.Debug_Full.Gui.Mt\UWord.exe 22.01.2015 17:05:00, user: admin
fmt = dib

DnD jpg from File Explorer into UWord works perfectly in both OS versions.

Any hint on what to try next?

Many thanks!!!


Re: Image DnD into Upp app [message #44202 is a reply to message #44199] Fri, 23 January 2015 09:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
bushman wrote on Thu, 22 January 2015 21:18
Hello, Mirek,

Splendid! Almost there...

...works great in Win7 now, but still does not drop jpg from MS Word into UWord in Win8.1. Test output creates a blank data.bin and this fmt LOG:
* C:\upp\out\examples\MSC9.Debug.Debug_Full.Gui.Mt\UWord.exe 22.01.2015 17:05:00, user: admin
fmt = dib

DnD jpg from File Explorer into UWord works perfectly in both OS versions.

Any hint on what to try next?

Many thanks!!!




Well, looks like problem with dib... Some more logs:

Image GetImage(PasteClip& clip)
{
	GuiLock __;
	Image m;
	if(Accept<Image>(clip)) {
		LoadFromString(m, ~clip);
		if(!m.IsEmpty())
			return m;
	}
	if(clip.Accept("dib")) {
LOG("DIB accepted");
		String data = ~clip;
		if((unsigned)data.GetCount() < sizeof(BITMAPINFO)) return Null;
LOG("DIB accepted 2");
		BITMAPINFO *lpBI = 	(BITMAPINFO *)~data;
		BITMAPINFOHEADER& hdr = lpBI->bmiHeader;
		byte *bits = (byte *)lpBI + hdr.biSize;
		if(hdr.biBitCount <= 8)
			bits += (hdr.biClrUsed ? hdr.biClrUsed : 1 << hdr.biBitCount) * sizeof(RGBQUAD);
		if(hdr.biBitCount >= 16 || hdr.biBitCount == 32) {
			if(hdr.biCompression == 3)
				bits += 12;
			if(hdr.biClrUsed != 0)
				bits += hdr.biClrUsed * sizeof(RGBQUAD);
		}
DUMP(bits);
DUMP((int)hdr.biHeight);
DUMP((int)hdr.biWidth);
		int h = abs((int)hdr.biHeight);
		ImageDraw   iw(hdr.biWidth, h);
		::StretchDIBits(iw.GetHandle(),
			0, 0, hdr.biWidth, h,
			0, 0, hdr.biWidth, h,
			bits, lpBI, DIB_RGB_COLORS, SRCCOPY);
		return iw;
	}
	return Null;
}


Thanks!

Mirek
Re: Image DnD into Upp app [message #44204 is a reply to message #44202] Fri, 23 January 2015 17:07 Go to previous messageGo to next message
ManfredHerr is currently offline  ManfredHerr
Messages: 67
Registered: February 2013
Location: Germany
Member
I want to let you know that my UBUNTU 14.04 (AMD64) refuses the Drag and Drop operation as well.

A recent update of UPP brought in "reference" a DragAndDropImg. I generated an executable with "GUI" and "GCC Optimal". When I ran it I kept it in the starter. Both times, when active or only in the starter, dragging bushman's avatar to the starter lit Firefox and Gimp only, but not the unnamed application DragAndDropImg. So I can drop the image to Firefox or Gimp, but not to DragAndDropImg.
Re: Image DnD into Upp app [message #44205 is a reply to message #44202] Fri, 23 January 2015 22:14 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Mirek,

tried out your latest advice, size of accepted data does not match size of BITMAPINFO struct (data.GetCount() == 0):
* C:\upp\out\examples\MSC9.Debug.Debug_Full.Gui.Mt\UWord.exe 23.01.2015 16:02:45, user: admin
DIB accepted


Just a few Side Comments:
Maybe it's something specific to my Win8.1 installation after all. This time I also did a few tests dragging jpg from MS Word into both LibreOffice and OpenOffice Writer and they failed too, showing only blank img frames over a doc background.
Both LibreOffice and OpenOffice show context menu options to dialogs to manipulate imgs when you right-click on img frame icon. These dialog boxes however show copies of the DnDropped img thumbs, which they save in a TMP file. So I'm confused: how come the img can't be shown on document while they save and show it correctly from a TMP file?

Thank you once more, for your patience!
Re: Image DnD into Upp app [message #44206 is a reply to message #44205] Sat, 24 January 2015 11:49 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
bushman wrote on Fri, 23 January 2015 22:14
Mirek,

tried out your latest advice, size of accepted data does not match size of BITMAPINFO struct (data.GetCount() == 0):
* C:\upp\out\examples\MSC9.Debug.Debug_Full.Gui.Mt\UWord.exe 23.01.2015 16:02:45, user: admin
DIB accepted


Just a few Side Comments:
Maybe it's something specific to my Win8.1 installation after all. This time I also did a few tests dragging jpg from MS Word into both LibreOffice and OpenOffice Writer and they failed too, showing only blank img frames over a doc background.
Both LibreOffice and OpenOffice show context menu options to dialogs to manipulate imgs when you right-click on img frame icon. These dialog boxes however show copies of the DnDropped img thumbs, which they save in a TMP file. So I'm confused: how come the img can't be shown on document while they save and show it correctly from a TMP file?

Thank you once more, for your patience!


Well, let us see what word really puts there... It looks really weird, like data are truncated or not complete or perhaps contain some HANDLE...

	if(clip.Accept("dib")) {
LOG("DIB accepted");
		String data = ~clip;
DUMPHEX(data);
Re: Image DnD into Upp app [message #44207 is a reply to message #44206] Sat, 24 January 2015 15:21 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Quote:
Well, let us see what word really puts there... It looks really weird, like data are truncated or not complete or perhaps contain some HANDLE...

if(clip.Accept("dib")) {
LOG("DIB accepted");
String data = ~clip;
DUMPHEX(data);


I got no data back!
* C:\upp\out\examples\MSC9.Debug.Debug_Full.Gui.Mt\UWord.exe 24.01.2015 10:52:52, user: admin
DIB accepted
data = Memory at 0018E754, size 0x0 = 0


tks.
Re: Image DnD into Upp app [message #44211 is a reply to message #44207] Mon, 26 January 2015 19:05 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, let us try this:

String UDropTarget::Get(const char *fmt) const
{
	FORMATETC fmtetc = ToFORMATETC(fmt);
	STGMEDIUM s;
        HRESULT hr = data->GetData(&fmtetc, &s);
        DDUMP(hr); DDUMP(hr == S_OK); DDUMP(s.tymed); DDUMP(s.tymed == TYMED_HGLOBAL);
	if(hr == S_OK && s.tymed == TYMED_HGLOBAL) {
		char *val = (char *)GlobalLock(s.hGlobal);
		String data(val, (int)GlobalSize(s.hGlobal));
		GlobalUnlock(s.hGlobal);
		ReleaseStgMedium(&s);
		return data;
    }
	return Null;
}


Thanks for patience. And keep that Win installation, it is a good testing environment Smile
Re: Image DnD into Upp app [message #44213 is a reply to message #44211] Mon, 26 January 2015 21:24 Go to previous message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Quote:
Thanks for patience. And keep that Win installation, it is a good testing environment Smile

Actually, I'm just waiting for the last straw that will make me format my Win8 system. This OS version should be codenamed "Windows Nightmare" instead. Smile

Well, here we go again:
* C:\upp\out\examples\MSC9.Debug.Debug_Full.Gui.Mt\UWord.exe 26.01.2015 16:57:39, user: admin
hr = -2147221404
hr == ((HRESULT)0L) = false
s.tymed = 0
s.tymed == TYMED_HGLOBAL = false
DIB accepted
data = Memory at 0018E754, size 0x0 = 0


Tks!

Previous Topic: Context Menu request
Next Topic: rounding to decimals implementation
Goto Forum:
  


Current Time: Thu Mar 28 18:46:24 CET 2024

Total time taken to generate the page: 0.01205 seconds