Laden...

Profil von Trivalik

myCSharp.de - Member Mitglied seit
T
Trivalik
myCSharp.de - Member
26
Themen
125
Beiträge
Dabei seit
29.12.2005
Letzte Aktivität
vor 14 Jahren
Erstellt vor 17 Jahren

Du meinst in eine Hidden TextBox. Da kann man nicht reinklicken. Du kannst die HTML Seite analyisieren und das mit POST oder GET schicken, so wie es die Webseite wollte. Klappt zwar komischerweise auch nicht immer, aber in den meisten. Kommt auf die Webseite an.

Erstellt vor 17 Jahren

Prinzipiel gehts ganz einfach, mal per Google zusammengesucht.


[DllImport("user32.dll")]
static extern bool InvertRect(IntPtr hDC, [In] ref Rectangle lprc);

		[DllImport("user32.dll")]
static extern IntPtr GetWindowDC(IntPtr hWnd);

[DllImport("user32.dll")]
		static extern bool InvalidateRect(IntPtr hWnd,IntPtr lpRect, bool bErase);
[DllImport("user32.dll", EntryPoint = "ReleaseDC")]
		public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("user32.dll", EntryPoint = "GetDesktopWindow")]
		public static extern IntPtr GetDesktopWindow();
		public void inv()
		{
			Rectangle workArea = Screen.PrimaryScreen.WorkingArea;
			IntPtr d = GetDesktopWindow();
			// Desktop repaint, gegen schlieren
			InvalidateRect(IntPtr.Zero, IntPtr.Zero, true);

			// Desktop erfassen
			IntPtr dc = GetWindowDC(d); 
			// Invertieren 
			InvertRect(dc, ref workArea);
			// DC wieder freigeben 
			ReleaseDC(d, dc);
		}

Das müsstest du dann per Timer aufrufen lassen. Ist zwar net gerade effizient aber es geht. Auch ohne Adminrechte.

Erstellt vor 17 Jahren

Das nennt man allgemein Spline (mehrere an einander gereite Kurvenstücke). Speziel gibt es in Graphics DrawBezier. Man brauch nur 4 Punkte um eine Kurve zu bestimmen. Nur weis ich nicht was du mit sanft meinst. Kurve ist Kurve 🙂

Erstellt vor 17 Jahren

@dr4g0n76

Ich meine das zwei Zeilen das selbe tun.


public void Test()
        {
            // Get a Graphics object associated with the screen.

            bm = new Bitmap(this.m_strPath);
            this.pictureBox1.Image = bm;
        }

Hab nun eine Lösung gefunden, die einzige im Netz🙂


public void CaptureControl(PictureBox dstPic,Bitmap srcBmp)
		{
			Bitmap dstBmp = new Bitmap(dstPic.Image);
			// Src anpassen
			Graphics gSrc;
			Graphics clientDC = this.CreateGraphics();
			IntPtr hdc = clientDC.GetHdc();
			IntPtr memdc = CreateCompatibleDC(hdc);
			SelectObject(memdc, srcBmp.GetHbitmap());
			gSrc = Graphics.FromHdc(memdc);
			clientDC.ReleaseHdc(hdc);


			Graphics gDst = Graphics.FromImage(dstBmp);
			// dst anpassen

			IntPtr dcSrc = gSrc.GetHdc();
			IntPtr dcDst = gDst.GetHdc();


			BitBlt(dcDst, 0, 0, 100, 100, dcSrc, 0, 0, TernaryRasterOperations.SRCCOPY);
                                                DeleteDC(memdc);
			gSrc.ReleaseHdc(dcSrc);
			gDst.ReleaseHdc(dcDst);
                                                DeleteObject(hBmp)
			pictureBox1.Image = dstBmp;
                                 }

Ich finde es zwar komisch das man die PictureBox noch zuweisen muss, aber naja es geht so erstmal. Damit schein nun diese Funktion auch der Flaschenhals geworden zu sein, obwohl diese die schnellste sein sollte 😦

