|
Hi,
I have a application that opens a dialog box called TestSettings from the menu. On the dialog box is a button called 'Start' with the message handler 'onstart'. what I want to do is when i click start I want the dialog box to hide and then another one comes up called WordBegin and then a couple of seconds later I want the WordBegin dialog to hide and a second dialog called EPGAnalysis to appear. I have tried the code for the onStart message handler below but the EpgAnalysis dialog box wont dissapear unless i close the WordeBegin dialog. How can I do it so that it automatically hides after a couple of seconds and displays the second box??
My code:
void CTestSettings::OnStart()
{
ShowWindow(SW_HIDE);
CWordBegin dlgWordBegin(this);
int nRetCode = dlgWordBegin.DoModal();
ShowWindow(SW_SHOW);
int x,y;
for(x = 0; x < 2000; x++)
{
for(y = 0; y < 30000; y++)
{
}
}
ShowWindow(SW_HIDE);
CEpgAnalysis dlgEpgAnalysis(this);
int nRetCode2 = dlgEpgAnalysis.DoModal();
ShowWindow(SW_SHOW);
}
Thanks a lot in advance
|
|
|
|
|
First of all, if you want a delay, use Sleep or a Timer, this loop is eating processor time for no good reason and will run different times on different processors.
Second, the problem I would say is that one is a child of the other. Give the second one no parent and I am guessing it will work fine.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
DoModal() doesn't return until you close the dialog. You can either have the dialog close itself (use a timer and call EndDialog() in OnTimer) or make it modeless so the parent window can close it.
--Mike--
Rollin' in my 5.0
With the rag-top down so my hair can blow.
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
i'm not very experienced in visual c++ so how would i used the OnTimer and EndDialog functions?
|
|
|
|
|
Create a timer with the SetTimer function in your OnInitDialog handler.
Create an OnTimer handler that calls EndDialog.
|
|
|
|
|
I'm using the dialog boxes in an MDI application so where is the onInitDialog handler????
|
|
|
|
|
You need to override the WM_INITDIALOG message. For a CDialog derived class this will be a virtuial function called OnInitDialog. First call the base class function, then do your stuff, then return TRUE.
Nish
Oh, I don't know why she's
leaving, or where she's gonna go
I guess she's got her reasons but I just don't wanna know
'Cos for 24 years I've been living next door to Alice
24 years just waitin' for a chance
To tell her how I feel and maybe get a second glance
Now I gotta get used to not living next door to Alice
|
|
|
|
|
Hi,
Can anyone offer me any advice, I have an image file in memory, not disc. And would like to load into a GDI+ Bitmap or Image Object.
Seen this business about IStream, but can someone offer me a few pointers.
Cheers
Rich
|
|
|
|
|
You see i don't want to do it through writting out a temporary file.
|
|
|
|
|
If your image file is only a bitmap then use this Bitmap constructor:
Bitmap::Bitmap(gdiBitmapInfo, gdiBitmapData)
Creates a Bitmap object based on a BITMAPINFO structure and an array of pixel data.
Bitmap(
const BITMAPINFO* gdiBitmapInfo,
VOID* gdiBitmapData
);
If you would like to create the stream from the image file that you have loaded into memory, you will first need to make sure that that memory was allocated with this function GlobalAlloc then you can call this function CreateStreamOnHGlobal in order to create a stream object that is initialized with your image data.
Just make sure to call the Release method on the IStream interface that it returns to you.
|
|
|
|
|
Much appreciated!
What happens if the operation is in reverse and I am svaing a bitmap to the stream. Do i just have to make sure i have a globalalloc big enough. Any ideas?
Thanks Again
Rich![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
I'm looking for a working sample that demonstrates how to show a tracking tooltip. What I'm trying to do is manually show a balloon tooltip pointing at a static control in a dialog. AFAICT my code matches what's in MSDN, but I've had no luck.
Here's what I have so far, it's your standard MFC dialog:
BOOL CTipTestDlg::OnInitDialog()
{
m_tip.Create ( this, TTS_BALLOON );
TOOLINFO ti = { sizeof(TOOLINFO), TTF_TRACK|TTF_ABSOLUTE, GetSafeHwnd(),
IDC_LABEL, {0}, NULL, LPSTR_TEXTCALLBACK };
m_label.GetWindowRect ( &ti.rect );
ScreenToClient ( &ti.rect );
m_tip.SendMessage ( TTM_ADDTOOL, 0, (LPARAM) &ti );
m_tip.SendMessage ( TTM_SETTITLE, 1, (LPARAM) "Title here" );
m_tip.Activate(TRUE);
} I want the tip to appear when I click OK:
void CTipTestDlg::OnOK()
{
CRect rc;
TOOLINFO ti = { sizeof(TOOLINFO), TTF_TRACK|TTF_ABSOLUTE, GetSafeHwnd(), IDC_LABEL,
{0}, NULL, LPSTR_TEXTCALLBACK };
m_label.GetWindowRect ( &ti.rect );
ScreenToClient ( &ti.rect );
m_label.GetWindowRect(rc);
m_tip.SendMessage ( TTM_TRACKACTIVATE, TRUE, (LPARAM) &ti );
m_tip.SendMessage ( TTM_TRACKPOSITION, 0, MAKELONG(rc.left, rc.top) );
} No matter what I try, the tooltip never appears. When I flip the flags to make it a regular tooltip, it works, so I know my tip-related code is OK. It's just the track activate/track position part that I'm stuck on.
--Mike--
Rollin' in my 5.0
With the rag-top down so my hair can blow.
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Hi Michael, I know close to zero about tracking tooltips, but found this article about them with seemingly good stuff on the subject. First thing that caught my eye is the guy sends the two messages TTM_TRACKPOSITION and TTM_TRACKACTIVATE in reversed order than you. Could this make a difference?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
I have a few classes I want to put in a DLL. These class and resources uses other side classes. Now, if I include these side classes with the main classes, and then in my prohgram that I want to link the DLL to also have these classes (because they are like CButtonXX and other types) what will happen?
How should I be strcuturing something like this? All my classes and dialogs rely on the same inherited Button, label ect classes. So the big if is if I have TWO DLL that has two diff ... that both rely on these side classes. Now what will happen if I want to link them to a project?
Thanks in advance.
|
|
|
|
|
My guess is you won't have any problem with the scenario you describe, apart from some bloat due to the duplication of CButtonXX code. For added safety, make sure none of the classes exported has any method inline (i.e. defined inside the class declaration), so you will rest asure each part uses its own CButtonXX instantiation.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Without changing anything I can no longer compile. It looks like I'm missing some library or something. Does anyone have any ideas? Here's my error messages.
nafxcwd.lib(strcore.obj) : warning LNK4006: "void __stdcall
SerializeElements(class CArchive &,class ATL::CStringT<char,class
StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > *,int)"
(?SerializeElements@@YGXAAVCArchive@@PAV?$CStringT@DV?$StrTraitMFC@DV?$ChTra
itsCRT@D@ATL@@@@@ATL@@H@Z) already defined in CCrystalTextHelper.obj; second
definition ignored
CCrystalTextHelper.obj : error LNK2019: unresolved external symbol
"protected: class CMap<int,int,unsigned long,unsigned long>::CAssoc *
__thiscall CMap<int,int,unsigned long,unsigned
long>::GetAssocAt(int,unsigned int &,unsigned int &)const "
(?GetAssocAt@?$CMap@HHKK@@IBEPAVCAssoc@1@HAAI0@Z) referenced in function
"public: int __thiscall CMap<int,int,unsigned long,unsigned
long>::Lookup(int,unsigned long &)const " (?Lookup@?$CMap@HHKK@@QBEHHAAK@Z)
CrystalEditorColorsDlg.obj : error LNK2001: unresolved external symbol
"protected: class CMap<int,int,unsigned long,unsigned long>::CAssoc *
__thiscall CMap<int,int,unsigned long,unsigned
long>::GetAssocAt(int,unsigned int &,unsigned int &)const "
(?GetAssocAt@?$CMap@HHKK@@IBEPAVCAssoc@1@HAAI0@Z)
SyntaxOptions.obj : error LNK2001: unresolved external symbol "protected:
class CMap<int,int,unsigned long,unsigned long>::CAssoc * __thiscall
CMap<int,int,unsigned long,unsigned long>::GetAssocAt(int,unsigned int
&,unsigned int &)const " (?GetAssocAt@?$CMap@HHKK@@IBEPAVCAssoc@1@HAAI0@Z)
CrystalEditorColorsPropPage.obj : error LNK2001: unresolved external symbol
"protected: class CMap<int,int,unsigned long,unsigned long>::CAssoc *
__thiscall CMap<int,int,unsigned long,unsigned
long>::GetAssocAt(int,unsigned int &,unsigned int &)const "
(?GetAssocAt@?$CMap@HHKK@@IBEPAVCAssoc@1@HAAI0@Z)
CCrystalTextHelper.obj : error LNK2019: unresolved external symbol
"protected: class CMap<class ATL::CStringT<char,class StrTraitMFC<char,class
ATL::ChTraitsCRT<char> > >,char const *,class CKeywordList *,class
CKeywordList *>::CAssoc * __thiscall CMap<class ATL::CStringT<char,class
StrTraitMFC<char,class ATL::ChTraitsCRT<char> > >,char const *,class
CKeywordList *,class CKeywordList *>::GetAssocAt(char const *,unsigned int
&,unsigned int &)const "
(?GetAssocAt@?$CMap@V?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@AT
L@@PBDPAVCKeywordList@@PAV3@@@IBEPAVCAssoc@1@PBDAAI1@Z) referenced in
function "public: class CKeywordList * & __thiscall CMap<class
ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> >
>,char const *,class CKeywordList *,class CKeywordList *>::operator[](char
const *)"
(??A?$CMap@V?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@PBDPAV
CKeywordList@@PAV3@@@QAEAAPAVCKeywordList@@PBD@Z)
Thanks.
|
|
|
|
|
Hmmm, have you tried a "Rebuild All"?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
yes - i've tried it. i've even reinstalled vc7 but i think i'm not linking to some library that should be. i don't know what's happened. it's like my lib is gone - the problem is, i'm not sure which lib it is.
|
|
|
|
|
Hello, the codegurus around the world.;)
Error message says that you can compile the code, but not link the library
needed.
So, try to check your setting of how to find the library path and so on.
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
dear all,
how can i restrict multiple instance of
an exe?
please.......
anju
|
|
|
|
|
Run it on a very small computer...
... or, check J.M.Newcomers (IIRC) exellent article (here on CP), or, search this forum for CreateMutex and you'll get some tips.
|
|
|
|
|
ROFLMAO
<centre>
"Never tell people how to do things. Tell them what to do, and they will surprise you with their ingenuity." - General George S. Patton Jr.
|
|
|
|
|
No - seriously - this Newcomer guy is good!
|
|
|
|
|
Create a named mutex object when your app starts up. In your second app, if another mutex exists with that name, then exit the program. This is how VB implements their version of this.
|
|
|
|
|