|
hi all,
i am using a function to retrieve the drive letter of a USB drive from WMI with the deviceID i have with me, as it is with the specific deviceID and the corresponding drive letter, i create a file to monitor activities on the USB.
the deviceID which i have with me is in the format "USB\\VID_0980&PID_762A\\..." which i retrieve at the moment a USB drive is inserted. in my function i take this deviceID as input and map the drive letter corresponding to it.
as i have looked upon and subsequently found out that the mapping of drive letter in WMI has been done by taking the deviceID in the format "USBSTOR\\DISK&Ven_TOSHIBA&PROD_TRA........".
the DeviceID "USBSTOR\\DISK&Ven_TOSHIBA&PROD_TRA......." can be achieved from WIN32_PnpEntity.DeviceID and also from WIN32_USBControllerDevice.Dependent
the DeviceID "USB\\VID_0980&PID_762A\\..." can be retrieved from WIN32_PnpEntity.DeviceID and also from WIN32_USBControllerDevice.Dependent.
although both these deviceID are from the same USB device the mapping for drive letter is done thorugh the previous one i.e "USBSTOR\\DISK&Ven_TOSHIBA&PROD_TRA......."
and i am not getting a link between these two DeviceIDs.
so please can i get some help on how to retrieve the drive letter of USB device using the device ID "USB\\VID_0980&PID_762A\\..."
Thank You.
|
|
|
|
|
Hi,
i´ve the same problem at the moment. Did you find a solution yet?
|
|
|
|
|
Hello everyone
Happy new year!
Here is my problem:
I have 2D images where each pixel data is stored in an unsigned short (16bits) but the information in the image never exceed 12 bits. For compression purpose, I would like to save in file only 12bits for each pixel of my images.
Have you experience the same problem? any idea on how to do so?
Thanks
Alf
----------------------
|
|
|
|
|
alfalf3 wrote: Have you experience the same problem?
No.
alfalf3 wrote: any idea on how to do so?
Yes: write a couple of functions, for instance:
BOOL SaveBmpTo12BitsFile(HBITMAP hBmp, HANDLE hFile);
HBITMAP LoadBmpFrom12BitsFile(HANDLE hFile);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You can use the below code to convert 2 unsigned shorts (4 bytes) into 3 bytes.
unsigned short s1 = 10;
unsigned short s2 = 20;
BYTE b1 = (s1 & 0x0FF0) >> 4;
BYTE b2 = (s1 & 0x000F) << 4;
b2 |= (s2 & 0x0F00) >> 8;
BYTE b3 = s2 & 0x00FF;
s1 = b1 << 4;
s1 |= (b2 & 0xF0) >> 4;
s2 = (b2 & 0x0F) << 8;
s2 |= b3;
«_Superman_»
|
|
|
|
|
Thank you _Superman_ (sounds weird )
I found a way (not the smartest I think) without bit shift:
typedef struct _PackedUShort
{
unsigned char b0 : 4;
unsigned char b1 : 4;
unsigned char b2 : 4;
unsigned char b3 : 4;
} PackedUShort;
typedef union
{
unsigned short us;
PackedUShort pack;
} PackedData;
packBuf = (PackedData*) myImageBuffer;
resultBuf = (PackedData*) malloc(sizeof(PackedData) * newSize);
for(i=0; i<imagesize;>{
int position = j % 4;
switch(position)
{
case 0:
(*resultBuf).pack.b0 = (*packBuf).pack.b0;
(*resultBuf).pack.b1 = (*packBuf).pack.b1;
(*resultBuf).pack.b2 = (*packBuf).pack.b2;
break;
case 1:
(*resultBuf).pack.b1 = (*packBuf).pack.b0;
(*resultBuf).pack.b2 = (*packBuf).pack.b1;
(*resultBuf).pack.b3 = (*packBuf).pack.b2;
resultBuf++;
break;
case 2:
(*resultBuf).pack.b2 = (*packBuf).pack.b0;
(*resultBuf).pack.b3 = (*packBuf).pack.b1;
resultBuf++;
(*resultBuf).pack.b0 = (*packBuf).pack.b2;
break;
case 3:
(*resultBuf).pack.b3 = (*packBuf).pack.b0;
resultBuf++;
(*resultBuf).pack.b0 = (*packBuf).pack.b1;
(*resultBuf).pack.b1 = (*packBuf).pack.b2;
break;
}
j+=3;
packBuf++;
}
}
----------------------
|
|
|
|
|
Hi Friends,
I have a dialog based MBCS application which creates the EDIT control over the dialog using CreateWindowExW API to support languages like Chinese, Japanese etc.
When I paste the Chinese characters into the EDIT control, it displays it correctly.
I call the GetWindowTextW to extract the content from the control into a wchar_t buffer.
But the debugger is not showing the value unless I call CharToOemW. What CharToOem does on that buffer? I would like to know more details with a functional comparison of APIs, WideCharToMultiByte and CharToOem.
Thank you
cheers
Varghese Paul
|
|
|
|
|
Please check whether you have enabled - "Display Unicode strings" option under Tools > Options > Debug tab.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
All multi-byte functions work on char buffers and not on wchar_t buffers.
«_Superman_»
|
|
|
|
|
Varghese Paul M wrote: But the debugger is not showing the value unless I call CharToOemW. What CharToOem does on that buffer?
I think that the CharToOEM function is converting the string buffer from UTF-8 into the default codepage on your operating system.
Code Page Identifiers[^]
Code Pages[^]
Code page[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Hi, I'm able to set the text and the background color of the text for Status bar, but I'm not able to set the color for the 'seperator' of the status bar.
I have 3 column on the status bar, each of the text and background I'm able to set it but have no luck on the 'seperator'
I've done it by creating a custom status bar inherited from CStatusBar
By drawing it on DrawItem
CODE:
CDC oDC;
CDC* pdc = CDC::FromHandle(pDIS->hDC);
pdc->FillSolidRect(&pDIS->rcItem, RGB(255,255,255));
oDC.Attach(pDIS->hDC);
oDC.SetTextColor(RGB(255,0,0));
oDC.SetBkColor(pDIS->itemData);
pDIS->rcItem.left += 2;
oDC.DrawText(_T("Test"),&pDIS->rcItem,DT_LEFT);
oDC.Detach();
Any ways to do this?
I wanted to change the whole status bar into white color RGB(255,255,255)
Any help would be appreciated.
KH
good
|
|
|
|
|
Is there any ways for me to set the seperator on the status bar become smaller?? by default, the width of it is 0.1cm
Or can I disable/remove the seperator between the item in the status bar ??
good
modified on Tuesday, January 13, 2009 3:03 AM
|
|
|
|
|
Did you try to handle the WM_CTLCOLOR to change the status bar color?
«_Superman_»
|
|
|
|
|
Do i Change the WM_CTLCOLOR on my CCustomStatusBar or on the MainFrm ?
KH
good
|
|
|
|
|
Hi all,
in VC++ by default the charcter set property for project is Use Unicode Character Set.
i want to knoe that which one is more efficient between Use Unicode Character Set and Use Multi-Byte Character Set for SDI type application.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
totally depends upon your requirement,if application need international character support, it need to be unicode aware.You don't have any choice.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
apology for my previous comment, both support International characted. But it totally depend on choice.
MBCS and Unicode[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
UNICODE.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: UNICODE.
good 5 point for
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I guess you didn't notice Iain's Post[^]...
Regards,
Sandip.
|
|
|
|
|
You guessed right, I missed it...Ooops, wait a minute, I never miss anything! I'm a god, after all!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ThatsAlok upport CRY- Child Relief and You
Hi Alok,
So happy to see another CRY Supporter!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Unicode would be more efficient because Windows internally uses Unicode.
«_Superman_»
|
|
|
|
|
What I'm using:
VC++ Version 6
MFC AppWizard (.exe)
What I have so far:
When I click a [Shuffle] button, the routine below creates the cards,
shuffles the deck, deals four cards and stores the position in deck
of the last card used .
============================
<pre>
void CAHADlg::OnShuffle()
{
int counter;
int pick;
// Creates Cards
CString card[53];
card[1] = "AS";
card[2] = "2S";
card[3] = "3S";
-----------------------
card[52] = "KH";
// Shuffles Cards
CString deck[53];
for(counter=0;counter<53;counter++)
{
deck[counter]="";
}
for(counter=1;counter<53;counter++)
{
pick=(rand()%52)+1;
while(deck[pick] != "")
{
pick=(rand()%52)+1;
}
deck[pick]=card[counter];
}
// Deals Cards and stores number of cards used
// deck[0] = position in deck of last card used
m_me1=deck[1];
m_dealer1=deck[2];
m_me2=deck[3];
m_dealer2=deck[4];
deck[0]="4";
UpdateData(FALSE);
}
</pre>
============================
What I want to do next:
Click on a [Draw A Card] button and have the routine:
Access the value of deck[0]
Convert the value of deck[0] to an integer and store the integer in variable int n.
Add 1 to n
Access the value of deck[n] and store it in m_me3
Convert the new n value to a string and store it in deck[0]
============================
What I don't know:
Object programming
How to access and change the value of an element of a foreign (same program, different routine) array
Would there me any difference between accessing or changing a foreign int array and accessing or changing a foreign string or char array?
|
|
|
|