|
One key piece of information that may help people to help you is - how is the scanner attached to your PC, Serial cable, USB, FireWire, VMEBus, Bluetooth, WLAN 802.11.g &c
Once we've got that figured out I'd almost certainly suggest not writing the device communications stuff directly into your MFC app. Create a separate plain C++ Dll and possibly a stand alone test app to load it up and give it some exercise.
If you end up having to write a driver for your device remember there's a whole Driver Development Kit you can download from Microsoft with sample code and the like. Standards documents are also useful if you're dealing with a device that has to conform to some spec like USB or Ethernet.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
hi,
Thanks for ur reply
Its a USB Device and the driver for the device is already installed.so i think there is no need of writing a seperate driver for that.
Since i'm new to this subject can u please help me in providing some links for accessing a USB device
Thanks in advance
||SnAkeBed||
|
|
|
|
|
The way to work with USB devices is to first get the handle to the driver by calling the CreateFile functions. Once you have the handle, you can start exchanging data with the device by calling ReadFile and WriteFile (passing the handle). You can also exchange specific IO control codes with the driver by calling DeviceIOControl.
That's from a high level overview. You should have received documentation with the driver itself describing how to use it the driver (what are the IO control codes you can exchange with it, which name you need to pass to the CreateFile function in order to retrieve the handle of the driver, ...).
|
|
|
|
|
|
Where does that device come from ? Don't you have any driver supplied with it ? Any documentation that comes with the sensor ?
SnaKeBeD wrote: help me to find some links and tutorials for accessing Hardware in MFC
You almost never access hardware directly, except for things like devices connected to the serial port, but then the protocol is vendor specific and you won't find any generic tutorial.
|
|
|
|
|
hi
Thank you for ur kind reply.
There will be some way like accessing a camera with the default driver installed in the machine. I want something similar to that!!!!
||SnAkeBed||
|
|
|
|
|
drivers for that USB device is alrady installed
||SnAkeBed||
|
|
|
|
|
Then look on the website for the company that makes the scanner. They'll probably have documentation.
It's also possible that it acts just like an A4 scanner, only little and higher resolution.
In which case, maybe the driver comes with a TWAIN interface? I'm no expert on that.
Can you capture images using (eg) Photoshop? Did it come with applications?
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Hi,
I am creating a Winword document from a C++/MFC program and I need to lock the document so that the user can't change it afterwards. I have used the following code but it doesnt work. Anyone have any ideas what I am doing wrong?
TIA
Documents oDocs;
//Optional param
COleVariant vOpt(DISP_E_PARAMNOTFOUND, VT_ERROR);
oDocs = m_wordApp.GetDocuments();
m_document = oDocs.Add(vOpt, vOpt, vOpt, vOpt);
m_document.Activate();
// Then later...
COleVariant pw(pszPassword);
VARIANT v;
VariantClear(&v);
v.vt = VT_BOOL;
v.boolVal = FALSE;
// wdAllowOnlyReading appers to have a value 3 so thats what I use
m_document.Protect(3, &v, pw);
|
|
|
|
|
softwaremonkey wrote: ...change it afterwards.
After what?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thats spooky! It says I wrote "Change it afterwards". I have no idea what happened there.
Incidentally I am calling Protect as the last thing before saving the document.
|
|
|
|
|
I'm still unclear as to what you are asking. Are you wanting to password-protect a Word document?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry,
My application automatically generates a calibration sheet as a Word document which I need to make read only so that users can print it but cannot modify anything afterwards.
The automation API (if you can call it that) exposes the dcoument.Protect() method which works if I create a Word macro, but when I call it from my app, there is no error but it doesnt protect the document.
Hope that this makes more sense.
Thanks
Tony
|
|
|
|
|
I think I have solved this one. Protection is lost when the document is saved usin the SaveAs() method.
The solution was to use SaveAs(), then call Protect(), then call Save(). A little cumbersome but it works.
Thanks anyway.
|
|
|
|
|
Hey all...
I need to hide my standard output(Command prompt) while executing the exe..
I'm making a program which takes one parameter(URL) and start download(If available) in command prompt only..
I want to redirect tht particular output in my richTextBox and while writing to richTextBox i don't want command prompt to come..
Is it possible??
Seeking For Reply..
Thnks in advance..
Rock On \m/
|
|
|
|
|
I've not ever tried it, but can your make your console window a child of a hidden window?
If you are just downloading a URL in the background, what about creating a Win32 application having no window?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thnks for replying..
I'm not downloading URL..I am downloading data in tht URL...
like www.xyz.com/a.exe
So it begin to download the contents necessary for a.exe..By default it shows in console...But i need same data in my richTextBox i.e my richTextBox should work like console...
Ash..
|
|
|
|
|
So you have two separate applications?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hey all..
I'm novice in VC++... Just made a program which just ping to specific URL and print the output to richtextbox using RedirectStandardOutput...
My problem is tht whenever i try to execute my exe(Release version) it rund fine but if i try in some different computer it gives following error..
".NET Framework Initialization Error
To run this application, you must first install one of the following versions of the .Net Framework:
v2.0.50515
Contact your application publisher for instructions about obtaining the appropriate version of the .Net Framework."
Hope to see reply soon..
thnks..
|
|
|
|
|
Well, I think the error message is pretty explicit isn't it ?
You need to install the .NET framework on the target machine.
|
|
|
|
|
Thnks for your quick reply..
But i believe it's already installed...
Also in some computers it just do nothing..I mean when i click on exe it do nothing and in some machine it gives tht framework error..
Any idea bout tht??
|
|
|
|
|
I think u need to install the VC redistribute package on other machines
VC Redistribute[^]
|
|
|
|
|
Hi to all,
I have some questions,
1. In which case there is need to overload 'new' & 'delete', gloabally or within a class?
2. How to check memory leak in an application developed in C/C++?
3. What is difference between a MACRO variable & const variable in C/C++? As we can pass or return const variables to/from functions, Can we do same with MACRO variable?
4. Is the 'Data Abstraction' is feature of C++? Then what do u mean by 'Data Abstraction'? Creating new data types? But we can create new data types in C using struct/union, then why 'Data Abstraction' is not feature of C?
5. Can we do the operation performed by calloc() using malloc()? Is it valid?
int *l = (int*) calloc(12, sizeof(int));
int *m = (int*) malloc(sizeof(int)*12);
6. Scope of static & global variables in an application?
Thanks in advance,
Regards,
Aniket A. Salunkhe
modified on Tuesday, February 12, 2008 7:20 AM
|
|
|
|
|
Aniket Salunkhe wrote: 1. In which case there is need to overload 'new' & 'delete', gloabally or within a class?
Rarely.
Sometimes you want to have your allocation from a special heap memory.
Aniket Salunkhe wrote: 2. How to check memory leak in an application developed in C/C++?
In debug mode, the runtime does. It uses overloaded operator new for that!
Also, there are some source-code analyzers, who try to do the same.
But in the end it comes back to the programmer knowing what he is doing.
Aniket Salunkhe wrote: 3. What is difference between a MACRO variable & const variable in C/C++? As we can pass or return const variables to/from functions, Can we do same with MACRO variable?
A Macro is something like a search & replace you can do with the text-editor. It is done by the preprocessor before the compiler runs.
The compiler only ever gets to see the de-MACROed source. So, it has no notion whatsoever about MACROS.
So, the answer your specific question is:
No, you can not pass or return a MACRO. But we might devise a MACRO that does not give a compiler error when written instead of a parameter or return type.
Aniket Salunkhe wrote: 4. Is the 'Data Abstraction' is feature of C++?
I have no idea where you got that term from.
after reading wikipedia[^], I think you maybe mean abstract base classes?
Aniket Salunkhe wrote: Then what do u mean by 'Data Abstraction'? Creating new data types? But we can create new data types in C using struct/union, then why 'Data Abstraction' is not feature of C?
Because C does not explicitly have it as a feature?
Remenber, whil C++ can be expressed as C, C in turn can be expressed as machine language. Yet no one will call machine language abstract.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Thanks for the reply
|
|
|
|