|
Short of writing your own code (using RegEnumKey() and RegEnumValue() ), check out the utilities here at CP, and the one here.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thanks
|
|
|
|
|
Does anybody know how to determine what caused WM_QUERYENDSESSION Windows session end message sent:
- system shutdown request;
- system reboot;
- system power off;
- reboot in MS DOS (on Win9X)?
It seems, WM_QUERYENDSESSION has only one parameter, which allows to determine the case of the user log-off. Any way to get more information?
Thanks,
Viktor
|
|
|
|
|
Hi all,
I have a class CMyBtn inherites from CButton. i want to draw it myself....
I have 4 bitmaps for each state - normal/down/over/disabled
I've tried to place code in OnPaint as follows:
void CMyBtn::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetWindowRect(rect);
BITMAP bmp;
HBITMAP hBitmap = NULL;
memset(&bmp,0,sizeof(bmp));
switch (m_eBtnState)
{
case bsUndefined:
ASSERT(FALSE);
return;
case bsNormal:
hBitmap = (HBITMAP)m_bmpNormal.m_hObject;
break;
case bsDown:
hBitmap = (HBITMAP)m_bmpDown.m_hObject;
break;
case bsOver:
hBitmap = (HBITMAP)m_bmpOver.m_hObject;
break;
case bsDisabled:
hBitmap = (HBITMAP)m_bmpDisabled.m_hObject;
break;
default:
ASSERT(FALSE);
return ;
}
::GetObject(hBitmap,sizeof(bmp),&bmp);
HDC compatibleDC = CreateCompatibleDC(dc.m_hDC);
HBITMAP hSavedObj = (HBITMAP)::SelectObject(compatibleDC,hBitmap);
ASSERT(NULL != m_pParentDlg);
COLORREF transparentColor = m_pParentDlg->GetDialogTitleBKColor();
ScreenToClient(rect);
BOOL bRes = TransparentBlt(dc.m_hDC,
rect.left,
rect.top,
rect.right,
rect.bottom,
compatibleDC,
0,
0,
bmp.bmWidth,
bmp.bmHeight,
transparentColor);
::SelectObject(compatibleDC,hSavedObj);
::DeleteDC(compatibleDC);
}
the button picture of the bitmap is round button. when i looked at the button on the dialog i saw the round button but with gray frame (the part that was outside the button) that made me believe it was a problem of erasing the backgroun so i've added the following code:
BOOL CMyBtn::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
now i saw the button really good.
problem is when i move the mouse or click it i don't see the pictures changing as they i want them to.....
what should i do?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
|
Thanks for the reply....
i've already managed without the buttonst help
thanks again
cheers
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi !
I am ran into a great problem I can not solve.
How can we set IP over two modems that are connected togheter ?
A BIG thanks in advance.
|
|
|
|
|
find it out yourself or ask more special questions about it!
Don't try it, just do it!
|
|
|
|
|
Hello, everyone!
When using the following program to check in/out band width of a network adapter, the band width is always zero. Anyone know how to resolve the trouble?
Source Code:
----------
#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <pdh.h>
#include "iphlpapi.h"
#include "Iptypes.h"
#include "Iprtrmib.h"
#pragma comment(lib,"iphlpapi.lib")
int main (int argc, char** argv)
{
unsigned long pOutBufLen = sizeof (IP_ADAPTER_INFO);
IP_ADAPTER_INFO AdapterInfo;
memset (&AdapterInfo, 0, sizeof (IP_ADAPTER_INFO));
MIB_IFROW ifrow;
DWORD last_sent, last_recv, current_sent, current_recv;
DWORD diftime, dlwinspeed, upwinspeed, dw_refreshtime;
if( GetAdaptersInfo(&AdapterInfo, &pOutBufLen) != ERROR_SUCCESS ){
printf("Could not open default interface!");
return ( 0 );
}
ifrow.dwIndex = AdapterInfo.Index;
if( GetIfEntry( &ifrow ) != NO_ERROR ) {
printf("Could not open default interface!");
return ( 0 );
}
while (1)
{
current_sent = ifrow.dwOutOctets - last_sent;
current_recv = ifrow.dwInOctets - last_recv;
last_sent = ifrow.dwOutOctets;
last_recv = ifrow.dwInOctets;
printf ("Octs out: %ld\n", ifrow.dwOutOctets);
printf ("Octs in: %ld\n", ifrow.dwInOctets);
diftime=(GetTickCount()-dw_refreshtime);
dlwinspeed = current_recv/diftime;
upwinspeed = current_sent/diftime;
dw_refreshtime=GetTickCount();
printf ("Band in: %ld\n", dlwinspeed);
printf ("Band out: %ld\n", upwinspeed);
Sleep (5000);
}
return 0;
}
----------
Thanks in advance,
Geo
|
|
|
|
|
When I compile my .exe the compiler give me this error:
"error LNK2020: unresolved token (0A0000FD) SysStringByteLen"
"error LNK2020: unresolved token (0A000101) SysAllocStringByteLen"
This problem occur when I set the proprety project "Treat wchar_t as Built-in Type" (in th C/C++\Language Menu) to "No". My project use Managed Extensions and C# class.
I try (how is described in MSDN) to include "oleauto.h" and to link oleaut32.lib, but it was all in vain.
Thank you very much for any answer.
|
|
|
|
|
Anyone knows how SysIternal's FileMonitor gets it's information?
TIA
Peter
"Vierteile den, der sie Hure schimpft mit einem türkischen Säbel."
mlog || Agile Programming | doxygen
|
|
|
|
|
hey peter
this is a good question, and i have the answer.
it is using a file system filter hook!
you can email me if you want further help...
greez, alex
Don't try it, just do it!
|
|
|
|
|
Not exactly (other than what is shown here), but I've e-mailed Dr's Russinovich and Cogswell in the past and they have been helpful. They obviously don't give away trade secrets, but if something is available and it is just rather hard to find, it shouldn't be a problem. They might even point you to one of their books.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
"On Windows NT the heart of Filemon is a file system driver that creates and attaches filter device objects to target file system device objects so that Filemon will see all IRPs and FastIO requests directed at drives."(http://www.sysinternals.com/ntw2k/source/filemon.shtml):
also known as File System Filter Driver (Hook)!
Don't try it, just do it!
|
|
|
|
|
And you sent this to me because?? I know what their site says, which is why I referenced it in my reply. If that paragraph is a good enough description of what is going on, fine. If not (which I assumed was the case), contacting the author(s) is the way I'd go.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I've ben pondering your sig for a while now.
Either you're tricking me - or there's something I'm missing
would "two birds" be an inappropriate answer?
"Vierteile den, der sie Hure schimpft mit einem türkischen Säbel."
mlog || Agile Programming | doxygen
|
|
|
|
|
peterchen wrote:
would "two birds" be an inappropriate answer?
decided to fly away != actually did fly away
I got caught by that too.
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
We're figuring out the parent thing as we go though. Kinda like setting up Linux for the first time ya' know...
[Nitron]
|
|
|
|
|
Hello!
How is the memory allocated when using new ? The problem is that I have to allocate many single entries which are very small and I don't know now how that will affect memory consumption and speed.
For example:
Will
int i;
for(i = 0; i < 1000; i++)
p[i] = new DWORD[1]; waste much memory than if I would use
p = new unsigned char[4000]; Actually the entries aren't that simple and the code above should be meant just as an example. If I want to allocate lets say 16 bytes, does the memory allocation routine round that number up somehow and allocate more than I need?
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
i don't know how it is alloced, it's heap memory, so prolly by malloc.
use the debugger and follow the new call to find out, how it works!
Don't try it, just do it!
|
|
|
|
|
The first example will eat *much* more memory than the second.
Heaps are typically organized as a list of memory blocks that are either used or available. Since you might want to free the allocations in the first example individually, it needs to keep some extra information for each allocation.
The first one can slow down a program considerably, first because of memory footprint, second because searching for a matching free block takes longer (because there are much more blocks to look at). Many allocations of that small size are not recommended from the normal heap.
However, you can use a custom allocator that better fits your needs.
"Vierteile den, der sie Hure schimpft mit einem türkischen Säbel."
mlog || Agile Programming | doxygen
|
|
|
|
|
Ok, thank you Then I will have to do some sort of custom allocator.
Dominik
Btw: der Link zum Agile Programming tut nicht mehr direkt
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Dominik Reichl wrote:
If I want to allocate lets say 16 bytes, does the memory allocation routine round that number up somehow and allocate more than I need?
Yes.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi guys,
I can't believe how much hassle I'm having trying to trap a user's confirmation of a CEdit entry. I have a toolbar with a CEdit control on it. Ideally the user should only input numbers.
What's the best strategy to catch the obligatory ENTER confirmation? I create the toolbar and CEdit control in CMainFrame, but CMainFrame doesn't get any of the key notifications.
Any ideas?
Many thanks,
S
Multimedia programmer, trying to learn a grown-up language!
|
|
|
|
|
Do you get the key notifications in PreTranslateMessage of your CMainFrame before they go to the edit control etc. If you do, you can trap and process them there.
Roger Allen
Sonork 100.10016
Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.
|
|
|
|
|
Thanks Roger, that worked great.
Multimedia programmer, trying to learn a grown-up language!
|
|
|
|