|
This morning, I tried to create an instance for a Capture Graph Builder using the following code:
hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL,
CLSCTX_INPROC_SERVER, IID_ICaptureGraphBuilder2, (void**)&pBuild);
Unfortunately, it returns REGDB_E_CLASSNOTREG, which indicates "A specified class is not registered in the registration database. Also can indicate that the type of server you requested in the CLSCTX enumeration is not registered or the values for the server types in the registry are corrupt."
I check the corresponding registrey in WinXP, the CLSID_CaptureGraphBuilder2 is associated with the qcap.dll, which does not exist in WinCE.
Does anybody has the solution? Thanks a lot.
Jeffrey
|
|
|
|
|
Can anybody answer my question?
Thanks a lot.
Jeffrey
|
|
|
|
|
Hi, can anyone explain what does the program below do in MFC C++.
void CMediVisionView::OnFileSaveasraw()
{
// TODO: Add your command handler code here//
FILE *raw;
int n;
unsigned short sdata;
static char BASED_CODE szFilter[] = "DICOM Files (*.txt)|*.txt|All Files(*.*)|*.*||";
CFileDialog dlg_save_as(FALSE, "dcm", NULL, OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY, szFilter);
if(dlg_save_as.DoModal() == IDOK) {
raw = fopen("test.raw","a+b");
for (n=0; n
|
|
|
|
|
It shows that the person who wrote it doesn't know C++, but knows C.
It's very poorly written code to open a file dialog, and open a DICOM file which has been saved as a .txt file ( this is ridiculous ), and then it opens the file, and it scales every value by taking a new theoretical maximum value, and it assumes the old maximum was 256.
According to this, a RAW file is not 10 bit at all, it's just 8 bit, one byte per pixel.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can you advice on a better way to write this program?thks.
|
|
|
|
|
1. Don't put all variable declarations at the top of the function. C requires it, C++ does not, and it's ugly
2. ALWAYS give any variable you create a default value, when you create it.
3. Don't use crappy C FILE handles, use iostreams
4. Don't use a file extension with a known value and use it to store something totally different.
5. Don't integrate code into your code base if you have no idea what it does.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm trying to upload a file to its designated location. If the file already exists and is read-only it doesn't allow me to overwrite it. Before overwriting the file, I first check to see if it's READ-ONLY by calling GetFileAttributes(). Then I reset the attribute from read-only to normal. Somehow it doesn't return FILE_ATTRIBUTE_READONLY even when it's a read-only file. Instead it returns a value of 33. What does that value correspond to? And why is it that I can't remove the READ-ONLY attribute so that I can overwrite the file?
DWORD dwAttr = GetFileAttributes(filename);
if(dwAttr == FILE_ATTRIBUTE_NORMAL)
SetFileAttributes(filename, FILE_ATTRIBUTE_NORMAL);
CopyFile(source, dest, FALSE);
Thanks!
|
|
|
|
|
try :
if ((dwAttr & (FILE_ATTRIBUTE_READONLY)) != 0)
{
...
}
the return value from GetFileAttributes can contain multiple values (it's a bit mask).
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
So that worked but how can I remove the read-only attribute? I called SetFileAttributes(filename, FILE_ATTRIBUTE_NORMAL) but that didn't do the trick.
|
|
|
|
|
Could be that you don't have the necessary permissions / authority to change the attribute.
Look at the value returned by SetFileAttributes - that may give you an idea why the call did not do what you expected.
|
|
|
|
|
I am the administrator of my machine so permissions shouldn't be a problem. The SetFileAttributes(filename, FILE_ATTRIBUTE_NORMAL) returns 0. Am I missing something?
|
|
|
|
|
Nevermind. It works. Thanks for all your help.
|
|
|
|
|
So, don't keep us all in suspense.
What was the problem, and what was the solution?
|
|
|
|
|
Sorry...it was just my stupidity in changing the wrong file. Instead of changing the destination file's attributes, I changed the source file's.
|
|
|
|
|
Ah, I guess we will have to watch out for the same problem!
Thanks.
|
|
|
|
|
elephantstar wrote:
Instead it returns a value of 33.
Which is a combination of FILE_ATTRIBUTE_ARCHIVE and FILE_ATTRIBUTE_READONLY .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hello y'all,
Does one need Microsoft SDK to make a media player (say, for .AVI, .WMV, .MPG, etc.) or any particular headers/libraries? I'm used to Visual C++.
I thought I knew everything I needed to know to build a media player with my own interface design, but I'm a bit in the dark here.
Thanks in advance for helping me out, peeps.
Signed,
s9928863.
|
|
|
|
|
You want to write a media player from scratch, or use DirectShow, or use the Windows Media Player via COM ?
There are a lot of Microsoft SDKs, there is one for DirectX ( which is hte obvious one to use ), a Platform SDK ( useful esp if you have VC6 ), and many more.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm responsible for the development of a test application for a type of USB device. These devices sometimes need to reenumerate, for example when transitioning from firmware download to active mode. The device driver enumerates at \\.\<ourdev>USB-0 for the first device, \\.\<ourdev>USB-1 for the second device inserted and so on. But when multiple devices reenumerate simultaneously (happens when an automated test setup toggles the reset line on all devices) the order in which they reenumerate is not deterministic. That's dealt with by releasing the devices from reset sequentially, but I am trying to satisfy a feature request that the transport identifier used internally in the test application remain constant for a given serial number; basically the transport identifiers 'usb0', 'usb1' etc would be mapped to device paths \\.\<ourdev>USB-n using the devices' serial numbers.
Problem: I've been combing MSDN Library > Win32 and COM Development > System Services > Device I/O > SDK Documentation > Device I/O, especially the Device Management section in there, and I can't find any mention of obtaining serial numbers. A search of the whole MSDN library for "USB serial number" turned up lots and lots of unrelated hits, but nothing for how to get the serial number for a USB device.
Does anyone know how to do that? I know it ends up in the registry as a part of the plug and play device ID, but that would only be useful if there was a way to identify the registry entry for a given \\.\<ourdev>USB-n device path...
|
|
|
|
|
For being able to do that, you will need to work at the driver level. In fact, what is happening is that when you plug your USB device, the OS will 'ask' for it's ProductID and VendorID then look in all the inf files and look for the corresponding entry in one file (in summary...). In this file there is a match with the driver the OS need to load. And it's this driver that provides you the string with wich you open your USB device from an upper-level application (in fact, when you open your device in your application with CreateFile, you access the driver, not the device directly).
Thus, inside your driver you'll need to change the code to be able to associate the 'opening string' (\\.\USB-X) with a specific device. But there, I don't know exactly hoz you can do that... You will need to read a little bit nore informations about drivers
Hope this helps
|
|
|
|
|
I am trying to dynamically load MPR.DLL and use WNetGetUserA in a dialog-based app.
Here's my code:
typedef DWORD (*LPDLLUSER_FUNC)(LPCTSTR,LPTSTR,LPDWORD);
char name[MAX_PATH]="";
DWORD size=MAX_PATH;
HINSTANCE hLib=LoadLibraryEx("mpr.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if (hLib)
{
LPDLLUSER_FUNC lpDllEntryPoint = (LPDLLUSER_FUNC) GetProcAddress(hLib,"WNetGetUserA");
if (lpDllEntryPoint)
{
DWORD ret=(*lpDllEntryPoint)(NULL,name,&size);
char buf[10];
_itoa( ret, buf, 10 );
AfxMessageBox(buf);
AfxMessageBox(name);
}
FreeLibrary(hLib);
}
I get the following error:
"The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."
I assume my LPDLLUSER_FUNC define is wrong. But WNetGetUserA has the same definition.
Any ideas what to do here? Linking statically to MPR.LIB is unfortunatelly not an option.
|
|
|
|
|
try this:
typedef DWORD (WINAPI *LPDLLUSER_FUNC)(LPCTSTR,LPTSTR,LPDWORD);
/cadi
24 hours is not enough
|
|
|
|
|
Hi,
I have a simple question. I copied the following code into my own subclass of CFrameWnd:
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_IMAGEVIEWER_TOOLBAR))
{
TRACE0("Failed to create first main toolbar\n");
return -1;
}
The toolbar shows up but all the buttons are disabled. I did not want to write UPDATE_COMMAND_UI handler for each button because I never plan on disabling most (if not all of them). What am I missing from my code? For any SDI app you create in the wizard the toolbar shows up with buttons enabled. I copied the same code and it doesn't work for me.
Thanks.
|
|
|
|
|
You have to have code to handle the command generated by a click on the button. If there is no code in your program to handle the click, the button will be disabled.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|