P.S. Ich benutze eine Funktion die wie oben und noch Argumente die ich an BitBlt weiterleite um weniger im Code ändern zu müssen.

Erstellt vor 17 Jahren

Danke, das geht wirklich!

Edit:
Seh grad das da beschissen wurde, das geladene Bitmap wird einfach der PictureBox zugewiesen. Wenn ich BitBlt auskommentiere passiert das selbe! Also leider keine Lösung!

Erstellt vor 17 Jahren

Die Signaturen sind hier aus dem Forum und von pinvoke.


/// <summary>
///    Performs a bit-block transfer of the color data corresponding to a
///    rectangle of pixels from the specified source device context into
///    a destination device context.
/// </summary>
/// <param name="hdc">Handle to the destination device context.</param>
/// <param name="nXDest">The leftmost x-coordinate of the destination rectangle (in pixels).</param>
/// <param name="nYDest">The topmost y-coordinate of the destination rectangle (in pixels).</param>
/// <param name="nWidth">The width of the source and destination rectangles (in pixels).</param>
/// <param name="nHeight">The height of the source and the destination rectangles (in pixels).</param>
/// <param name="hdcSrc">Handle to the source device context.</param>
/// <param name="nXSrc">The leftmost x-coordinate of the source rectangle (in pixels).</param>
/// <param name="nYSrc">The topmost y-coordinate of the source rectangle (in pixels).</param>
/// <param name="dwRop">A raster-operation code.</param>
/// <returns>
///    <c>true</c> if the operation succeeded, <c>false</c> otherwise.
/// </returns>
[DllImport("gdi32.dll")]
static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth,
  int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, TernaryRasterOperations dwRop);


		public enum TernaryRasterOperations:uint
		{
			SRCCOPY = 0x00CC0020, /* dest = source*/
			SRCPAINT = 0x00EE0086, /* dest = source OR dest*/
			SRCAND = 0x008800C6, /* dest = source AND dest*/
			SRCINVERT = 0x00660046, /* dest = source XOR dest*/
			SRCERASE = 0x00440328, /* dest = source AND (NOT dest )*/
			NOTSRCCOPY = 0x00330008, /* dest = (NOT source)*/
			NOTSRCERASE = 0x001100A6, /* dest = (NOT src) AND (NOT dest) */
			MERGECOPY = 0x00C000CA, /* dest = (source AND pattern)*/
			MERGEPAINT = 0x00BB0226, /* dest = (NOT source) OR dest*/
			PATCOPY = 0x00F00021, /* dest = pattern*/
			PATPAINT = 0x00FB0A09, /* dest = DPSnoo*/
			PATINVERT = 0x005A0049, /* dest = pattern XOR dest*/
			DSTINVERT = 0x00550009, /* dest = (NOT dest)*/
			BLACKNESS = 0x00000042, /* dest = BLACK*/
			WHITENESS = 0x00FF0062, /* dest = WHITE*/
		};

		[DllImport("gdi32.dll", ExactSpelling = true)]
		internal static extern IntPtr CreateCompatibleDC(IntPtr hdc);
		[DllImport("gdi32.dll", ExactSpelling = true)]
		internal static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
		[DllImport("gdi32.dll", ExactSpelling=true)]
        internal static extern bool DeleteObject( IntPtr hgdiobj);

Hab nun mal in dem Support Artikel von MS gestöbert. Diese Funktioniert auch nur ist mir nicht klar warum in bitblt hdcScreen und hdcCompatible benutzt werden obwohl doch beides vom Desktop Fenster abstammen!


IntPtr hdcScreen = GetDC(GetDesktopWindow());
			IntPtr hdcCompatible = CreateCompatibleDC(hdcScreen);

Seh ich richtig das GetDC der Win32 das selbe ist wie GetHdc von Graphics?

