|
As the MessageBox comes from CWnd and CDialog is a CWnd derived class but "independant" you can try
CDialog* pDlg = (CDialog*) GetActiveWindow ();
if (pDlg->IsKindOf(RUNTIME_CLASS(CDialog)))
else
Another way to do the difference is the first member of both possibilites. By MessageBox the first member is a handler o a window hWnd , and in a DialogBox this handler is of the application instance hInstance
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi,
Thanks for ur reply.
I am trying to write a message box hook.
In that i need to differentiate the message box from other windows and dialogs.
I tried your suggestion but i could not achieve that .
I appreciate your help.
|
|
|
|
|
kuttiam wrote: Can any one tell me how to differentiate messagebox dialog from other dialogs.
MessageBox is type of dialog. but you don't need template to create it as it required by Dialog. plus a single api call i.e. MessageBox will create the message box for you!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I made this function of getting a unicode MAPI property:
LPMESSAGE msg = NULL;
wstring subj;
HRESULT hrProperty;
LPSPropValue lpPropValue = NULL;
hrProperty = HrGetOneProp(m_Message->Interface(), PR_SUBJECT_W, &lpPropValue);
if (hrProperty == S_OK)
{
subj = static_cast<wstring>(lpPropValue[0].Value.lpszW);
}
return _bstr_t(subj.c_str());
now I need the subj value for SetSubject(Subj.c_str(),codePage) from altmime however when I pass the value of subj to a string it loses it's contents(I am retrieving asian characters) it turns into ??? from the original value.
Help please,
Jj
|
|
|
|
|
monsieur_jj wrote: when I pass the value of subj to a string it loses it's contents(I am retrieving asian characters) it turns into ??? from the original value.
offcourse it will lose every thing as string can have 256 value per character and wide string have 2 power <superscript>16 values per character. so if you are using asian character set ..then work with wide string only
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
In this MFC dialog base project, I used command line arguments. I want to make my application like, when user give /silent argument from command line, only console window should be display else
normal dialog box. I used AllocConsole function in OnInitDialog function. Using that it displays both the windows viz cosole and dialog.
I used the following lines :
if (!AllocConsole())
AfxMessageBox("Failed to create the console!", MB_ICONEXCLAMATION);
please help me ...?
Regards,
Mayuresh
|
|
|
|
|
Does ShowWindow (FALSE) help when used in your dialog?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
No, ShowWindow(SW_HIDE) does not work
|
|
|
|
|
It should... but ok.
Then... what about getting the DesktopRect and moving the dialog with MoveWindow (...) or with SetWindowPos(...) outside the visible area?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Nelek wrote: It should... but ok.
he is right, SW_HIDE will not work for Dialog bix, reason behind it is that when OnIntDialog complete it call it show the Dialog Box. so you have write some other mechanism to do so.. see here http://www.codeproject.com/dialog/dlgboxtricks.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
You have access to the command line arguments at startup.
If you determine you don't want a GUI window to show then you shouldn't
show the window.
Create your main window without the WS_VISIBLE style. If you want the main
window to show, use ShowWindow(SW_SHOW).
If your main window is a modal dialog, don't call DoModal().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: If your main window is a modal dialog, don't call DoModal().
he seems to programming in OnInitDialog instead of OnInitInstance
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
hai..,
i am trying to create an MSMQ. in this i am having char* string value....now i want to convert it to LPWSTR string ...how to convert this...
is any one knows reply me....
Born to win...!
|
|
|
|
|
|
Try ::mbtowcs
And be sure to read the texts about conversion linked in that MSDN-Article.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Have you considered the A2W() macro?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
thanks for ur help dears,
i solved the issue..
Born to win...!
|
|
|
|
|
jhwurmbach wrote: Try ::mbtowcs
little correction brother:- it is mbstowcs
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi guys
How to detect cd presence in CD Drive.if any code is available that is greatful.
Thnaks in advance
RYK
|
|
|
|
|
|
see if the following logic works.
say for exmple, your CD drive is "G"
_chdir("G:");
_findfirst();//not sure about the parameters. find them out. otherwise i have to refer my backups.
if find first detects something, then, cd is available.
otherwise not.
simple.
------------------------------------------------
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
What about a Blank CD is in? :P
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
|
Nelek wrote: What about a Blank CD is in?
humm than write it
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|