|
What message (WM_....) is fired by windows when user "stops a hardware device". How to trap this message through VC++.
(Go to USB Icon->right Click->click on "stop" button->Ok)
so how will i detect this through my Application,
My Problem is
handle of USB drive has been used by a service so when i am trying to safly remove this USB so one error is occuring i.e "The device 'generic volume' cannot be stopped righ now. Try stopping the device again later".
So anyone can help me out to resolve it.
Thanks in advance
RYK
|
|
|
|
|
So your problem is to write a usb detector app or unplug your usb from the computer?
--
=====
Arman
|
|
|
|
|
Yaa, i have USB detector but when i am stoping USB then it is not being detected if the handle of USb is being used by service
|
|
|
|
|
First, my apologies for posting this again - it went unanswered in the VB forum so I am trying with a bigger audience here....
I have a VB.NET 2005 application that makes calls to a C/C++ (VC6) DLL and I have that part working fine. The C/C++ DLL makes use of callback functions to let the VB application know of unsolicited events and that works as well (the functions are at least being called). The problem is I don't know the proper parameters to use (either the C++ or VB side) to get a byte array from C++ back to VB.
I have tried the following:
<br />
C++ side: <br />
BYTE bArray[] = { 11, 12, 13, 14, 15 };<br />
int len = 5;<br />
pfnCallback(bArray, len);<br />
<br />
VB side:<br />
CallbackHandler(ByVal data() as Byte, ByVal len as Integer)<br />
This resulted in the data array length of 1 and it only had the first value of the array no matter how big my array was.
Then I tried:
<br />
C++ side:<br />
SAFEARRAY *psa; <br />
(then properly created psa, and data copied in)<br />
pfnCallback(psa);<br />
(then properly destroy psa)<br />
<br />
VB side:<br />
CallbackHandler(ByVal data() as Byte)
This resulted in the data array length of 1 and it had the first element of C's SAFEARRAY in it (cDim). I could not see my data.
Am I barking up the wrong tree? Is what I want to do possible? I tried ByRef and got exception errors as it jumped from native code to managed code. For the short term, I made a string showing the hexadecimal values of the byte array and passed the string from the C/C++ library back up to VB; that works fine for now....
Thanks in advance,
Paul
|
|
|
|
|
have you tried using an IntPtr on the VB side ?
CallbackHandler(ByVal dataPtr as IntPtr, ByVal len as Integer)
then, Marshall the data into your VB objects...
|
|
|
|
|
Hello,
Read the article on MSDN: “How to Pass Arrays between Visual Basic and C”. http://support.microsoft.com/kb/207931
Some more links:
1. "Passing an array from VC++ DLL to VB", by Amol Kakhandki on Code project. http://www.codeproject.com/dll/ctovbarray_passing.asp
2. http://www.manbu.net/Lib/En/Class5/Sub7/1/23.asp
Regards
|
|
|
|
|
Thanks! Everyone has been a great help and I have the code working now.
|
|
|
|
|
Hi all,
How to add Serbian (cyrillic) language support to VC 6.0. It is not taking the language as it is. For example "Sačekajte malo..." message is not being displayed in as it is in VC 6.0 where as it is working in VC2005.
Please suggest me if any support required.
Thanks and Regards.
Kishore
|
|
|
|
|
Y K Kishore Kumar wrote: For example "Sačekajte malo..."
Not that I want to nitpick, but "Sačekajte malo..." is Serbian latin, not Serbian cyrillic.
As for your question - have you compiled with UNICODE defined?
|
|
|
|
|
Thanks for the reply.
Yes. i have complied the code with UNICODE but still it is not working.
|
|
|
|
|
I have execute https://192.168.1.100/ address so I am using shell execute command but I should display any alert message when Page cannot be displayed in the internet exploxer window
hand=ShellExecute(m_hWnd,"open","https://192.168.1.100/",NULL,NULL,SW_SHOWNORMAL);
S.Yamini
|
|
|
|
|
Oho, I'm afraid you cannot. ShellExecute merely launches the IE with some address and the other part of job is for EI itself. Whether the address is valid/in use/or smth else only does EI know.
--
=====
Arman
|
|
|
|
|
|
Hi,
I am new to DB programming.
I get a dialog during the execution of programming when using Database
"Select Data Source" dialog.
I had already created a CDatabase object and initialized the DSN name, user name password in the OpenEx() call of it.
When I try to use the CRecordSet object to access the database, this dialog box pop up.
I cross checked the ODBC DSN name and it is set right. why this dialog box pops up in between..
Can someone help me out on this.
thanks,
|
|
|
|
|
What do your call(s) to CDatabase::OpenEx() and CRecordset::Open() look like?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Try opening the database using CDatabase::OpenEx and specifying the CDatabase::noOdbcDialog flag.
I have a feeling it's going to fail since the dialog is popping up because you haven't passed
enough info in your connection string. The flag will prevent the dialog from popping up
though!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello Friends,
I converted Control Panel MFC Dll VC++ 6.0 project into MFC Dll VC++ 2005.The project build successfully and it is working fine on windows xp, but when i executed on windows 2003 on OK/Cancel button click it gives error of "An Exception occur when trying to run Shell32.dll, control_run.dll".
The root of this problem according to my observation is- CImageList by which an object created as---
ImageState.Create(IDB_SELECTED_STATE,32,0,0);
m_listPartition.SetImageList(&ImageState,LVSIL_STATE);
If i hide first line then code works fine...
I want to know it is the problem of VS 2005 or Windows Platform
or i have to put particular service pack on m/c for that
as currently my m/c win2003 + service pack 1
Any comments on this problem............
|
|
|
|
|
Dear all,
i must read ye tiff image and draw histogram for it without using classes how can i do it at C++
thnx alot
ndadashi
|
|
|
|
|
Please be more certain. You mean without not 3th part library support or with no classes at all [the later seems meaningless though]? And what kind of histogram? What is the relationship between the tiff image and the histogram?
--
=====
Arman
|
|
|
|
|
I am bigener at c++, I need a comand for reding a file byte by byte, I cant use image classes
thnx
neda
|
|
|
|
|
Use std::ifstream to open the file and then use ifstream::read method to read bytes from the file.
--
=====
Arman
|
|
|
|
|
Is it more urgent then this question? The double posting let me assume so, generally it's better to ask a specific programming question... instead of asking others to do your homework or find a solution for a work assignment.
|
|
|
|
|
I don't want to do my homework, I am a beginer and I have problem reading a file byte by byte I just ask for some help
thnx for advise
neda
|
|
|
|
|
Reading a file byte by byte as absolutely nothing to do with drawing an histogram. So, your question is totally unclear.
A previous post already answered how to read the file.
|
|
|
|
|
ndadashi wrote: I don't want to do my homework, I am a beginer and I have problem reading a file byte by byte I just ask for some help
Oh please be frank, you have asked for a complete solution not how to read a simple file... here what I would suggest: Brake down your problem and try to ask specific technical questions if you get stuck. Let's look at your task:
1) open file and read it into memory
2) analyse image file format and e.g. decompress it to raw RGB data (e.g. use a library that provides that)
3) use histogram algorithm (very likely out of scope for this forum)
4) create a user interface that can output your data. If you want a graph of the historgram you should browse for custom controls here at CodeProject or alternatively write your own owner-draw control to do that.
5) extend your user interface to modify the histogram.... and further functionality you may want add to your application.
With each subtask it may be possible to help, now go get coding!!
|
|
|
|