Kann es sein das es ein Problem gibt wenn mein Bild 24 Bit RGB ist, da im Deskop Beispiel 32 BitRGB rausgekommen ist.

Erstellt vor 17 Jahren

Hi, ich portiere gerade ein altes Projekt. Dieses arbeitet mit BitBlt. Da DrawImage zu langsam ist, und mir die Zeit fehlt mich da reinzuarbeiten wollt ich die BitBlt Funktion wieder nehmen. Mein Problem ist egal was ich BitBlt gebe es kommt immer schwarz heraus!


private void button1_Click(object sender, EventArgs e)
		{
			Bitmap b = new Bitmap(m_strPath);


			if (pictureBox1.Image == null)
			{
				pictureBox1.Image = new Bitmap(b.Width, b.Height, b.PixelFormat);
			}

			Graphics bmp = Graphics.FromImage(b);
			Graphics pic = Graphics.FromImage(pictureBox1.Image);
			Graphics form = this.CreateGraphics();

			IntPtr bmpHdc = bmp.GetHdc();
			IntPtr picHdc = pic.GetHdc();
			IntPtr frmHdc = form.GetHdc();

			IntPtr bmpDC = CreateCompatibleDC(bmpHdc);
			IntPtr picDC = CreateCompatibleDC(picHdc);
			IntPtr frmDC = CreateCompatibleDC(frmHdc);


			
			IntPtr hbmOld = SelectObject(bmpDC, b.GetHbitmap());

			// auf pic
			bool bpic = BitBlt(picDC, 0, 0, b.Width, b.Height, bmpDC, 0, 0, TernaryRasterOperations.SRCCOPY);
			// auf Form
			bool bfrm = BitBlt(frmDC, 0, 0, b.Width, b.Height, bmpDC, 0, 0, TernaryRasterOperations.SRCCOPY);


			SelectObject(bmpDC, hbmOld);

			DeleteObject(bmpDC);
			bmp.Dispose();
			pic.Dispose();
			form.Dispose();

			Text = bpic.ToString() + " - " + bfrm.ToString();
		}

Leider funktioniert das so nicht. Farbe ist 24Bit RGB, doch das kann es doch net sein. Das gleiche Ergebnis bekommt ich wenn ich einfach vom Graphics das Hdc übergebe. Bitblt bringt immer true zurück!

Der unterschied zwischen der obigen und er nur Hdc Version:

  • die only Hdc Version ist Form und PictureBox schwarz
  • die CreateCompatibleDC Version ist auf der Form unverändert und in der Picturebox schwarz

Ich hoffe Ihr habt auch das Problem, um mir zu helfen!

Erstellt vor 17 Jahren

Auf http://www.fun-soft.de/showtopic.php?threadid=18936 wird gemeint das hier die Header Cpp Trennung nicht für Templates gilt.

Kann das jemand bestätigen.

Erstellt vor 17 Jahren

Hi,

ich habe eine Klasse geschrieben und wollte diese in ein Template umwandeln, gesagt getan. Doch danach ging das teilen in mehrere Dateien nicht mehr!

Fpu.h


# ifndef _FPU_H_
# define _FPU_H_

template <class T, int P>
class Fpu
{
public:

	Fpu();
};
#endif

Fpu.cpp


#include "Fpu.h"

template <class T, int P>
Fpu<T,P>::Fpu()
{
}

Wöllt ich nun Fpu<int,3> k; schreiben kommt immer der Fehler:

Fehler 1 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __cdecl Fpu<int,3>::Fpu<int,3>(void)" (??0?$Fpu@H$02@@QAA@XZ)" in Funktion "WinMain". Main.obj

doch schreib ich alles in den Header gehts! Ist das bei Templates allgemein so?

Erstellt vor 17 Jahren

scheine eine lösung gefunden zu haben:

./definition/property[@name='Type' and @value='A' and count(../object) = 0]/../property[@name='Bmp' and @value=20]

Kann das jemand bestätigen, vom denken her?