|
aloktambi wrote: i want to change background color of push buttons in my MFC program
You have to Create Owner Drawn Button PLUS Handle CButton::DrawItem(...)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi!
How can i create a window that just hangs around without ever getting focus/becoming active.. yet let the user interact with it through mouseclicks?
I want a window that is open, on top of the screen, that does not break the focus on currently focused application. That is, if i have a webpage open such as this.. and i'm writing in a textbox, i can press a button (to change mixer volume for example) and keep writing without having to click in the form.
Hope it's possible! Would sure open a lot of doors for me!
Thanks for reading!
|
|
|
|
|
The moment you click on it the window will get focus, I don't see how you can avoid this unless you return focus to the previous window at the end of each event.
Elaine
The tigress is here
|
|
|
|
|
Well, I have seen this behaviour in a few applications (mainly professional on-screen keyboards). If you fire up the virtual keyboard that ships with windows xp you will see what i mean. it does not get focus when you click on it's buttons! if you click the titlebar however, it does.. but gives it back to the application that previously had focus whenever you hover the buttons on it. I want to remove all decorations and display only buttons that act just that way (i know how to change focus back to previous window, but that's not what i want).
Thanks!
|
|
|
|
|
As Elaine said, the only way to achieve that is to give the focus back to the window that lost it immediately after getting it in your app.
Intercept WM_SETFOCUS , the wParam is the handle of the window that just lost the focus (Win32 version) or in the CWnd::OnSetFocus method, you get a pointer on the unfocused window CWnd *pOldWnd (MFC).
Then use SetFocus in your turn with this handle (pointer) to yield the focus back to the window that lost it.
~RaGE();
|
|
|
|
|
would intercepting WM_SETFOCUS be any different from calling SetActiveWindow(NULL) within the procedure of the button click?
I tried this:
<br />
LPDWORD pid, hpid;<br />
GetWindowThreadProcessId((HWND)wParam, pid);<br />
GetWindowThreadProcessId(hwnd, hpid);<br />
<br />
AttachThreadInput((DWORD)pid, (DWORD)hpid, TRUE);<br />
SetFocus((HWND)wParam);<br />
AttachThreadInput((DWORD)pid, (DWORD)hpid, FALSE);<br />
with no success (it does not move focus).
|
|
|
|
|
<br />
case WM_SETFOCUS:<br />
{<br />
LPDWORD pid, hpid;<br />
GetWindowThreadProcessId((HWND)wParam, pid);<br />
GetWindowThreadProcessId(hwnd, hpid);<br />
<br />
AttachThreadInput((DWORD)pid, (DWORD)hpid, TRUE);<br />
SetActiveWindow((HWND)wParam);<br />
SetFocus((HWND)wParam);<br />
SetForegroundWindow((HWND)wParam);<br />
AttachThreadInput((DWORD)pid, (DWORD)hpid, FALSE);<br />
printf("Focus changed %d", wParam);<br />
}<br />
break;<br />
seems to retain the focus on the app as long as i do not doubleclick on my panel.. button procedure is not caught though.
|
|
|
|
|
this does not work with Firefox. If i am editing in the location bar and press the volume button.. the whole url in the locationbar gets selected.. which means that i will overwrite whatever was previously written if i type something on my keyboard (unlike if i use the windows virtual keyboard).
|
|
|
|
|
Hi
I am using VC++ Dlls. I want to use ADO to get information from the Database. When i am trying to import the ado dll in my dll application it is giving errors like enum is redefined.
if i am declaring the same statement in Exe it is not showing any errors why? I am giving the import statement in this way.
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF", "adoEOF")
I have checked for the availability of that dll in the specified path.it is present.
Can anybody help me Its Urgent
Thanks in Advance
|
|
|
|
|
That is the correct statement if you have windows on c:. Where did you put this statement? The best place is near the bottom of stdafx.h.
John
|
|
|
|
|
Hello everybody!!
I'm having some difficulties using function GetModuleFileName. I don`t want to get the path for the current module. NULL is not serving my purpose.
Instead, I want to get the path of the filename from the edit box on dialog of my application. How to declare handle for this??
Thanx
|
|
|
|
|
kind_person wrote: Instead, I want to get the path of the filename from the edit box on dialog of my application.
Unless the filename in the edit control also has a pathname, you can't. Otherwise, you could use _splitpath() to separate the various components.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi,
I'm using Visual Studio 2003 and im finding it hard to subclass a control.
In Visual C++ 6, you had to class wizard to do that for you, and it was easy.
However the class wizard is different this time round, and when you click add class, it you cant select the base control from the class list.
I'm just wondering how you go about subclassing in Visual Studio 7.
Thanks Tom
|
|
|
|
|
C'mon man! Move ahead...Select MFC Class in the first dialog box and in the next dialog box....
whoa!!!
lemme me see u smile now!!!
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
|
Okay ive done my subclass, how do i bind it to the static box in my dialog?
Tom
|
|
|
|
|
Tom Moore wrote: Okay ive done my subclass, how do i bind it to the static box in my dialog?
Add Variable for particular Static Control. If you class doesn't appear add variable Wizard the Manully Modify DDX_Control Block for your variable
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote: Tom Moore wrote:
Okay ive done my subclass, how do i bind it to the static box in my dialog?
Add Variable for particular Static Control. If you class doesn't appear add variable Wizard the Manully Modify DDX_Control Block for your variable
That was easy in Visual C++ 6, but im using Visual Studio 2003.
I goto the Add Variable and the class isnt in the combobox.
I then looked for the DDX_Control Box, but i dont think Visual C++ 7 includes that.
Any Ideas
|
|
|
|
|
I have a dialog box were i have few parameters to be
displayed at certain interval from a etherenet connection .
I am using the SetTimer(); ]
i set the time interval for about 2 minutes but the dialog
box doesnot respond to anyother events inbetween .There is
another command button but i am not able to click on it inbetween.
Is there any solution like as in VB ther is DoEvents for similar
situations.
thank you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Maybe the app is collapsed by the commands executed in the timer. Try to execute them in a sepparate thread.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
vikas amin wrote: I am using the SetTimer(); ]
i set the time interval for about 2 minutes but the dialog
box doesnot respond to anyother events inbetween .
This is not normnal behavior. What is the code doing after calling SetTimer() ?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
vikas amin wrote:
I am using the SetTimer(); ]
i set the time interval for about 2 minutes but the dialog
box doesnot respond to anyother events inbetween .
This is not normnal behavior. What is the code doing after calling SetTimer()?
on the timer event which fires the SetTimer()
it calls a function which sends a some reqest data to a embedded device
& gets the data from the device . this process can take maximum 10 seconds.
Later on this data is displayed on the DialogBox
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
The timer callback runs on the UI thread, which means that for the time the callback runs, the UI will not respond. Maybe that explains your problem.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
vikas amin wrote: on the timer event which fires the SetTimer()
it calls a function which sends a some reqest data to a embedded device
& gets the data from the device . this process can take maximum 10 seconds.
You should not be doing such time-intensive things in the timer-handling function. Fire off another thread to do that stuff so that the timer-handling function can get in and out in a fraction of a second.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hello everybody,
I'm having some difficulties using functions from the dbhelp library (I guess it's not very surprising when you see how it's documented...).
Here's what I need to do:
I want to be able to get symbols names and adresses in a running application from its pdb file.
And this is what I do:
I run toto.exe (E:\toto_Debug\toto.exe)
While the process is running, in my debuger I do:
Get process handle (hProcess)-> use it in SymInitialize(hProcess,NULL,false))
(returns ok)
The I try to load the pdb file: (me32 is the module corresponding to toto.exe, I'm not sure of this step)
SymLoadModule64(hProcess, NULL, "E:\\toto\\Debug\\toto.pdb", NULL, (DWORD64)me32.modBaseAddr, 1090560)
(returns ok)
and then I try to get a symbol from its name:
char szSymbolName[MAX_SYM_NAME];<br />
ULONG64 buffer[(sizeof(SYMBOL_INFO) +<br />
MAX_SYM_NAME*sizeof(TCHAR) +<br />
sizeof(ULONG64) - 1) /<br />
sizeof(ULONG64)];<br />
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;<br />
<br />
lstrcpy(szSymbolName, "main");<br />
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);<br />
pSymbol->MaxNameLen = MAX_SYM_NAME;<br />
<br />
SymFromName(hProcess, szSymbolName, pSymbol);
And the application crashes...(access violation).
Ok, questions now:
What is wrong in what I'm doing? I heard pdb files are handled is a strange way:
_does the dbgHelp library tries to find the pdb file itself in the same directory than the executable?
_Do you really have to call the SymLoadModule64 function or do you simply have to call SymInitialize with more appropriate parameters?
_If you really have to call SymLoadModule64, how do you get the module base adress?
I have to admit I'm really lost, if somebody could help me it would be greatly appreciated
Zillon
|
|
|
|