|
directly trying to draw on desktop window ( GetDesktopWindow() )may not work due to unavailablity of the OnPaint kind of messages for this kind of application (unless some kind of explorer hacking is done !)
a suggested way could be drawing on a transparent window which does not have no caption, menu, frame etc.
|
|
|
|
|
You can draw on the desktop any time you want! You just need the right DC
HDC hScreenDC = ::GetDC(0);
Sometimes it's fun to just trash the desktop
Maybe I need to get out more...
|
|
|
|
|
Drawing on a transparent window may be a better approach.
Steve
|
|
|
|
|
Hi everyone,
I'm trying to add a tooltip to my buttons on a toolbar,but without any luck.I checked it out with spy++ and HWND seems valid,but i can't activate the tool tip.According to documentation stuff,I do not have to write a message handler for my tooltips to be displayed (I use the TTF_SUBCLASS flag),am I wrong,or missing something in the code below?
<br />
RECT rect;<br />
HWND hwndTT;<br />
INITCOMMONCONTROLSEX iccex;<br />
ATLVERIFY((SendMessage(hwndParent,TB_GETITEMRECT,(WPARAM) iButton,(LPARAM) (LPRECT)&rect)) == TRUE);
<br />
iccex.dwICC = ICC_WIN95_CLASSES;<br />
iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);<br />
InitCommonControlsEx(&iccex);<br />
if ((hwndTT = CreateWindowEx(<br />
WS_EX_TOPMOST,<br />
TOOLTIPS_CLASS,<br />
NULL,<br />
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,<br />
CW_USEDEFAULT,<br />
CW_USEDEFAULT,<br />
CW_USEDEFAULT,<br />
CW_USEDEFAULT,<br />
hwndParent,<br />
NULL,<br />
NULL,<br />
NULL<br />
)) == NULL)<br />
return NULL;<br />
<br />
::SetWindowPos(hwndTT,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);<br />
<br />
TOOLINFO ti;<br />
ti.cbSize = sizeof(TOOLINFO);<br />
ti.uFlags = TTF_SUBCLASS;<br />
ti.hwnd = hwndParent;<br />
ti.lpszText = (LPTSTR) lpszText;<br />
<br />
ti.rect.bottom = rect.bottom;<br />
ti.rect.left = rect.left;<br />
ti.rect.top = rect.top;<br />
ti.rect.right = rect.right;<br />
<br />
SendMessage(hwndTT,TTM_SETDELAYTIME,TTDT_INITIAL,0L);<br />
return SendMessage(hwndTT,TTM_ADDTOOL,0,(LPARAM)&ti);<br />
|
|
|
|
|
please when posting a piece of code, to use the <pre> tag instead of the <code> one.
thanks
|
|
|
|
|
ajitatif angajetor wrote: SendMessage(hwndTT,TTM_SETDELAYTIME,TTDT_INITIAL,0L);
You have passed delay time value(LPARAM) as 0. Is it intentional ?
For setting default delay it should be -1.
|
|
|
|
|
prasad_som wrote: You have passed delay time value(LPARAM) as 0. Is it intentional ?
Yes,to pop the ToolTip up instantly,so I can see the rectangle is exactly as I meant it to be.
|
|
|
|
|
Code is looking ok to me. Can you show how you have created toolbar ?
|
|
|
|
|
uh,i had to hack my code much more throughly to see it was all about rectangles.i found out that the toolbar had one of the items resized after i created the tooltip (with the wrong rectangles).
and i added a TB_SETTOOLTIPS message right after the TTM_ADDTOOL .works just fine now,thanks for everything
|
|
|
|
|
Dear All,
I have created one ATL Service program. Inside that i have done thread and socket operations. I registered this service in my syatem WinXP using the below cmd..
sc create "filename.exe" binpath= "c:\filename.exe"
But my problem is that I started my service program. It is showing tha "The service did not respond start request"
When I see TaskManager, I can see my program is running.. How this is happening ..?
Kindly do help
Thanks
Nice things do nice works
|
|
|
|
|
The application needs to set its service status so that the SCM knows what is going on with it. Look up SetServiceStatus(...) for more information.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hello friends...
I am working with vc++6.Now i wanted to restart my MFC application from within itself.How can i make it possible.
Please help me
Thanks
|
|
|
|
|
|
Vinod Moorkkan wrote: Now i wanted to restart my MFC application from within itself.
To start an EXE in another process, you can use system( "filename").
Its prototype should be included with any MFC-Program or you can include <process.h> for it.
Your old aplication then simply terminates.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Can you more explain restart my MFC application from within itself?
|
|
|
|
|
prefer ::ShellExecute() or ::CreateProcess() than system()
|
|
|
|
|
Congratulation new icon its nice
|
|
|
|
|
WhiteSky wrote: Congratulation new icon its nice
thanks
|
|
|
|
|
There is no in build function to do that i believe.
One approach could be starting a new instance of the current application and then exit the current instance (some more inteligence can be given to the application through the command line parameters like to wait till the parent application has cleaned-up the resource and exited properly before initializing the new instance).
|
|
|
|
|
you here !?
welcome back, and happy new year
ps: arrange your sig and close the opened html tag
|
|
|
|
|
toxcct wrote: welcome back, and happy new year
Thanks a tonn toxcct. glad to see you still remember !
Wish you the same and all the best for 2007
Thought of doing something good for this 07 and ended up back here in CP
toxcct wrote: ps: arrange your sig and close the opened html tag
still in search for a new sig for the new year
|
|
|
|
|
of course i remember you, you were one of the 1st who left me a message in my "CP Blog"...
btw, i wish you to fine your new sig... lol
|
|
|
|
|
Use Create Process.
I have tested it with a dialog based app. Maybe you must use some startup time delay to wait until the calling application is closed. For more information about CreateProcess have alook in the MSDN.
void CRestart_selfDlg::OnButtonRestart()
{
STARTUPINFO m_StartupInfo;
PROCESS_INFORMATION m_ProcessInformation;
ZeroMemory(&m_StartupInfo, sizeof(STARTUPINFO));
ZeroMemory(&m_ProcessInformation, sizeof(PROCESS_INFORMATION));
char* szPrgPathName = "\"restart_self.exe\"";
CreateProcess ( NULL
, szPrgPathName // the commandline options
, (LPSECURITY_ATTRIBUTES)NULL
, (LPSECURITY_ATTRIBUTES)NULL
, FALSE
, CREATE_NEW_CONSOLE
, NULL
, NULL
, &m_StartupInfo
, &m_ProcessInformation) ;
DWORD dwLastError = GetLastError(); // for test only
// close now the dialog based application
OnOK();
// should work in view based application, not tested
// theApp.CloseAllDocuments(TRUE);
}
|
|
|
|
|
Use can use CreateProcess() to start ur MFC application and then exit ur current exe.
|
|
|
|
|
Thank you..friends..
I used CreateProcess it working..
|
|
|
|