|
int ColorNo[3];
ColorNo[0]=COLOR_BTNFACE;
ColorNo[1]=COLOR_WINDOW;
ColorNo[2]=COLOR_SCROLLBAR;
COLORREF Colors[3];
Colors[0]=RGB(25,50,0);
Colors[1]=RGB(255,255,0);
Colors[2]=RGB(255,255,0);
::SetSysColors(3,ColorNo,Colors);
I don't know why only COLOR_SCROLLBAR is useless. but else is validated.
I want to change the scrollbar color by modifying Windows XP theme, and I know someone make it successfully by this way.
|
|
|
|
|
|
1st of all, i am a newbie to Directshow programming..
i need to create a console program that detects audio from microphone..
in the code, i have a function which reads all the audio input device that i have.
and it returns the friendly name (as string) of the device that the microphone is plugged in.
below is the function code.:
string Get_FName(GUID DEVICECLSID)
{
HRESULT hr;
ICreateDevEnum *pDeviceEnum = NULL;
IEnumMoniker *pEnumCat = NULL;
wstring inname;
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED );
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,IID_ICreateDevEnum, (void **)&pDeviceEnum);
if (FAILED(hr))
{
}
hr = pDeviceEnum->CreateClassEnumerator(DEVICECLSID, &pEnumCat, 0);
if (hr == S_OK)
{
IMoniker *pDeviceMonik = NULL;
ULONG cFetched;
while(pEnumCat->Next(1, &pDeviceMonik, &cFetched) == S_OK)
{
IPropertyBag *pPropBag;
hr = pDeviceMonik->BindToStorage(0, 0, IID_IPropertyBag,(void **)&pPropBag);
if (SUCCEEDED(hr))
{
VARIANT varName;
VariantInit(&varName);
hr = pPropBag->Read(L"FriendlyName", &varName, 0);
if (SUCCEEDED(hr))
{
inname = varName.bstrVal;
hr = pDeviceMonik->IsRunning(0,0,0);
if ( hr == S_OK){ goto skip;}
}
VariantClear(&varName);
pPropBag->Release();
}
pDeviceMonik->Release();
}
pEnumCat->Release();
}
skip:
pDeviceEnum->Release();
string s(inname.begin(), inname.end());
s.assign(inname.begin(), inname.end());
return s;
}
the problem is that, i have two input devices..
Microphone (Realtek...
Realtek (Audio ...
the program does not return the friendly name of the device which i plugged my microphone in. it simply returns the later device.
i need a code that detects wether the device is plugged in or not..thank in advance
|
|
|
|
|
Hello Friends
I want to add a Image as a object on image so that I can Pick and drag-Drop anywhere on Image in MFC.Or Is there any function in GDI?
Any Ideas?
Thanks & Regards
Yogesh
|
|
|
|
|
Basically what you have to do is to create a memory device context and then load a bitmap into this device context.
You can then draw any other shape or bitmap onto the memory device context which you can then save to disk.
Here is an example (VB code)-
http://www.vb-helper.com/howto_memory_bitmap_draw_type.html[^]
|
|
|
|
|
Thanks For ur Reply.
Regards
Yogesh
|
|
|
|
|
How do I obtain an HBITMAP handle to a bitmap image that I have previously loaded into a region of memory?
I want to keep the bimtap file encrypted on disk, and only decrypt it in memory.
|
|
|
|
|
|
Hello folks.
Do you know if there is anything like a GUID (Globally Unique IDentifier) for optical discs, CDs and DVDs and if yes, how would one go about retrieving this in VC++? Actually what i'd like to do is recognize the disc once it is loaded into an optical drive to e.g. have an autorun function that can be enabled/disabled per disk (program would respond on WM_DEVICECHANGE, query GUID, check against database and if enabled, autorun the disk, if not enabled, then do nothing, just an example).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Code-o-mat wrote:
Do you know if there is anything like a GUID (Globally Unique IDentifier) for optical discs, CDs and DVDs...
Check out:
HKLM\SYSTEM\ControlSet001\Control\Class\{4D36E965-E325-11CE-BFC1-08002BE10318}
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
The key you pointed out holds informations about the CD/DVD drive... What the enquirer seems to ask for is something like an identifier of the disc
|
|
|
|
|
Sauro Viti's right, i meant the medium itself, not the drive.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
HDDs have a unique number stamped on them during manufacturing, but I'm not aware of any such thing existing for CDs and DVDs, especially those that the user creates.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Me neither, but i thought i ask, maybe someone knows better, thanks anyways for your reply.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Somewhat off-topic, but here's an interesting link[^] to a what happens when someone thinks they can come up with a way of uniquely identifying all CD's.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Thanks for the link, just read it, it's instructive. It's easy to be smart afterwards, but i wonder why they didn't originally think of identifying discs, i mean, it's quite obvious it can be useful in certain situations. On the other hand, if i had generated a GUID and written it to a file called "DISC.GUID" in the root of every disc i ever burned then i'd be smarter now, but hey, who would ever think it could be useful sometimes in the future...
I wonder what alternatives there could be...like scanning the first 10 file names + file sizes and generating a hash of those, or somesuch, but such aproaches might turn out to be rather slow. The ID itself doesn't have to be unique on this planet, just around my home.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Code-o-mat wrote: The ID itself doesn't have to be unique on this planet, just around my home.
Try something like one of these[^]
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
That's a good one, and damn the "programmer mind", i even started thinking how one could mount a web camera above the optical disc drive's tray and write a program that recognizes and reads the number stamped onto the disc as it passes...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
This scheme might work for a limited set-up; it basically tries to identify a CD by hashing as few sectors as possible.
1. have a central database that stores one record per CD, holding a unique ID (auto assigned), a sectorCount number, and a CRC number. Also have a table that holds one number: numberOfSectors (it will start at 1, and increase monotonically over time).
2. have an app that allows to add new CDs to the system.
3. have a library that supports the recognition of known CDs.
The add-a-new-CD algorithm would be like so:
1. read first few sectors (as determined by numberOfSectors).
2. for all occurring values of sectorCount, calculate CRC, and search DB for a match.
3. if none found, simply add the new disk, and terminate.
4. if one found with sectorCount<numberOfSectors, flag it as no longer valid; add the new disk; goto 5.
5. for the flagged disks, re-process them (this will yield a new CRC over a larger number of sectors).
The recognize-a-CD algorithm would be like so:
1. read first few sectors (as determined by numberOfSectors).
2. for all occurring values of sectorCount, calculate CRC, and search DB for a match.
3. if one found, that is it.
4. if none found, this is an unknown CD, you can't handle it, you need the aad-a-new-CD algorithm.
Possible refinement:
on top of the above, you could also store the "total CRC" of a CD, so when one isn't recognized according to the above, you could still recognize it by brute force, then suggest the user officially adds it to the DB.
|
|
|
|
|
Sounds reasonable, thanks, will digest it some.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
you're welcome.
|
|
|
|
|
I have an MDI application with CView based on CZoomView , based on CScrollView . In CMyView::OnKeyDown(...) I try follow :
void CMyView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
int x = -1;
switch(nChar)
{
case VK_DOWN:
x = SendMessage(WM_VSCROLL,SB_LINEDOWN,(LPARAM)0);
TRACE("\n %d \n",x);
break;
default:
break;
}
CZoomView::OnKeyDown(nChar, nRepCnt, nFlags);
}
the output of TRACE is 0 , but still the window scroll don't work ... why ?
P.S. Of course , thw window have horizontal and vertical scroll .
|
|
|
|
|
Whether CMyView is derived from CScrollView?
Величие не Бога может быть недооценена.
|
|
|
|
|
Well , this is the project , with CMyView derived from CZoomView ... it will be a difference about this problem ?
|
|
|
|
|
if CZoomView is derived from CScrollView then no problem.
Величие не Бога может быть недооценена.
|
|
|
|
|