Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Servus!

Also, folgende Problematik.

Ich hab in einem Dialog Drag and Drop implementiert,

schön und hübsch,

man kann den Dialog anfassen wo man will und ihn mit der Maus umherschieben.

Nun will ich eine Klasse schreiben,im moment heist sie noch

CMyDialog

in der ich alles einbau, die ganzen Messages abfang die ich brauch, usw.

am Ende soll das dann so funktionieren, dass wenn ich in einem anderen Dialog das Drag&Drop brauch, dass ich meinen anderen Dialog nicht von CDialog sondern von CMyDialog ableite...

...nun sobald ich die DoModal() aufruf, knallt es herzlich!

Hat einer eine Ahnung? Hier der Quelltext:

Der Header:

#if !defined(AFX_MYDLG_H__B90982E8_B955_4733_9D60_18EC9067E669__INCLUDED_)

#define AFX_MYDLG_H__B90982E8_B955_4733_9D60_18EC9067E669__INCLUDED_


#include "stdafx.h"


class CMyDialog : public CDialog

{

public:

	CMyDialog(UINT, CWnd*);

	virtual void DoDataExchange(CDataExchange * pDX);

	virtual int DoModal();

protected:

	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);

	DECLARE_MESSAGE_MAP()

};


#endif
und hier die CPP
 

#include "MyDialog.h"


void CMyDialog::OnLButtonDown(UINT nFlags, CPoint point) 

{

	MessageBox("test");

	CDialog::OnLButtonDown(nFlags, point);

}


CMyDialog::CMyDialog(UINT nID, CWnd* pWnd)

{

	CDialog::CDialog(nID, pWnd);

}


void CMyDialog:: DoDataExchange(CDataExchange *pDX)

{

	CDialog:: DoDataExchange(pDX);

}


int CMyDialog:: DoModal()

{

	return CDialog:: DoModal();

}


BEGIN_MESSAGE_MAP(CMyDialog, CDialog)

	//{{AFX_MSG_MAP

	ON_WM_LBUTTONDOWN()

	//}}AFX_MSG_MAP

END_MESSAGE_MAP()

Das ist etz nur zum testen, das Drag&Drop is noch net drin,

nur eine messagebox sobald der benutzer auf den Dialog klickt...

...hat jemand eine Ahnung?

JO

Original geschrieben von ffGebaeck

...nun sobald ich die DoModal() aufruf, knallt es herzlich!

So eine Fehlerbeschreibung wünscht sich der Programmierer ;-)

Im Ernst, was genau passiert denn?

Access Violation?

Debug Assertion?

Tip: Wenn Du die MFC-Sourcen installierst, dann kannst Du CDialog::DoModal debuggen und genau sehen, wo er wegknallt.

Klotzkopp

Erst mal würde ich einen Konstruktur und einen virtuellen Destruktor (notwendig wenn nur eine virtuelle Funktion in der Klasse ist) in CMyDialog reinsetzen - das könnte schon ausreichen. DoModal würde ich einfach mal nicht überschreiben und schauen was dann passiert.

Okokok!

Meine Fehlerbeschreibung war a bissle mager,

dafür kommt etz gleich die Lösung dafür,

also der Konstruktor war falsch,

folgendermassen muss der Konstruktor aussehn:


CMyDialog::CMyDialog(UINT nID, CWnd* pParent) : CDialog(nID, pParent)

{

}

dann klappts auch mit dem Nachbarn :)

Nun steht meiner grossartigen Klasse

CDragDialog ja nix mehr im wege.........

.... oder? ;)

JO

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.