|
Hi i have issue that i created one dialog as CGraphconf and then i invoke this dialog by using button.It works properly and i configured the things.I have 2 more dialogs of this kind.So, i planned to combine these three in to propertypage.So, i did.But assertion error occurs in DoModal() of propertySheet class.
Just i commented all the things in OnInitDialog() in CGraphconf.
Then it works properly.When i remove this comments it again give assertion error.BOOL CGraphPageConf::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CString GStr;
CComboBox cb1,*cb2,*cb3;
cb1 = (CComboBox*)GetDlgItem(IDC_BOXDETAIL1);
cb2 = (CComboBox*)GetDlgItem(IDC_BOXDETAIL2);
cb3 = (CComboBox*)GetDlgItem(IDC_BOXDETAIL3);
GStr="EMPTY";
cb1->AddString(GStr); cb2->AddString(GStr);
cb3->AddString(GStr);
ReadGraphicsPageConfigFile();
if(goGroupList.IsEmpty())
ReadGroupDataBase();
if(OTrendList.IsEmpty())
ReadTrendDataBase();
POSITION Pos=goGroupList.GetHeadPosition();
while(Pos)
{
GStr.Format("GROUP%02d",((CGroupInfo *)goGroupList.GetAt(Pos))->GetGroupNo());
cb1->AddString(GStr);
cb2->AddString(GStr);
cb3->AddString(GStr); goGroupList.GetNext(Pos);
}
Pos=OTrendList.GetHeadPosition();
while(Pos)
{
GStr.Format("TREND%02d",((CTrendInfo *)OTrendList.GetAt(Pos))->GetPageNo());
cb1->AddString(GStr);
cb2->AddString(GStr);
cb3->AddString(GStr); OTrendList.GetNext(Pos);
}
return TRUE; }
This is that OnInitDialog() function in my dialog.
|
|
|
|
|
When you get the assertion, look at the stack trace and see which line in your code is causing it.
|
|
|
|
|
CGraphconf
You must change style of template Dialog is Child
example:
class Yourclass: public CPropertyPage
{
DECLARE_DYNCREATE(CQuanLy)
// Construction
public:
enum { IDD = IDD_DIALOG1};
....
}
Properties of IDD_DIALOG1, in Style is Child.
Huynhnb
.: Your success is also me :.
|
|
|
|
|
Hello all,
after reading a file from an usb stick in my win2000 application, it is
impossible to remove / eject the stick via left click on the systray icon.
The file handle for reading is closed, but as i see in task manager, lots of
handles are opened on the way to the read.
I use Windows 2000 and Visual C++ 6.0.
Who knows help?
thx in advance!
|
|
|
|
|
oh, i forgot to mention:
after closing the app, the stick can be removed as ever. The problem only
exists as long as the app runs.
|
|
|
|
|
Hmm. Are you using something like a file open dialog to select the file, or is the path passed some other way (hardcoded, command line param, etc)?
It's possible the removal fails because the app has the stick as a current directory.
Steve S
Developer for hire
|
|
|
|
|
yes, i used a file dialog!
Thank you very much, i will try out, but i think thats the solution!
|
|
|
|
|
I am writing a C++ class. In the constructor I create a WNDCLASSEX WndClsEx structure. I want to pass a method of the class as a parameter to the WndClsEx.lpfnWndProc function (WndClsEx.lpfnWndProc = MyWindowProc;). The compiler gives me an error. Do you know how I can solve the problem?
Thank you!
modified 9-Mar-17 17:18pm.
|
|
|
|
|
|
The error I get is:
error C2440: '=' : cannot convert from 'long (__stdcall CDrawingControl::*)(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'
Thank you!
modified 9-Mar-17 17:17pm.
|
|
|
|
|
how did u declared the "MyWindowProc" funtion?
nave
|
|
|
|
|
Daniel Kanev wrote:
error C2440: '=' : cannot convert from 'long (__stdcall CDrawingControl::*)(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'
add STATIC in front of that function!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
It works fine, thanks!
modified 9-Mar-17 17:16pm.
|
|
|
|
|
Is the method in the class (MyWindowProc) a static method? If not you have a mismatched calling convention.
|
|
|
|
|
It works, thank you!
modified 9-Mar-17 17:17pm.
|
|
|
|
|
See here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How do I set up a two way communication between two classes?
Lets say I have Class A and Class B . Now, Class A must be able to call functions of Class B and Class B must be able to call functions of Class A .
Is it possible?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
Hakuna-Matada wrote: ets say I have Class A and Class B. Now, Class A must be able to call functions of Class B and Class B must be able to call functions of Class A.
FORWARD Decalartion is the key to your Question!
eg
class a;
class b{
public:
a aObj;
};
class a
{
public:
b bObj;
};
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Yes it's possible, but you'll have to seperate declaration from implementation:
In .h:
<br />
class A;<br />
class B;<br />
<br />
class A<br />
{<br />
public:<br />
B* m_pB;<br />
<br />
void callB();<br />
void doSomething();<br />
};<br />
<br />
class B<br />
{<br />
public:<br />
A* m_pA;<br />
<br />
void callA();<br />
void doSomething();<br />
};<br />
In .cpp:
void A::callB()<br />
{<br />
m_pB->doSomthing();<br />
}<br />
<br />
void A::doSomething()<br />
{<br />
}<br />
<br />
void B::callA()<br />
{<br />
m_pA->doSomthing();<br />
}<br />
<br />
void B::doSomething()<br />
{<br />
}<br />
Usage:
A a;<br />
B b;<br />
<br />
a.m_pB = &b;<br />
b.m_pA = &a;<br />
<br />
a.callB();<br />
b.callA();<br />
Pretty generic, hope that helps.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Hakuna-Matada wrote: Is it possible?
In addition to Steve's suggestion, the methods that you wish to invoke could be made static . That way, a class does not have to contain an instance of the other.
class A
{
public:
static fooA();
};
class B
{
public:
static fooB();
}; Now in class A 's methods, you can call B::fooB() , and in class B 's methods, you can call A::fooA() .
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hey guys.
What do you recommend as the quickest method of finding duplicate values in a list of items or array.
These item type could be numeric or (in this case) a string.
In the past I've used the technique of inserting the items in an stl set. This would immediately flag if you are trying to insert the same item again. But this can get slow if I have a large list of items to wade through.
Are there any other techniques that you guys are using?
I Dream of Absolute Zero
|
|
|
|
|
If your list is sorted, you could use a binary search http://en.wikipedia.org/wiki/Binary_search[^].
If not sorted, you'll have to scan the entire list/array for duplicates. Re-creating your list, just to determine if there are duplicates, would not be the most efficient way to do it - just run a loop over the original list/array.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thanks. I'll do a quick sample test project to check the speed between the two methods.
The std::set insertion technique works fine (just finished the coding), but I suspect that it is not the fastest way of doing this.
I Dream of Absolute Zero
|
|
|
|
|
Hi all,
I crated a new dialog called IDD_RIPORTO.
I also added a class called riporto.
If i do:
riporto temp;
temp.DoModal();
everything is ok, but if i do:
riporto* temp = new riporto();
temp->Create(IDD_RIPORTO,this);
the application runs but crashes at runtime
when the above code is executed.
If i do:
CDialog *temp = new CDialog();
temp->Create(IDD_RIPORTO,this);
everything goes well but of course
i have no access to riporto data members,
so i think this isn't the correct way.
Where i go wrong ?
Thank you so much,
Deamo16.
|
|
|
|
|
Desmo16 wrote: riporto* temp = new riporto();
temp->Create(IDD_RIPORTO,this);
Read the article in MSDN regarding modeless dialog.
It clearly say that, you need customized contructor to create that dialog.
the default constructor of you dialog class calls CDialog(IDD); to initialize the dialog with template.
Desmo16 wrote: temp->Create(IDD_RIPORTO,this);
you are trying to create on already created object. So it wont work.
define you own contructor to create modeless dialog. never allow contructor to create dialog with template if you are looking for a modeless dialog.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
<blink>My Blog | Understanding State Patte
|
|
|
|