|
if unsigned DWORD64
if signed LONG64
|
|
|
|
|
Is there any way for a program to be able to determine what port a USB device is plugged into? Or at least to be able to determine that a USB device has been plugged into a different port from last time?
What about a filter driver? Does that know the port details?
|
|
|
|
|
|
Create a handler for the WM_DEVICECHANGE[^] message. You do not need to call RegisterDeviceNotification[^] to get notification for device insertion and removal.
Once you get a device insertion notification you can do a complete USB enumeration to check in which port your device is inserted.
Look at the USBView sample in the Windows Driver Kit (WDK) for enumerating USB devices.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
HI
i want to make the usb device read only
i already opened the handle for the usb device
now i need to send scsi command to usb device to make it read only
aftert that i will appy dacl to that
now i need to know which scsi command i need to pass to the usb device
and how can i pass that command to usb device using DeviceIoControl
i am using VC++ and visual studio 2005
thanks
Anil Veeraghattapu.
|
|
|
|
|
|
Hi,
Now i using the GetProfileStringW to read the values in registry. But before that i must manually create a registry key in regedit and give it a value. If not when run GetProfileStringW, the program will got error.So,is that any way or function can auto generate the registry key in MFC environment?
|
|
|
|
|
Use the registry APIs instead of GetProfileString.
Look at the documentation for Registry Functions[^].
For example, you can create/open registry keys using RegCreateKeyEx , you can read registry values using RegQueryValueEx etc.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
|
Hi All,
I need to implment a callback to a Nonstatic member function of a class.
Which will be invoked through a DLL.DLL is an independent library.No dependency with the class.
I Implemented with a static function. I need to know how it will be for a non static member function.
My code is as follows for static implementation. I need to change it for a non static .Please help.
class CCallbackTester
{
public:
static int __stdcall CompareInts(const byte* velem1, const byte* velem2);
};
int __stdcall CCallbackTester::CompareInts(const byte* velem1, const byte* velem2)
{
int elem1 = *(int*)velem1;
int elem2 = *(int*)velem2;
if(elem1 < elem2)
return -1;
if(elem1 > elem2)
return 1;
return 0;
}
int main(int argc, char* argv[])
{
int i;
int array[] = {22, 1, 3210, 2109, 1098};
Bubblesort((byte*)array, 5, sizeof(array[0]),
&CCallbackTester::CompareInts);
cout << "After the sorting\n";
for(i=0; i<5; i++)
cout << array[i] << '\n';
getch();
}
in DLL Bubblesort is as follows.
void DLLDIR CALLBACK Bubblesort(byte* array, int size, int elem_size, CompareFunction cmpFunc)
{
for(int i=0; i<size; i++)
{
for(int j=0; j<size-1; j++)
{
if(1 == (*cmpFunc)(array+j*elem_size, array+(j+1)*elem_size))
{
byte* temp = new byte[elem_size];
memcpy(temp, array+j*elem_size, elem_size);
memcpy(array+j*elem_size, array+(j+1)*elem_size, elem_size);
memcpy(array+(j+1)*elem_size, temp, elem_size);
delete [] temp;
}
}
}
}
Thanks
San
|
|
|
|
|
A non-static member function is very much dependent on its class.
So you cannot use it for callbacks.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
One way is to do this is like many callback procedures do - they pass along a user specified argument as a void pointer (PVOID). You can pass a pointer to one of your objects as the argument and use a static member of the same class for the callback procedure. Then in the callback procedure cast the void pointer to a pointer to your object and call your member method. As an example, your callback procedure could look something like this :
class YourClass
{
static int CompareCallback( ctchar * item1, ctchar * item2, void *ptr )
{
if( ! ptr )
return 0;
YourClass * pObject = (YourClass *)ptr;
return pObject->Compare( item1, item2 );
}
};
BTW : you can use this technique in a wide variety of callback scenarios like for thread procedures or window enumeration procedures or ...
|
|
|
|
|
Hello,
I have been working with the Watchport/V2 and Eyetoy webcams. All the reolutions and modes work fine with AmCap but I prefer the simplicity of StillCap for quick photos for a youngster's science project documentation.
The default resolution for StillCap seems to be 320x240 for images saved. I would prefer displaying and saving 640x480.
I used the Visual Studio 2003 Resource editor to increase the displayed size for the StillCap dialog box and the two webcam views.
I have poked around through the source code but cannot find where the camera resolution is set. How do I specify the webcam resolution to be 640x480, preferably as the default?
Thanx,
Tom
|
|
|
|
|
HI,
i have a TabCtrl which is created using Create function(using control variable) but not using resource...
Now how can i increase the font inside the TabCtrl
|
|
|
|
|
Have you tried using the WM_SETFONT Message[^]?
::SendMessage(hwndYourTab,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
|
|
|
|
I just wanna know how to share a big file, 3-4G
when using FileMapping, I only can share a file that not bigger than 1.5G
if bigger than that, I got an error of ERROR_NOT_ENOUGH_MEMORY
Thanks!
|
|
|
|
|
What exactly do you mean by share a big file?
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I forgot.
It means to share a big file between multi-process
so all the processes can read the file
Thank you!~
|
|
|
|
|
You could use CreateFile[^] with FILE_SHARE_READ|FILE_SHARE_WRITE as its share mode parameter.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
not that problem
when I create a file mapping that the file is bigger than 1.5Gb
the CreateFileMapping return ERROR_NOT_ENOUGH_MEMORY
And I was wondering if I can map a big file (3-4G) to share in one time
that's what I want
for example I have a 3G file and 100 people wanna read it
so I wanna share it
that's the situation
Thank you !~
|
|
|
|
|
Instead of mapping the file to memory, all 100 people can read it from disk using CreateFile and the share flags.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
speed is important
IO is slower than file mapping
that's why I wanna use it
Best Wishes
One day I will get what I wish by working hard
|
|
|
|
|
I would recommend reading the Microsoft article Creating a File Mapping Object[^]
Specifically the 'File Mapping Size' section where it states the following:
The size of a file mapping object that is backed by a named file is limited by disk space. The size of a file view is limited to the largest available contiguous block of unreserved virtual memory. This is at most 2 GB minus the virtual memory already reserved by the process.
Best Wishes,
-David Delaune
|
|
|
|
|
Thank you so much
I read the book Programming Applications for Microsoft Windows by Jeffrey Richter
but biside file mapping
Is there another way to share a big file in one time
I always wanna find a better way
|
|
|
|
|
I think you should re-evaluate your application requirements. Do you *really* need to share 3 Gigabytes of a file between multiple processes? Why not share small sections of the file as needed? Have a look at the sample:
Creating a View Within a File[^]
You could use a similar technique and share 250 megabytes or more of the file at a time.
Best Wishes,
-David Delaune
|
|
|
|