|
It's working now!
Thank you very much!
|
|
|
|
|
hi can anyone tell me
how can i get & send data to
a USB port from a VC++ application
thank you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
You do not send data to the USB port, you send data to the device attached to the USB port.
The tigress is here
|
|
|
|
|
Logically true
I have an embeded device attached to the USB my
work is to ensure the data reach to the port rest
is the firmware developers work.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Communication on the USB port is made through a device driver. So, you need to get a handle to this driver (with CreateFile) and then use some IO commands (with DeviceIOControl). Normally you should have a driver with your device and the doc that goes with it.
-- modified at 8:13 Wednesday 9th November, 2005
|
|
|
|
|
Hi
I've never wrote an MDI app so this will probably sound like a silly question:
I am using Visual Studio 6. I want to write an MDI program where the documents are dialogs that I design - with buttons, lists, edit boxes, combos etc.
I have no clue how to do that. I've been searching for examples but could not find any.
I tried creating an MDI app and then desinged dialog. Using the class wizard I tried to create a class for that dialog, derived from CView. I then changes the call to the RUNTIME_CLASS macro to use my new class, but I am getting compilation error.
thanks!
|
|
|
|
|
You can create your view derived from CFormView, where you can place the controls as you do in dialogs.
|
|
|
|
|
Hi,
I am using Visual Studio 6. I want to write an MDI program where the documents are dialogs that I design - with buttons, lists, edit boxes, combos etc.
Actually, documents cannot be dialogs. Moreover this statement makes no sense. Documents are to store data that would be viewed by Views. And saying document you understand a class derived from CDocument. In other words, you might want your views contain dialog controls. It is possible though in case you have a CView derived class, you will not be able yo perform WYSIWYG. So,
you may perform dialog templates with the necessary controls on it and create the dialog object as a child control (dialog) for the views.
Or something may be done with CFormView derived classes.
--
======
Arman
|
|
|
|
|
Microsoft has done a great deal of work to help developers but
should have added a simple learning structure to it.
U can search the MSDN for and example project whose folder name
is viewex.
U will get a hint for what u need this is a simple example for
a class dervied from CFormView.
Thank you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
I use function "MCIWndSetVolume" to adjust sound volume. And it works well for MP3. But it returns error message "device doesn't support..." for Wave and Midi. Can I adjust volume for Wave and Midi files using MCI ???
thank you for help.
|
|
|
|
|
Try using these functions instead, you can control each 'line' of the sound system WAVE, MIDI, etc. separately.
Audio Mixer Functions
The following functions are used with audio mixers.
mixerClose
mixerGetControlDetails
mixerGetDevCaps
mixerGetID
mixerGetLineControls
mixerGetLineInfo
mixerGetNumDevs
mixerMessage
mixerOpen
mixerSetControlDetails
|
|
|
|
|
Hey all, I have a little project I am messing around wiht, it just wraps up some winapi functions in c++ classes. I just changed all the std::string's to std::wstring and all my literal string have L"string" now. And UNICODE and _UNICODE are define. Anyway, everything compiles and runs. the only proplem is nothing renders. Buttons do not show and text control do not show, the only thing that shows in the scroolbars for the textarea.
Any ideas, I bet it is something simple i am missing. Hope you guy and girls have something to point me to.
Cheers
|
|
|
|
|
Well, one thing that instantly comes to my mind, is that buffer byte sizes, that were previously calculated using std::string::size , must now be calculated using std::wstring::size * sizeof(wchar_t) :
const std::string s1("non unicode");
const std::wstring s2("unicode");
const size_t bytesize1 = s1.size() * sizeof(char);
const size_t bytesize2 = s2.size() * sizeof(wchar_t); and, of course, bytesize1 != bytesize2 .
This in combination with memcpy , memset , etc. is a common trap when changing to unicode.
--
The Blog: Bits and Pieces
|
|
|
|
|
If your code always used the underlying string type's value_type , you would be always able to determine per-element size (and thus any buffer size requirements) correctly - there is no requirement that basic_string only contain narrow or wide char acter types:
typedef std::basic_string< int > IntStr;
int iValue = 1024;
IntStr isInt( &iValue );
const std::wstring s2( L"unicode" );
const std::string s1( "non unicode" );
const size_t stByteSize1 = s1.size() * sizeof( std::string::value_type );
const size_t stByteSize2 = s2.size() * sizeof( std::wstring::value_type );
const size_t stByteSize3 = isInt.size() * sizeof( IntStr::value_type ); Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Thanks Johann and James. I look for size calculation errors tonight, I beleive that may be part of the problem. As for memory functions, I am not using them currently (i'll double check though).
Thanks
|
|
|
|
|
I answered nitpickingly correct at first, but decided that it would be easier to read the answer if I used char /wchar_t and size_t , because your
const size_t stByteSize1 = s1.size() * sizeof(std::string::value_type);
const size_t stByteSize2 = s2.size() * sizeof(std::wstring::value_type); is only half correct:
const std::string::size_type stByteSize1 = s1.size() * sizeof(std::string::value_type);
const std::wstring::size_type stByteSize2 = s2.size() * sizeof(std::wstring::value_type); is correct. And now it's easy to see, for the sake of this exercise, that char /wchar_t and size_t makes reading and understanding easier. But still not correct.
James R. Twine wrote: typedef std::basic_string< int > IntStr;
Ohhh... dangerous! Using that correctly to get expected results, means that you probably also need to have a char_traits specialization for int to get where you want.
--
The Blog: Bits and Pieces
|
|
|
|
|
You are correct about needing to use the class' size_type type to get the correct variable type.
The example I gave for using a string class for int types was contrived - I just wanted to demonstrate the use of value_type . But you are correct there as well - more would need to be done to make a completely usable IntStr type.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I have an Intenet Explorer toolbar and I want to display a bitmap on it. I used the button separator to make room for the control in the toolbar and I can display text in the CStatic, but when I try to display an image the whole CStatic is painted with a single color. I think it is the first pixel color of the bmp.
I use the following code:
//in the header file:
<br />
CStatic anonTitle;<br />
//in the cpp file
<br />
anonTitle.Create("",WS_CHILD | WS_VISIBLE | SS_BITMAP | SS_CENTERIMAGE, rcTitle,this));<br />
<br />
CBitmap anonPic;<br />
anonPic.LoadBitmap(IDB_BITMAP3);<br />
anonTitle.SetBitmap((HBITMAP)anonPic.m_hObject);<br />
anonPic.Detach();<br />
If I use the code from a MFC application it works. But in the toolbar the whole static is painted with only one color.
I have also tried with :
<br />
anonTitle.Create("",WS_CHILD | WS_VISIBLE | SS_BITMAP | SS_CENTERIMAGE, rcTitle,this));<br />
anonTitle.SetBitmap( ::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_BITMAP3)));<br />
and
<br />
CString str;<br />
str.Format(_T("#%d"), IDB_BITMAP3); <br />
anonTitle.Create(str,WS_CHILD | WS_VISIBLE | SS_BITMAP | SS_CENTERIMAGE, rcTitle,this));<br />
and still same result.
Desperate help needed.
Best regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
ok managed to solve it - by mistake of course.
aparently if you remove the SS_CENTERIMAGE style it all works fine.
I gues there are some things I will never coprehend.
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
I am using the following code to allocate dynamic double dimensional array
double **ImagePro;
try
{
ImagePro = new double*[width];
for(int i = 0; i < height; i++)
{
ImagePro[i] = new double[width];
}
}
catch(CMemoryException* ex)
{
ImagePro = NULL;
ex->ReportError();
return FALSE;
}
and for deletion
for(int i = 0; i < height; i++)
{
delete ImagePro[i];
}
delete ImagePro;
return TRUE;
My problem is whenever the height is greater than width I get assertion error message
Pls Help
|
|
|
|
|
Hello.
Try changing:
ImagePro = new double*[width];
to
ImagePro = new double*[height];
|
|
|
|
|
Did you try this ?
for(int i = 0; i < height; i++)<br />
{<br />
delete[] ImagePro[i];<br />
}<br />
delete[] ImagePro;
And wich part of the code is asserting ?
|
|
|
|
|
delete[] ImagePro is not working
I get assertion in "delete ImagePro;"
|
|
|
|
|
You should, since
delete ImagePro[0];
Is the same as
delete ImagePro;
So when you the delete ImagePro, its already deleted.
|
|
|
|
|
It works fine when the height and width are equal or if the height is less than width
The error occurs only when the height is greater than the width.
BoundsChecker displays an error message "Dynamic memory overrun"
|
|
|
|