|
Take a look at this article[^]. Hook the functions CreateProcessA and CreateProcessW (in KERNEL32.DLL) for the whole system. When your functions get called, perform your processing, then call the default function. I think it should work well enough.
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
I am having a very difficult time understanding exactly how regions and region handles work. I noticed in MSDN:
"After a successful call to SetWindowRgn, the system owns the region specified by the region handle hRgn. The system does not make a copy of the region. Thus, you should not make any further function calls with this region handle. In particular, do not close this region handle."
I am wondering if this is the source of my problem. I have created an owner drawn button which is round and I have found some code to scan the bmp and make a region out of it using a transparent color setting. The button loads fine but minimizing the window and restoring it brings up the color that is supposed to be transparent.
Here is the code for my WM_DRAWITEM message:
case WM_DRAWITEM:
switch(pdis->CtlID)
{
case ID_BUTTON:
hdcMem = CreateCompatibleDC(pdis->hDC);
SelectObject(hdcMem, hBitmapMin);
SetWindowRgn(hwndMinimize, hMinRgn, TRUE);
BitBlt(pdis->hDC, 0, 0, 19, 19, hdcMem, 0, 0, SRCCOPY);
DeleteDC(hdcMem);
break;
...
}
The same also happens if I click on the button but...I realized that if I omit the DeleteDC call then the button isn't altered by my clicking on it, only when minimizing. Another interesting fact is that despite the button being redrawn square the hotspot still remains in the original circle which means that the region I assigned is still there correct? But then why would the window be painted outside of it's region? Can anyone see any stupid mistakes I might be making? The code works perfect on the main application window, it's just giving me hell for my buttons. Thanks...?
P.S. The source for the region creation is here
|
|
|
|
|
(Whoops the network disapeared, so I'll try this again)
I have been ask to create an installation program, with InstallShield 2.11, that automaticaly uninstalls previous version if any. Does any one know how to do this?
Note: I know where the UninstallString is located on my system, but different version of Windows often use different locations to store same information.
Trust in the code Luke. Yea right!
|
|
|
|
|
I'm trying to get the RECT of the taskbar by calling SHAppBarMessage with the ABM_GETTASKBARPOS parameter from my NT Service. Sometimes the correct RECT is returned and sometimes only zeroes are returned. Does anyone know why? And if so, how can I always get the right RECT?
Thanks
|
|
|
|
|
This is definitely just a guess, but is your NT service configured to interact with the desktop? Maybe it has to be that way to properly access the task bar?
~Steve
|
|
|
|
|
The service is definately configured that way since i'm able to place icons in the system tray. It just doesn't make sense that I can't get the RECT of the taskbar.
--- time passes ---
I figured out an alternate way of doing it.
RECT tbRect;
GetWindowRect(FindWindow("Shell_TrayWnd",NULL),&tbRect);
This seems to do the same as the SHAppBarMessage call.
|
|
|
|
|
I have an SDI app in MFC that, when started, I want the window to remain hidden. Currently I am calling m_pMainWnd->ShowWindow(SW_HIDE); from the MySDIApp::InitInstance() function.
What currently happens is, the window is displayed for a split second, then goes away as I'd like it to (from there everything is working correctly). How do I avoid this flash of the window? Is there something I need to do before the InitInstance is called, and if so, how do I do that?
Thanks!!!
~Steve
|
|
|
|
|
|
Perfect! Thanks!!!
~Steve
|
|
|
|
|
I have control that somewhat resembles a tree,
where each control node have one or many group nodes (CGroupNode), and each group node have one or many leaf nodes(CLeafNode).
New requirement is: Decouple control from data.
So that there will be: CTreeControl(draw gui, sends actions) and CTreeDataProvider provides data about group, leaf nodes to CTreeControl.
Any suggestions on what pattern shall I use?
Brian
|
|
|
|
|
I use the Bridge pattern as described by the GOF Book for exactly this. The tree has no idea what it's data source is or what it is displayed. There is an abstract tree container class for this, and the derived class provides the tree data upon request.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
I'm trying to generate file names in a loop:
char fName[10];
for(int i=1;i<5;i++)
{
fName = "file" + i + ".txt";
// rest of the code...
}
is it possible?
Please help.
Thanks.
|
|
|
|
|
CString fName;
for ( i=1; i < 5; i++)
{
fName.Format("file%d.txt", i);
}
===============================
C:
char fName[256];
for(int i=1;i<5;i++)
{
sprintf(fName, "file%d.txt", i);
}
|
|
|
|
|
|
Working with a frame grabber and I have to grab an image at a given point in time (software trigger). Can grab the image save it as a bitmap, jpg etc... The problem is this is of a high speed moving object and it needs deinterlacing. everything I have tried is failing. I objects movement is always horizontal. This cannot be as hard as I am making it, can it?
Scott
|
|
|
|
|
Check out the CxImage library . Maybe it does what you want !
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
|
At this point I am not... That is what I am looking to do. I cannot use an external tool as this is part of an integrated application. Therefore I have been working on methods of deinterlacing use odd scan line averaging. This does not work all that well. "Yet"
|
|
|
|
|
Ok, you experienced programs will probably get a laugh out of this one but here goes anyway:
Is there any way to have an owner drawn list box be a bitmap (I have successfully loaded it and everything) but still use LB_ADDSTRING and all the other Win32 messages that work on standard list boxes?
When I say bitmap, basically a nicely drawn square "window" with a nice border and nice shading?
If not, what are, if any, the Win32 messages analogous to WM_CTLCOLORLISTBOX that will change the scroll bar and the vertical strip that it lies on...and also the black border around the list box (if created with CreateWindow...)
Thanks in advance.
|
|
|
|
|
You can subclass the listbox and then handle the WM_NCPAINT ! It handles the border and no client region drawing ! In MFC it`s way much simpler ! Derive a class from CListBox and in the WM_NCPAINT do this for a cool border :
FrameRect(HDC,&clientRect,GetSysColorBrush(COLOR_HIGHLIGHT))
with the toolbar ... i didn`t have much luck on it either !
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
Thanks for that one...subquestion: does your book of knowledge extend a little into regions and how to properly set them for owner drawn buttons so they can be circular instead of square? I have a posted a thread on this: Regions, but haven't gotten any replies unfortunately...
|
|
|
|
|
I have need to convert double values to string representations that exclude a presentation of a decimal and can provide a variable number of significant digits. Should I develop a class to do this or is there some easier/faster way?
double ValueA = 3.9876;
CString TwoSigDigits = "39"
CString ThreeSigDigits = "398"
CString FourSigDigits = "3987"
If it helps the double values will always be positive and less than 1000.
Thanks.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
I don't know of any available code, but it seems like all you need is a function to convert doubles to strings with a given number of significant digits. First you need to round the value and then add insignificant zeros if required.
If you need help writing this code, let me know.
Regards,
Alvaro
Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com
|
|
|
|
|
Thanks Alvaro. I'll put a class together to do the stuff. It'll be a nice relaxing way to spend the afternoon Maybe I'll post it next week as an article.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
CString z, a;
a.Format("%f", ValueA)
a.Remove('.');
z = a.Left(N);
|
|
|
|