|
Hi all,
I'm using CTaskbarNotifier (found it here) to display a popup. It works just fine, but now I want it to change it's shape when the mouse is over.
I added a m_biHoverSkinBackground member variable, and it's corresponding with and height properties.
I modified the OnMouseHover function, like this:
LRESULT CTaskbarNotifier::OnMouseLeave(WPARAM w, LPARAM l)
{
if (m_bMouseIsOver==TRUE)
{
m_bMouseIsOver=FALSE;
RedrawWindow();
}
return 0;
}
The OnMouseLeave function was also modified. and in the OnEraseBkgnd function I added this:
if (m_bMouseIsOver)
{
SetWindowRgn(m_hHoverSkinRegion, true);
GetObject(m_biHoverSkinBackground.GetSafeHandle(), sizeof(bm), &bm);
pOldBitmap=memDC.SelectObject(&m_biHoverSkinBackground);
}
else
{
SetWindowRgn(m_hSkinRegion, true);
GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm);
pOldBitmap=memDC.SelectObject(&m_biSkinBackground);
}
I also changed the code so that where it asks for the skin width/height, it gets the current skin width/height (depends if the mouse is over or not).
The problem is that it works when the mouse is over: the region and bitmap changes, but when the mouse goes out, the bitmap changes but not the region, it stays with the "mouse-over" region...
can anyone give me a hint why it's not working as it should?
thanks a lot!
|
|
|
|
|
I'm trying to call message box function:
<br />
MessageBox(NULL, TEXT("Configuration file is corupted. Loading standart settings."), TEXT("Error"), MB_OK);<br />
but linker returns error:
Автонапоминалка 3.0 error LNK2001: unresolved external symbol "int __stdcall MessageBoxA(struct HWND__ *,char const *,char const *,unsigned int)" (?MessageBoxA@@$$J216YGHPAUHWND__@@PBD1I@Z)
Am I doing somthing wrong?
|
|
|
|
|
Maybe because the configuration file is corrupted!! you should load standard settings
I am Kidding only, but know something?
The Visual Studio sometimes fools out for no reason, sometimes i get errors that make no sense, maybe some professionals has faced a situation that a very basic line of code doesnt work, and it just doesnt work, for no obvious reason.
I sometimes getout from such a problem (when u are very sure of what u are doing but the compiler just rejects your code) by creating a new clean project and move my code to it. it works 99% of the time, why should I worry about the other 2%???
Albert Einsitein said once: The most foolish person in the world is one who makes a test, and then redo it with the same arguments and expecting different results.
well, it works sometimes with computers, who knows why???
This is not a solution, its a suggestion
Regards,
Mohammad
|
|
|
|
|
Hi
I have two MFC simple dialogue based exe. Say First.exe and Second.exe
I have put the code in my First.exe from which I start Second.exe using CreateProcess.....Like :
FirstDlg::OnInitDialogue()
{
..........
..........
CreateProcess("C:\Second.exe",.......);
..........
..........
return;
}
Now my problem is : After starting both the application the Second.exe receives the focus. I want to set the focus on my First.exe And for that I have used ::SetFocus(hWnd,0) function but am not able to do that.....still the second.exe receives the focus...any idea how to do this ???????
Advance in Thankx
Raj Mehta
India
|
|
|
|
|
Try this instead:
VERIFY (NULL != ::SetActiveWindow (AfxGetMainWnd()->GetSafeHwnd()));
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi
I have tried it but it doesn't works...
Any idea or any other functions that can give focus to my window
Regards
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Try waiting a couple of seconds (use Sleep() ) after starting the second app before calling SetActiveWindow() . It's possible that the first app does in fact become the active window, but eventually relinquishes that state to the second app.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I am having trouble overiding the default tooltip text that displays the tick count in a slider control.
My code is below. Any suggestion is greatly appreciated.
void CGraphView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
static CString strMinutes;
CToolTipCtrl *pTool;
if ((CSliderCtrl*)pScrollBar == &m_Slide &&
(nSBCode == SB_THUMBPOSITION || nSBCode == SB_THUMBTRACK)
)
{
pTool = m_Slide.GetToolTips();
strMinutes = "Test";
pTool->UpdateTipText(strMinutes, this);
pTool->Update();
}
CFormView::OnHScroll(nSBCode, nPos, pScrollBar);
}
sharpanil@yahoo.com
|
|
|
|
|
Hello,
I am using MSVC6 and have some trouble using the #pragma pack(...).
I have a header file where a structure is implemented:
<br />
#pragma once<br />
#pragma pack(push,8)<br />
<br />
struct MyStruct {<br />
};<br />
<br />
#pragma pack(pop)<br />
This structure I am using in two different cpp files in two different projects. If I am applying the sizeof() Operator to this structure in both projects I get two different results. Why??? I think I am using the #pragma pack directive properly.
By the way, the settings in "C++" -> "Code Generation" -> "Struct memeber alignment" is set to 8 bytes.
So has anyone an idea how this can be fixed???
Thank you very much for help
Chris
|
|
|
|
|
Try commenting the #pragma pack statements out and rebuild everything and see what happens.
You really don't need to do this if you are setting it to 8 though because that is the default.
Actually, it is a bit of a misnomer too. The compiler will align data members to the size of their type when this is selected. This is really only important when transmitting data structures between computers. However, you want to use the default whenever possible especially when using P4 processors. They can slow down considerably if their data is not aligned correctly.
|
|
|
|
|
It may not be related to packing but to something else. For example, the following struct will show different sizes if one of the projects is compiled for Unicode and the other is compiled for MBCS:
struct TheStruct
{
TCHAR buffer[20];
};
Also, many structures in the windows headers are defined with more or less members, depending on settings related to your target platform.
I'd suggest looking for things like that. You may, for example load this structure in each of the projects and inspect the contents in the Memory window while debugging.
--
jlr
http://jlamas.blogspot.com/[^]
-- modified at 1:05 Wednesday 31st August, 2005
|
|
|
|
|
I'm having a problem whne I try and register a control that is missing a component. It returns an exception error. It there an exception catch for the GetProcAddress?
Here's my code:
<br />
HINSTANCE dllhandle = NULL;<br />
HRESULT (WINAPI *lpfDllRegisterServer)();<br />
LPSTR pszFileExt = NULL;<br />
HRESULT hr = S_OK;<br />
<br />
pszFileExt = strrchr(pszFile, '.');<br />
if(pszFileExt)<br />
{<br />
pszFileExt++;<br />
if(stricmp(pszFileExt, "DLL") == 0 || stricmp(pszFileExt, "OCX") == 0)<br />
{<br />
dllhandle = LoadLibrary(pszFile);<br />
if(dllhandle)<br />
{<br />
lpfDllRegisterServer = (HRESULT(WINAPI*)())GetProcAddress(dllhandle, "DllRegisterServer");<br />
if(lpfDllRegisterServer)<br />
{<br />
hr = lpfDllRegisterServer();<br />
if(hr != S_OK)<br />
{<br />
CString strMsg("The following component failed to register.\n");<br />
strMsg += pszFile;<br />
AfxMessageBox(strMsg, MB_ICONEXCLAMATION);<br />
FreeLibrary(dllhandle);<br />
return FALSE;<br />
}<br />
lpfDllRegisterServer = NULL;<br />
<br />
}<br />
FreeLibrary(dllhandle);<br />
dllhandle = NULL;<br />
}<br />
}<br />
else if(stricmp(pszFileExt, "EXE") == 0)<br />
{<br />
char szCmdLine[MAX_PATH+1];<br />
sprintf(szCmdLine, "%s /RegServer", pszFile);<br />
<br />
STARTUPINFO startUpInfo = { sizeof(STARTUPINFO),NULL,"",NULL,0,0,0,0,0,0,0,STARTF_USESHOWWINDOW,SW_HIDE,0,NULL,0,0,0}; <br />
PROCESS_INFORMATION ProcInfo;<br />
<br />
CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, <br />
NULL,&startUpInfo, &ProcInfo);<br />
}<br />
}<br />
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi all,
I use SendInput() API function to simulate keyboard events, and it works good for sending one key at a time, however when I try to send ALT+CTRL+DEL keys I dont get anything, here is my code:
<br />
INPUT inKB[3];<br />
<br />
::ZeroMemory(inKB,3*sizeof(INPUT));<br />
inKB[0].type=INPUT_KEYBOARD;<br />
inKB[1].type=INPUT_KEYBOARD;<br />
inKB[2].type=INPUT_KEYBOARD;<br />
<br />
inKB[0].ki.wVk=VK_MENU;<br />
inKB[1].ki.wVk=VK_CONTROL;<br />
inKB[2].ki.wVk=VK_DELETE;<br />
<br />
SendInput(3,inKB,sizeof(INPUT));<br />
<br />
inKB[0].ki.dwFlags=KEYEVENTF_KEYUP;<br />
inKB[1].ki.dwFlags=KEYEVENTF_KEYUP;<br />
inKB[2].ki.dwFlags=KEYEVENTF_KEYUP;<br />
<br />
SendInput(3,inKB,sizeof(INPUT));
I also tried this method:
<br />
KeyDown(VK_CONTROL);<br />
KeyDown(VK_MENU);<br />
KeyDown(VK_DELETE);<br />
<br />
KeyUp(VK_CONTROL);<br />
KeyUp(VK_MENU);<br />
KeyUp(VK_DELETE);
Note that the above functions use SendInput too. I dont know where is the problem??
Also, I need to SendInput the Windows Key to pop-up the start menu, and I also want to SendInput the SystemMenu Key...................
I have headache from this, any feedback is welcome
|
|
|
|
|
Have you tried playing with the Scan Code parameter of the ki member of the INPUT struct ?
~RaGE();
|
|
|
|
|
Hi-
Thanx for ur reply, but what is the wScan variable for? I searched the net and found that in some codes its a VK code, while it is ignored in most codes and set to 0. Also it is not well commented in the MSDN.
wScan
Specifies a hardware scan code for the key. -MSDN
Another point is that if it is a VK code, then i can pass only two keycodes at a time, (one in wScan and the other in wVk member variable) but I need to pass 3 VK codes at once (CTRL+ALT+DEL)????????
I will be grateful if you could offer some code or a link at least.
Regards,
Mohammad
|
|
|
|
|
Try adding KEYEVENTF_EXTENDEDKEY for VK_MENU and VK_CONTROL. Maybe for VK_DELETE too:
static void SetKeyboardInput(INPUT& input, short key, DWORD dwFlags)
{
input.type = INPUT_KEYBOARD;
input.ki.dwExtraInfo = 0;
input.ki.time = 0;
input.ki.wScan = 0;
input.ki.wVk = key;
input.ki.dwFlags = dwFlags;
}
void SendCtrlAltDel()
{
INPUT inKB[3];
SetKeyboardInput(inKB[0], VK_CONTROL, KEYEVENTF_EXTENDEDKEY);
SetKeyboardInput(inKB[1], VK_MENU , KEYEVENTF_EXTENDEDKEY);
SetKeyboardInput(inKB[2], VK_DELETE , 0);
SendInput(3, inKB, sizeof(INPUT));
inKB[0].ki.dwFlags |= KEYEVENTF_KEYUP;
inKB[1].ki.dwFlags |= KEYEVENTF_KEYUP;
inKB[2].ki.dwFlags |= KEYEVENTF_KEYUP;
SendInput(3, inKB, sizeof(INPUT));
}
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Thanks friend,
but it really did not work, even with setting KEYEVENTF_EXTENDEDKEY for the del key. I am really confused and i spent lots of time on this...
Regards,
Mohammad
|
|
|
|
|
I've been investigating this a bit.
Conclusion (short version):
You can't simulate Ctrl+Alt+Del.
Conclusion (longer version):
You can't simulate it as a keyboard sequence.
The proper way to simulate a Ctrl+Alt+Del is posting a broadcast WM_HOTKEY message. However, for that to work, the calling thread must be part of the Winlogon desktop.
You could use SwitchDesktop, but that in turn requires your thread to not have any open window or hook set.
There's a trick to work-around this too, which is published in many places, and is based on the open source of VNC. Basically, it requires spawning a new thread, and since this thread won't have any window or hook, it would in theory be able to switch to the Winlogon desktop and post the WM_HOTKEY. Some window in this desktop would react to the WM_HOTKEY message and respond in the usual way.
However, before calling SwitchDesktop you need to use OpenDesktop to obtain the handle of the Winlogon desktop. Although I'm not sure if this used to work in previous versions, it definitely doesn't work in modern versions. I've tried with WinXP+SP2, and every call to OpenDesktop for "Winlogon", no matter which access rights you request, fails with "access denied". From what I've seen in many forums, it doesn't work for Windows 2000 either.
I've seen claims that this would still work if your process is running as "LocalSystem", but I'm not sure about that.
--
jlr
http://jlamas.blogspot.com/[^]
-- modified at 0:13 Wednesday 31st August, 2005
|
|
|
|
|
Hi!
I have an application where I used Chris Mounders Grid. There has never been any problem until the last windows uppgrade KB893803v2 for Windows 2003.
My application is compiled with Visual Studio .NET 2003 and all code is unmanaged C++ and I have a Resoure-Only DLL with all my application text and dialogs.
In one of my popup dialog I have a CGridCtrl. The text to the header is from my recourse file.
After KB893803v2 uppgade the header text don't show in release mode, but in debug mode it is visible. Even the data filled out in the grid is invisble in release mode, but if I make a Copy Text to my clippboard the information is visible.
Any idea how to solve this problem?
MSc Bertil Morefält
|
|
|
|
|
It is an add-in that embeds tabs into Visual Studio 6 IDE. Just like the tabs in Visual Studio .NET IDE, it provides you an easier way to switch windows in Visual Studio 6 IDE.
Please have a look at my website:
http://www.visual-studio-booster.com/[^]
Your comments and suggestions are appreciated. Thanks!
/*
An easier way to switch windows in visual studio 6 :
http://www.visual-studio-booster.com/
*/
|
|
|
|
|
why don't you post it as an article on CodeProject ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
That's a good idea, thanks!
/*
An easier way to switch windows in visual studio 6 :
http://www.visual-studio-booster.com/
*/
|
|
|
|
|
eh eh, i do my best for beest suggestions
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
oh, i've just realized that it's a shareWare...
can't we benefit the source code ?!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|