|
Set your dialog as its parent .
int MessageBox( HWND hWnd (Set it as your dialog handle),
LPCTSTR lpText,
LPCTSTR lpCaption,
UINT uType
);
Regards,
FarPointer
|
|
|
|
|
Sorry i'm unfamiliar with how to create or use a handle. Could you please show me how to?
Thanks in advance
|
|
|
|
|
Hi,
Please try this out:-
m_hWnd :- this is the handle of the dialog
MessageBox(m_hWnd,"AM I Working");
Regards,
FarPointer
|
|
|
|
|
If you are using MFC, you can do the following:
CMyDialog::OnButton()
{
::MessageBox(m_hWnd,
"Your message text goes here",
"Caption for your message box",
(MB_OK | MB_ICONINFORMATION));
} In this case, CMyDialog is the name of your dialog class, derived from CDialog (which is in turn derived from CWnd ). One of the members of all CWnd -derived objects is m_hWnd , which is the window handle.
Software Zen: delete this;
|
|
|
|
|
I've just tried m_Hwnd as follows:
<br />
::MessageBox(m_hWnd,"This is the LAST record","Last Record",MB_ICONINFORMATION | MB_SYSTEMMODAL);<br />
But its still not coming to the front. Could there be something else wrong?
|
|
|
|
|
Kinda off topic...
Don't use MB_SYSTEMMODAL unless you absolutely have to. It prevents the user from doing anything else on the computer other than interact with your message box. It's an exceptionally good way to cause extreme frustration and loss of confidence in your product...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks for the information ... i'll sure take it into account
|
|
|
|
|
braveheartkenya wrote: ::MessageBox(m_hWnd,"This is the LAST record","Last Record",MB_ICONINFORMATION | MB_SYSTEMMODAL);
You can try this one...
MessageBox(_T("This is the LAST record"), _T("Last Record"), MB_ICONINFORMATION | MB_SETFOREGROUND);
Since you are using MFC you don't have to use m_hWnd here. MFC does that for you.
Nibu thomas
Software Developer
|
|
|
|
|
It didn't work, but i got another that did.
Replace the MB_SETFOREGROUND with MB_DEFAULT_DESKTOP_ONLY.
I don't know what it means, but it brings it on top and freezes the dialog. Any idea how i can bring it to the front but not freeze the dialog?
|
|
|
|
|
I just generate a owner-drawen class from CListBox, and I want to set the item text only in DrawItem function. If CListBox without add one null string previously, DrawItem function is not called.
Thank you for your helps.
Lichang Wu
|
|
|
|
|
DrawItem() is only called when items are to be drawn. If there are no items to draw, it's not called. You still have to add your items as normal.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Send this message from your dialog after doing AddString() to set LB_SETCOUNT...
lResult = SendMessage( // returns LRESULT in lResult (HWND)hWndControl, // handle to destination control
UINT) LB_SETCOUNT, // message ID
(WPARAM) wParam, // = (WPARAM) () wParam;
(LPARAM) lParam // = (LPARAM) () lParam; );
For example,
HRESULT lResult;
lResult = m_MyListBox.SendMessage( (UINT) LB_SETCOUNT,
(WPARAM) m_MyListBox.m_iTotalItemCount,
(LPARAM) 0);
where, m_MyListBox is member object of your Owner Draw ListBox derived class (like CMyListBox derived from CListBox). m_iTotalItemCount as WPARAM is total number of item data to be set. LPARAM can be sent as 0.
One thing needs to be taken into account that the LB_SETCOUNT works only when ListBox Style is "No Data" i.e. LBS_NODATA. Has Strings should be set as FALSE. Setting LB_SETCOUNT will call Draw Item.
Happy Programming
|
|
|
|
|
I have written a program which reads data from internet and displays it in the web browser control.
And now I'm fuzz about such problems( I have paste the code at the end):
Sometimes the 'DisplayInExplore' works well, but Sometimes it crashs.
1. I have debugged it , and found that 'pHD->write(pSFArray);' method would result in the 'Assert Debug' fatal error. And I can't step into the method write.
2. Sometimes, the 'pHD->write(pSFArray);' could execute successfully, but there was no data to display in the Web Browser control. And when cursor went into the client area of the Web Browser control, the cursor change to the 'wait' status.
So , I have no idea why it works so instable ? Or there are some errors in my function?
Plz give me some suggestion ,Thx.
---------------------------------------------------------------------------
The code is as below:
void CGameInfoDlg::DisplayInExplore(CString strContent)
{
//m_exploreView is the CWebBrowser2
IHTMLDocument2* pHD=(IHTMLDocument2*) m_exploreView.GetDocument();
VARIANT* pVATable=NULL;
SAFEARRAY* pSFArray;
pSFArray = SafeArrayCreateVector(VT_VARIANT, 0, 1);
if(pSFArray!=NULL && pHD!=NULL)
{
SafeArrayAccessData(pSFArray,(LPVOID*) &pVATable);
BSTR bstrContent=strContent.AllocSysString();
pVATable->vt=VT_BSTR;
pVATable->bstrVal=bstrContent;
SafeArrayUnaccessData(pSFArray);
pHD->write(pSFArray);
}
else
{
MessageBox("Errors!");
}
SysFreeString(pVATable->bstrVal);
if(pSFArray!=NULL)
{
SafeArrayDestroy(pSFArray);
}
}
|
|
|
|
|
who can give me some tins?? plz, thx very very very much....
|
|
|
|
|
Please ,how i can get serial numbers of bios, motherboard, processor,vedio card ,hard disk , with java or c programmes under windows and linux platforms
if u have any site or url contact me .
email
ss2006@caramaiol.com
am
-- modified at 7:06 Sunday 26th February, 2006
|
|
|
|
|
Hi, I'm new to parallel port and would like to ask a few questions:
1. I want to program the parallel port (in C) using VC++, how can I access the port?
2. How can I run my program in windows?
Your help is truly appreciated!
|
|
|
|
|
Hi,
Check this port programming[^].
The _inp and _outp are privileged instructions and cannot be used in Win2000 and WinXP. Try using some library. Check this link.
InpOut32.dll[^]
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
I have used InpOut32.dll - really convenient to use, etc.
One thing to watch out for - I was doing InPorts, and got peculiar results until I realised that it returned an 8-bit value, and I wanted a 16-bit value, so I had to do 2 separate InPorts and combine the results.
|
|
|
|
|
We do not need to select palette into DC to display rich-colored bitmap for monitor if we set monitor properties as 32 bits or 16 bits.
but, do we need to select palette for Printer DC for printing rich-colored bitmap?
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
-- modified at 9:23 Sunday 26th February, 2006
|
|
|
|
|
can anyone help me find how to write a program to read input from hardware temperature sensors and display it.
- Kyle
|
|
|
|
|
See http://www.wotsit.org
|
|
|
|
|
i could not find any helpful topics for this problem on that web site. if you could point me to the one you found it would help me out.
thank you
- Kyle
|
|
|
|
|
Hi Kyle
What do you fo exactly?
In the site helpful information for hardware,...
But if it's not your answer go to
http://www.codeguru.com/
Have a nice day
|
|
|
|
|
Hi,
I am developing a console type application that accepts command from the user and executes it, if it is valid.
This is a Dialog based application. I have only a CEdit control in this dialog box.
When this application starts, the focus is in the CEdit control and the entire initial text is selected.
How do i keep the focus without selecting the whole initial text. I tried to set selection in InitDialog. But things didnt work as I expected.
Please suggest me a solution for this
Thanks
Saravanan
|
|
|
|
|
Hi
Do you test WM_SETFOCUS
|
|
|
|