Click here to Skip to main content
15,899,124 members
Home / Discussions / C#
   

C#

 
AnswerRe: Collecting code-snippets Pin
schoetbi26-Nov-07 10:19
schoetbi26-Nov-07 10:19 
AnswerRe: Collecting code-snippets Pin
Paul Conrad26-Nov-07 16:02
professionalPaul Conrad26-Nov-07 16:02 
AnswerRe: Collecting code-snippets Pin
Johan Martensson26-Nov-07 20:12
Johan Martensson26-Nov-07 20:12 
QuestionBitBlt from minimized / not visible form ? Pin
gordon2426-Nov-07 9:04
gordon2426-Nov-07 9:04 
AnswerRe: BitBlt from minimized / not visible form ? [modified] Pin
Skippums26-Nov-07 10:05
Skippums26-Nov-07 10:05 
GeneralRe: BitBlt from minimized / not visible form ? Pin
gordon2427-Nov-07 4:52
gordon2427-Nov-07 4:52 
GeneralRe: BitBlt from minimized / not visible form ? Pin
Skippums27-Nov-07 6:33
Skippums27-Nov-07 6:33 
GeneralRe: BitBlt from minimized / not visible form ? Pin
gordon2427-Nov-07 15:48
gordon2427-Nov-07 15:48 
Aaaah, JEFF.

It took me that long to figure out you also responded to my previous posts.
[ see here[^] ]

Well, i spent the day getting things working.

First of all, to pay some credit to the post / repsonse mentioned above, that snippet
didn't work 'out of the box', it had to be modified to this to get it working:

   <br />
       RECT rc;<br />
   GetClientRect(hWnd, &rc);<br />
   HDC trgDC = GetDC(hWnd);<br />
<br />
   System::IntPtr _srcDC = iForm.getHDC();  // iForm.CreateGraphics()->GetHdc();<br />
   HDC srcDC = (HDC)_srcDC.ToPointer();<br />
   <br />
   BitBlt(trgDC, 0, 0, rc.right, rc.bottom, srcDC, 0, 0, SRCCOPY);<br />
   ReleaseDC(hWnd, trgDC);<br />


This is mainly due to the C# dll delivers no HDC, but IntPtr instead, which, as you
can see above, can simply be casted to HDC. [ Which took me ages to find out. ]

"iForm" is a wrapper i wrote for the C# class in the .Net ddl i'm using:
[ This also allows me to have the class being global in C++ context, which is
impossible for 'native' managed objects. (using the /clr directive) ]

class IMEMFormWrap<br />
{<br />
private:<br />
    gcroot<IMEMForm ^>  _iForm;<br />
<br />
public:<br />
    IMEMFormWrap()<br />
    {<br />
        _iForm = gcnew IMEMForm();<br />
    }<br />
    <br />
	IntPtr getHDC()<br />
	{<br />
		return _iForm->CreateGraphics()->GetHdc();<br />
	}<br />
<br />
// (...)<br />
<br />
};


And for my 'bitblting hidden window / form / whatever to plug-in space' struggles:
Well, it did work for me using a bitmap backbuffer in the C# dll.

Everything that is of concern for the plug-in to show is cloned to that bmp object
which is then continuously grabbed from the C# dll via wrapper and bitblted to
the plug-in space.

Well, at this point, my concern is to clean up my C# .Net code,
[ making all the debug and dirty stuff go away ( 'sh*t-be-gone' (tm) ) ]
putting all useful things into a 'new' dll.

And then there's some concern about performance.
I'm glad, i know there is a LOT of space for some speed improvements in
my previous code, so i'm sanguine it can be sped up to some extend.

Plus i'll have to set up some [maybe bidirectional] communication
between the plugin and the C# dll, involving the evaluation and
reaction to user events [ mouse move and so on ].

Also, i've encountered some memory leakage in the plug-in bitblting parts ...
well, i'll also have to dive into GDI and HDC usage as well.

Still a lot of work to be done.

But, at least, things are going forward.
GeneralRe: BitBlt from minimized / not visible form ? Pin
Skippums28-Nov-07 4:50
Skippums28-Nov-07 4:50 
GeneralRe: BitBlt from minimized / not visible form ? Pin
gordon2413-Dec-07 0:14
gordon2413-Dec-07 0:14 
GeneralRe: BitBlt from minimized / not visible form ? Pin
Skippums13-Dec-07 6:41
Skippums13-Dec-07 6:41 
QuestionValues on Form 2 appears on Form 1 !!!! Pin
Phoenix_p326-Nov-07 8:55
Phoenix_p326-Nov-07 8:55 
AnswerRe: Please ignore this !!!! [modified] Pin
SABhatti26-Nov-07 9:45
SABhatti26-Nov-07 9:45 
GeneralRe: Please ignore this !!!! Pin
Pete O'Hanlon26-Nov-07 10:54
mvePete O'Hanlon26-Nov-07 10:54 
GeneralRe: Please ignore this !!!! Pin
SABhatti26-Nov-07 11:56
SABhatti26-Nov-07 11:56 
AnswerRe: Values on Form 2 appears on Form 1 !!!! Pin
Colin Angus Mackay26-Nov-07 10:03
Colin Angus Mackay26-Nov-07 10:03 
GeneralRe: Values on Form 2 appears on Form 1 !!!! Pin
Anthony Mushrow26-Nov-07 11:11
professionalAnthony Mushrow26-Nov-07 11:11 
AnswerRe: Values on Form 2 appears on Form 1 !!!! Pin
Pete O'Hanlon26-Nov-07 10:46
mvePete O'Hanlon26-Nov-07 10:46 
QuestionC# documentation Pin
kaminem26-Nov-07 7:35
kaminem26-Nov-07 7:35 
AnswerRe: C# documentation Pin
Peter Vertes26-Nov-07 9:02
Peter Vertes26-Nov-07 9:02 
AnswerRe: C# documentation Pin
Judah Gabriel Himango26-Nov-07 9:03
sponsorJudah Gabriel Himango26-Nov-07 9:03 
Questionhow to convert xls to csv ? Pin
E_Gold26-Nov-07 7:27
E_Gold26-Nov-07 7:27 
AnswerRe: how to convert xls to csv ? Pin
pmarfleet26-Nov-07 8:18
pmarfleet26-Nov-07 8:18 
GeneralRe: how to convert xls to csv ? Pin
E_Gold27-Nov-07 8:39
E_Gold27-Nov-07 8:39 
GeneralRe: how to convert xls to csv ? Pin
pmarfleet27-Nov-07 9:08
pmarfleet27-Nov-07 9:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.