|
akhildhanuka wrote:
Now I want to change the caption of that dialog dynamically. So in the WM_INITDIALOG, I am having a function call:
SetWindowText ( GetParent(hwnd), "Some header" );
So I'm confused, are you trying to change the title on the prop sheet dialog? Are you doing this in the OnInitDlg of your parent app?
The reason I ask is that if you are doing this in the prop sheet shold you not be passing the handle of the prop sheet dialog to SetWindowText to change the title?
Here is what MSDN says:
hWnd
[in] Handle to the window or control whose text is to be changed.
Hope this helps
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I am creating the wizard as suggested at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/CommCtls/PropSheet/wizards.asp
So lets say - i want to change the title of on of the page during runtime e.g. IntPage1DlgProc(...)
BOOL CALLBACK IntPage1DlgProc (
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA)
GetWindowLong(hwndDlg, GWL_USERDATA);
switch (uMsg)
{
case WM_INITDIALOG :
{
pdata = (LPSHAREDWIZDATA)
((LPPROPSHEETPAGE) lParam) ->
lParam;
SetWindowLong(hwndDlg, GWL_USERDATA,
(DWORD_PTR)pdata);
SetWindowText ( hwndDlg, "XXX" );
break;
}
does not work and the title remains same as one provided using resource editor.
I want to change it dynamically.
|
|
|
|
|
You need to postmessage in PSN_SETACTIVE and use
SetWindowText ( GetParent ( hwnd ), "your text" );
|
|
|
|
|
Hi:
which is the easiest way to insert a little image (maybe a BMP 30x30 pixels) in specific coordinates (x, y) into a view?
Thanks.
|
|
|
|
|
In the OnDraw handler of the view class, first create a HBITMAP struct. Then use LoadImage to load the bitmap image from a file into the struct. Then create a CBitmap object and attach it to the HBITMAP. Then use standard BitBlt techniques to blit the bitmap into the view.
Here's a code sample:
void CMyView::OnDraw(CDC* pDC)
{
HBITMAP hbmpMyBitmap;
hbmpMyBitmap = (HBITMAP) LoadImage( NULL, "C:\\Windows\\MyBitmap.bmp",
IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE );<DIV>
CBitmap objBitmap;
objBitmap.Attach( hbmpMyBitmap );<DIV>
CDC tempDC;
tempDC.CreateCompatibleDC( pDC );
CBitmap* pOldBitmap = (CBitmap*) tempDC.SelectObject( &objBitmap );<DIV>
pDC->BitBlt(x, y, width, height, &tempDC, 0, 0, SRCCOPY);<DIV>
tempDC.SelectObject( pOldBitmap );
return;
} Something like this. Remember to replace file path, destination coordinates and bitmap width and height with the correct values.
Hope it helps,
Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|
|
|
I am creating a dialogbox(modal) from inside my parent dialog. On this dialog, there is a Finish button whose id = IDC_BUTTON6. When I click this button I would like to call my parent dialog's apply(); method.
However I don't know how to refer to IDC_BUTTON6 of Popup.cpp from inside the Parent.class.
Should I write something like;
if (nResponse == IDC_BUTTON6) which is erroneous,
or like
if (nResponse == Popup.IDC_BUTTON6) which is also erroneous.
How should I solve this simple case ?
Parent.cpp has the following ;
void SomeMethod()
{
myPopupDialog dlg(propertySheet->hRepository, propertySheet->pszObjectDN, &csName);
int nResponse = dlg.DoModal();
if (nResponse == IDC_BUTTON6)// where the error occurs
{
apply();
}
}
void apply(void)
{
//do something
}
*********************
Popup.cpp has the followind code;
void ColdGroupPopup::OnFinish() //Finish button's id = IDC_BUTTON6
{
}
Nice Özgürce
|
|
|
|
|
|
thank you Mike, your response helped..
|
|
|
|
|
any body can explain the AVL Tree insertion algorithm. or pls give some useful links for the same
Thanks,
Sarath
|
|
|
|
|
Hi !
I managed to hook a MDIChild window to a class of mine, which is derived from the class CHookWnd , supplied by J.P.Naughter (see article http://www.naughter.com/hookwnd.html)
I additionally do attach a Toolbar programmatically to the hooked MDIChild window, all works fine, meaning that 1)the toolbar is created and attached, 2) the messages are rerouted to my WindowProc.
There is one problem , though:
I am not able to intercept the WM_COMMAND message sent, whenever I click on one of the toolbar buttons, this message is sent directly to the child and not rerouted. I also DO NOT want to induce a redirection of the message from within the MDI child window, that would be pointless in my case.
QUESTION : How can I intercept the WM_COMMAND messages issued upon clicking the toolbar buttons such, that they will be redirected automatically to my WindowProc procedure.
The whole project is available upon request,
thanks to anyone trying to help,
Rubi
|
|
|
|
|
The problem is due to the way MFC routes the messages in the OnCmdMsg() function.
BOOL CFrameWnd::OnCmdMsg(UINT nID, int nCode, void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo)
{
CPushRoutingFrame push(this);
CView* pView = GetActiveView();
if (pView != NULL && pView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
CWinApp* pApp = AfxGetApp();
if (pApp != NULL && pApp->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
return FALSE;
}
If you override this function in your mainframe you can add an extra stage to query the CMdiChild window.
e.g.
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo)
{
CPushRoutingFrame push(this);
CView* pView = GetActiveView();
if (pView != NULL)
{
CWnd *pParent = pView->GetParent();
if (pParent != NULL && pParent->OnCmdMdg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
}
if (pView != NULL && pView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
CWinApp* pApp = AfxGetApp();
if (pApp != NULL && pApp->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
return FALSE;
}
If you vote me down, my score will only get lower
|
|
|
|
|
Thanks , but I should have explained better. What I needed to achieve was a way to cause my DLL to plug into an existing application by some other programmer, without having to involve the the other programmer .This way , he wouldn't have to change a bit. There would be only his application with a few MDI child windows created by him, while I hook up to those MDI child windows, I induce the creation of different toolbars for the respective MDI child and intercept all the messages to those windows, thus taking over the MDI children. I achieved it, everything works fine now. As I explained in the former posting, I do receive the rerouted messages. The WM_COMMAND message cannot be intercepted by me, it is intercepted in the MDI child, but I found a way around it. Whenever I create the toolbar, I keep record of the amount of buttons and record the rectangles within the toolbar, where they are located. Now, I need just to catch the WM_LBUTTONDOWN and ..BUTTONUP messages, thus enabling me to detect which button was pressed and take action... Works great !
Thank you for your interest !
Rubi
|
|
|
|
|
Any useful links to understand AVL Tree insertion Algorithm?
Sarath
|
|
|
|
|
hi all
does ne1 know the best way of extracting a sting
what i need to do i extract str1 out of str2
CString str1 = "7"
CSting str2 = "07HGN"
so the result for str2 would be "0HGN"
any ideas
thanks
si
|
|
|
|
|
Check out : CString members[^]
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
The common logic is:
int nPos = str2.Find(str1);
int nDelLen = str1.GetLength();
if(nPos != -1)
str2.Delete(nPos,nDelLen);
This is a simple method. u can also use extraction method using Left, Right, Mid functions and concatenate the extract the string.
Sarath
|
|
|
|
|
Or how about:
str2.Replace(str1,"");
....
|
|
|
|
|
CString str1 = "7";
CString str2 = "07HGN";
CString strResult = str2.Mid(0, str2.Find(str1)) + str2.Find(str.Find(str1)+1, -1);
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I have a CDialog (as child of something else) that I need to reparent to another window ( a CWnd child of a floating/non-floating evil dialogbar ).
Are there any caveats when reparenting CWnd in general ?
( I know it's very vague, but I'm looking for generics before going deeper into the problem )
Thanks.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi
I want to develop one small Win32 Console Application which monitors the Microsoft Exchange Outlook and if there is any new mail in user mail box it will tell that there is new message.
For this I want to use Advise Sink and and using MAPI I want to develop small application. Any material or any example that can help me.
Though I have foun many applications but all are in COM or DCOM so I don't know how to write Interface in simple C++ ?
Please if any one can help me it will be gr8
Thankx in advance...
Yours
Mike
|
|
|
|
|
kindly give me the information about how to link between the projects created in workspace using win32 console application
Nowshad.M.C
nowshadmc@rediffmail.com
|
|
|
|
|
Hi
I am starting a new project to program an AI Agent. Before I started I wanted to look for source code for similar projects. Can anyone give me links or anything? just to have an idea
Thanks
|
|
|
|
|
|
hiii...
how can i get an ICON from a window and pass it to the
CreateWindowEx function?
regards,
kedar.
|
|
|
|
|