|
when i use setwindowtext(),the title has often been changed automatically,why?
|
|
|
|
|
The Child Windows of MFC use the title of the associated document as the title of the window frame (automatically). To change the title of the window frame, all you need to do is change that in the document using :
pDoc->SetTitle(WHATEVER_YOU_WANT);
and you should notice that the title in the window frame has been automatically updated to reflect this.
P.S. make sure you get the active document (pDoc) by using the GetActiveDocument() member function of the CHILD frame or view.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
thanks!
now i have only one document, and three views,
how i do it?
|
|
|
|
|
|
the hwnd should be a member var. of the CFileDialog - Class (m_hwnd)
if you want to get the path of the selected file use CFileDialog::GetPathName
or if you have got multiple selection you have to use CFileDialog::GetStartPosition and CFileDialog::GetNextPathName
hope this helps
bernhard
"There are three roads to ruin: women, gambling and technicians. The most pleasant is with women, the quickest is with gambling, but the surest is with technicians." Georges Pompidou
|
|
|
|
|
i want to make the main window invisible at the start of my application.my program is dialog based MFC application.
how to? thanks.
|
|
|
|
|
Set a timer in your InitDialog [say a 3 second timer]
Now the timer gets called [after 3 seconds]
ShowWindow(SW_HIDE) and remove the timer
Nish
p.s. putting ShowWindow(SW_HIDE) in InitDialog won't work cause of the manner in which modal dialogs are created and shown on screen
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Unselect the "Visible" style at the dialog resources properties tab, add a BOOL m_bFirstShowWindow variable to your CDialog -based class, initialize m_bFirstShowWindow to TRUE on construction time, and add the following message handler for WM_WINDOWPOSCHANGING :
void CYourDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
{
CDialog::OnWindowPosChanging(lpwndpos);
if(lpwndpos->flags&SWP_SHOWWINDOW){
if(m_bFirstShowWindow){
m_bFirstShowWindow=FALSE;
lpwndpos->flags&=~SWP_SHOWWINDOW;
}
}
} Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sorry to trouble you again.
I can't find the WM_WINDOWPOSCHANGING message in the Class Wizard.so i don't know how to add the message handle function.
How can i generate the function OnWindowPosChanging?
tank you.
|
|
|
|
|
Sorry to trouble you again.
No problem
MFC Class WIzard -> Class Info tab -> Advanced Options -> Message filter -> Window
This message filter thing is IMHO a little annoying and a constant source of confusion.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Here's another way:
1. Uncheck the "Visible" checkbox from the dialog resource.
2. Construct the dialog box modelessly:
In your CWinApp-derived class, replace the code in your InitInstance (after Enable3dControlStatic) with something like this:
static CYourDlg dlg;
dlg.Create(CYourDlg::IDD);
m_pMainWnd = &dlg;
return TRUE;
Regards,
Alvaro
|
|
|
|
|
I set a hook over system to draw a button into caption area. I succeed.
And I want when I press Left Mouse BUtton on this button, it pop up a ownerdraw menu, what can i do ?
|
|
|
|
|
Hi
I have a popup-menu associated with a window, and I want to specify for each menu entry if it is enabled/disabled. So I'm wondering if my window sends some messages (similar to WM_LBUTTONDOWN for example) just before displaying a menu item? I would like to be able to intercept that message and actualize the enabled/disabled state of that item. I read something about ON_UPDATE_COMMAND_UI but my window is created with CreateWindowEx and I can't do anything with classwizard.
How can I handle this task easily
Thanks
|
|
|
|
|
Handle WM_INITMENU.
See MSDN to read about WM_INITMENU
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
I dynamically construct the popup menu when I detect a right mouse button click. This way, you can set the disabled state of individual menu items.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
That works fine, thanks
|
|
|
|
|
How to change parameters of video source: brightness, contrast and other? Not in the reference dialog box (capDlgVideoSource), by means of a movable indicator. For example, it's necessary automatically to customize all these parameters in program at startup (entering their numerical significances). Whether there are any functions, variable or something for a modification of these parameters?
|
|
|
|
|
i'd like to get string laid below mouse pointer using mouse hooking in another application.
if example source exist, let me show. thank you
have a nice day
|
|
|
|
|
If your string wants to get laid, just send it to a singles bar.
Seriously, this question gets asked over and over again here, I don't get why, but the answer is simply that to get ANY visible string you need to use screen capture and write some funky OCR stuff, to get any PARTIALLY visible string that is written (not in a bitmap) you need to use GetWindowText and GetFont to figure out the metrics of which word you are over.
Neither of these is a simple enough task to get a quick answer in a forum. I've also asked every person who asks this question and no-one has ever told me *why* they want to do it, beyond the fact that there are one or two apps about devoted to the purpose for the reason of providing tranlations between languages.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
i expect that string is not got using simple API function (GetWindowText, ...).
but when windows(OS) prints string on screen, read character code format so then i put the string in my application window. generally, using to hook TextOut or ExTextout function, it is implemented.
by the way, i want to know how to implement it in detail.
have a nice day
|
|
|
|
|
a. It is unlikely you are right, because that would require the window to be invalidated in order to redraw, and in fact you would still need to get the window using WindowFromPoint, and figure out which word in a sentence was under the mouse. Also, the commerical apps that do this use OCR, because they can read words off bitmaps. Either way, what you propse is mind numbingly more complex - why wait for a draw command once you know the window when you can just ask it directly ?
prog7584 wrote:
by the way, i want to know how to implement it in detail.
b. Like I said, you and everyone else who asks this stupid question. I propse we add to the FAQ the fact that an answer is not going to be forthcoming, anymore than an answer would be given if I asked 'How can I write a first person perspective shooting game' - the answer is build an engine, create some models and animate them with algorithms to ensure the laws of physics are obeyed. What you're asking is similarly too complex to answer in a forum, except broadly, as I have done. You have some other ideas, that's fine. Like everyone else who asks you didn't answer when I asked why you would want to do such a thing, and that's fine. But no-one is going to find an answer to your question, any more than they did the last 57 people who asked. If you have a need to do this, and an idea how, then give it a go and ask questions when you get stuck on something.
You're asking how to do something complex enough that people who have done it sell an app that does exactly what you said and no more.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I don't know just how possible what you want is but I can point you to some APIs that may help you:
GetCursorPos -- gets the current cursor position in a POINT structure
WindowFromPoint -- gets the handle of the window at the given POINT location
GetWindowText -- gets the "window text" for a given window
The problem is that GetWindowText will ony work well if the mouse is over a title bar or an edit box. Otherwise it's not gonna be reliable.
Hope to have helped and good luck,
Alvaro
|
|
|
|
|
I am running into a problem with a Wizard that my activeX control has...The problem occurs when the user reaches the last dialog box, forgets to enter a value in one of the dialog boxes and presses finish. A message box pops up, telling the user that they must enter a value, but as soon as the user clicks OK, the Wizard and IE lose focus and the last minimized app comes on top. This does not happen in any of the previous Wizard pages. Any ideas how I can go about setting the focus back to this last page?
BTW, I have tried all kinds of setFocus variations...
This is the code in the OnWizardFinish BTW:
BOOL CAddControllerPage4::OnWizardFinish()
{
if(m_nFlag == -1)
{
m_nFlag = 0;
m_ErrorObject.PromptError(12060); // this prompt
// error using
//AfxMessageboxDirect
return 0;
}
else {
return CPropertyPage::OnWizardFinish();
}
}
thanks
|
|
|
|
|
Hi,
I’ve a application which I want to start at machine start up. I’m using Task Scheduler to schedule this application. I’ve tried sample (MSJ Feb 99)Feb99CQA.exe. Problem is even though Task Scheduler is running as interactive service; I do not see any UI. Task Manager shows my application running but it does not display any UI. I tried running notepad but the result is same. Basically I’m not getting TaskbarCreated message in my application. What else I need to do to see ui / ShellNotifyIcon? I’m aware of concept of Windows WorkStation and desktop. Is it possible at to do?
I would appreciate any suggestions regarding this.
Thanks
|
|
|
|
|
Hello. After a couple days of fitful studying of DLLs I still have one question that I can't seem to find hte answer for:
I know the functions in a .DLL can do pretty much whatever they want, but how do I let the main program (that linked to the .DLL) know that something has happened in the .DLL. Specifically I want the keytrapping hook to let the keycounting program know "a key was just pressed". Is PostMessage the answer?
-Jason
nirgle.bitdevil.com
|
|
|
|