|
Hi
I have many sample files (of opencv) and I try to modify them so that I can get used to it. But the sample has only .c file and I need to build .cpp file to run it but I do not know how to build the .cpp file from the .c file.
Please help me.
Thank you
|
|
|
|
|
Why do you want to transform a C source file into a C++ one?
Anyway, if you simply change the file extension (to cpp ), the Visual Studio C/C++ compiler is able to differentiate.
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're welcome.
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]
|
|
|
|
|
Use of Visual studio 2008.
|
|
|
|
|
eg.
in .idl
[id(1), helpstring("method test")] VARIANT_BOOL test([optional] VARIANT width, [optional] VARIANT height);
in .h
VARIANT_BOOL test(VARIANT width=100, VARIANT height=100);
When the parameters omit, I want them to be 100 by default.
The statement above is not right, how to write it correctly?
Thanks.
logics
|
|
|
|
|
|
My App (essentially a Cash Register App) prints during the course of a transaction to a number of Printers. AuditJournal ,Receipts , Labels, Statements. The printers may all be identical makes and models, and are connected via the USB Port. The End User may at will 're-organise' the USB Field Wiring (although hopefully not while a printjob is in progress).
The End User may also 'forget' to plug cables back in.
I need to get a DC for each printer. and I do NOT want to use:
CPrintDialog::DoModal() . The latter would give the End User's employee the chance to send the Audit Journal Print job to say, the Label Printer.
This question is not about how to print as such, have done that many a time!
Now,
-How do I create a DC to a Specified Printer without CPrintDialog::DoModal();
-How do I Differentiate between the printers.
-Is it possible to determine in advance, if say the AuditJournal Printer is actually Plugged In, Switched on, and contains Paper before a transaction Starts.
Regards
Bram van Kampen
|
|
|
|
|
|
PJ Arends wrote: CreateDC()
OK, but, how or where do I get values for lpszDriver, lpszDevice, lpszOutput initially, so that I can distinguish between four identical printers.
Bram van Kampen
|
|
|
|
|
EnumPrinters() is one way.
What I did in my app was have the user first select which printer to use for which report type (via the print dialog at setup time) and then save the settings in a config file (driver, device, port, devmode). I use CreateDC to create the printer dc. If the user physically moves the printer so that the saved setting are no longer valid I pop up the print dialog again if the CreateDC function fails.
|
|
|
|
|
Thanks,
That sounds like a good startingpoint. Going to give it a Try!
Regards,
Bram van Kampen
|
|
|
|
|
Do you know if there is any way of extracting the Manufacturers Serial Number from the Printer. That would facilitate automatic detection if printer cables get plugged out and in. At end user level, staff would be neither trained nor qualified (security wise within our(i.e. not windows)security architecture) to decide which physical printer should take what stream. I envisage that if this is left to staff at all, that at some stage somewhere, the Audit Journal will be sent to the Label Printer.
Regards,
Bram van Kampen
|
|
|
|
|
|
I can't seem to make it work ...
Any way you can do this ? I can send you 25$ via paypal asap .
I am not that good with C++
|
|
|
|
|
sodevrom wrote: I can send you 25$ via paypal asap .
Well, you seem to insist on seducing us with money. Send it to me, but, as I have no Paypall Account, could you email me a few bottles of wine to the value instead? I'll share them with the other contributers on a first call first served basis.
sodevrom wrote: I can't seem to make it work ...
Any way you can do this ?
Nobody asked you to make anything work relating to printers (which is what this thread is about)!
sodevrom wrote: I am not that good with C++
?????
Are you per chance answering the wrong thread ?
Regards,
Bram van Kampen
|
|
|
|
|
Yes, this is a helpfull link, but mainly for initial setup. Printer Selection must be fully transparent to staff. BTW do you know of a way of extracting the Manufacturers Serial Number of the Physical Printer?
Regards,
Bram van Kampen
|
|
|
|
|
Hello,
A few months ago I asked a friend to make me a DLL that I can use in a programming language that I use (BlitzBasic).
This dll made it possible for me to use multiple mices (mouse) on a single PC, and detect them in my game.
The DLL works great and I have the source code. Unfortunatly I am not a C++ expert, I tryed to make the DLL work with TouchScreen Monitors (elotouch.com), but I just can't .
Can someone help me ?
The DLL works great, it detects when a user clicks, it detects multiple touchscreens, but it simply does not detect the X and Y coordinates. They are always 0.
I am sure that this is becouse the touchscreen does not work like a mouse.
Can someone help me with this ? I am making a school project with 3 other friends, and none of us can't seem to fix this.
The friend that made the DLL has moved to another school ... and he can't help us.
I can pay someone about 25$ (this is how much I have on paypal) if he can help.
Thank you very much.
PS: If someone thinks he can help, I will send you the source asap .
|
|
|
|
|
sodevrom wrote: I can pay someone about 25$ (this is how much I have on paypal) if he can help.
Well, That's not how this forum works, and just as well for you. At the current going rate, you just might get one line of code out of your $25.00, but, don't worry, your funds are safe. I just answer this question because you struck a chord of interest in me.
sodevrom wrote: A few months ago I asked a friend to make me a DLL that I can use in a programming language that I use (BlitzBasic).
This dll made it possible for me to use multiple mices (mouse) on a single PC
Don't understand that! Does that mean that you have several mousepointers on the screen? Or does it mean that you can have several physical mouses (mice) connected to the one computer, each moving the same single screen pointer.
sodevrom wrote: I asked a friend to make me a DLL that I can use in a programming language that I use (BlitzBasic).
sodevrom wrote: The friend that made the DLL has moved to another school ... and he can't help us.
Well, Join the Club. That always happens! The Crucial Question always is: Do you have the Source Code, Program Notes etc. Yoo have learned now that a 'friend' who donates a binary without those things is actually an Enemy.
sodevrom wrote: I asked a friend to make me a DLL that I can use in a programming language that I use (BlitzBasic).
The DLL sounds as if it was written in 'BlitzBasic'. why do you think that a CPP Forum can Help you. I Personally have never heard of the language, but maybe, despite it's name, its actually an MFC Library.
Have you 'Googled' for 'BlitzBasic' There is always the possibility that your 'Friend' instead of writing the dll, downloaded it, or downloaded sample code and modified it.
Regards
Bram van Kampen
|
|
|
|
|
Hello,
Thank you for your response, and sorry if I insulted the forum with my topic .
The DLL is writen in C++, and it was made specialy for BlitzBasic, but you can use it just as well in a C++ application.
The source is not very commented, but it's only one Cpp file, that handles everything. The code is not hard, I understand it, but what I don't understand is how I can make it work with a touch screen monitor.
The DLL works detects all mice (physical) that are plugged in the computer. So you can have a logitech mouse and an a4 tech (or any other .. up to 10 mice) .
In my game, I draw 2 different cursors, on position X and Y of the specific mouse. So you view 2 different cursors, and they move independently.
Below I will give you some links, maybe (if you have time) can help.
Here is a document from ELO touch, on the touch screen monitors :
http://media.elotouch.com/pdfs/manuals/program.pdf
Here is a simple APP that works with multiple mice (just connect 2 mice on your PC and start moving them after you start the app).
http://www.sodevrom.net/sample.zip
Here is the CPP file (I have the SLN for Visual Studio, and if you think you can help, I will link that also).
http://www.sodevrom.net/RawInput.cpp
Thank you very much
|
|
|
|
|
sodevrom wrote: The source is not very commented, but it's only one Cpp file, that handles everything. The code is not hard, I understand it, but what I don't understand is how I can make it work with a touch screen monitor.
Can you Publish the code on this Forum. It'll give us something to go by.
sodevrom wrote: The DLL is writen in C++, and it was made specialy for BlitzBasic, but you can use it just as well in a C++ application.
Well, the jury is out on that one! String representation in CPP and Basic are entirely different.
sodevrom wrote: http://www.sodevrom.net/sample.zip
Here is the CPP file (I have the SLN for Visual Studio, and if you think you can help, I will link that also).
http://www.sodevrom.net/RawInput.cpp
Before I read this, Is that the code your unapproachable friend gave you?
regards,
Bram van Kampen
|
|
|
|
|
Hi,
Yes, this is the code made by the "unapproachable" friend .
The code is to large to post it in this topic, I uploaded the entire Visual Studio project here :
www.sodevrom.net/proj.zip
Just unzip and run SLN .
BlitzBasic is a game making software. The ideea is that it can only work with INT and STRINGS, and that's why the DLL automaticaly converts INT and STRINGS passed by my game, in whatever he needs to work.
So this is not a problem the DLL (the source if you compile it) works now perfectly, as I sayed, but it only works with multiple mouse (mice) .
The thing is I need it to work with touchscreen monitor.
Thank you
|
|
|
|
|
In the init() function he sets RidInputDevice[0].usUsage = 2, this will only capture mouse messages.
Change RidInputDevice[1] to RidInputDevice[2] at start of file and init RidInputDevice[1] in init() with usUsage = 1 (pointer).
In ProcessInputData() you _may_ need 'if( ... dwType == RIM_TYPEHID )' to catch the messages, you shouldn't, pointers are considered 'mouse like' (mouse and pointer both HID_DEVICE_SYSTEM_MOUSE).
Set a breakpoint in ProcessInputData(), touch the screen, look at the data.
You'll likely need to do more. Read the MSDN doc's about the RAW input API.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Hello,
I am trying to make this work for over 1 week now, and no luck.
I made the modifications you sayed + more.
I made the source compile to exe (console) so I can keep track of the data.
I attached a window to the console, and whenever I move the mouse/click in the window, the console prints what is happening.
The problem is that when I connect the touchscreen, and use RIM_TYPEHID , it does nothing.
I set a simpel cout<<"AA"; whenever it gets in the if RIM_TYPEHID branch, but it never does.
Any suggestions ? help ?
I also noticed that the riRawInput.data.mouse.lLastX; (and Y) for the mouse are always values that change to 0, so they are showing the motion of the mouse.
When I touch the touchscreen, the values go up to 5 000.
I don't know what to say ... I just need the touchx/y absolute position (or relative).
I hope someone can help.
Thanx
|
|
|
|
|
I managed to make it work.
I didn't have to make ANY Changes (add a new raw device).
The check :
riRawInput.data.mouse.usFlags == MOUSE_MOVE_RELATIVE is for mouse
and the check
riRawInput.data.mouse.usFlags == 3 is for touch screen.
After getting this, you will have to calibrate the device, and all will be perfect :
1. Prompt the user to touch the upper left corner of the video screen.
2. Save the coordinates returned as TOUCH_UL_X and
TOUCH_UL_Y.
3. Prompt the user to touch the lower right corner of the video screen.
4. Save the coordinates returned as TOUCH_LR_X and
TOUCH_LR_Y.
A good way to prompt the user to touch the corners is to draw a
border around the edge of the screen and prompt the user to touch
each point using a target in the respective corner and text centered
on the screen.
5. Calculate the four calibration parameters as follows:
OFFSET_X = TOUCH_UL_X
OFFSET_Y = TOUCH_UL_Y
SCALE_X = VIDEO_MAX_X / (TOUCH_LR_X -
TOUCH_UL_X)
SCALE_Y = VIDEO_MAX_Y / (TOUCH_LR_Y -
TOUCH_UL_Y)
6. Save the four calibration parameters to a nonvolatile storage area, if
available. If none is available, the calibration procedure must be
followed each time the system is powered up.
The floating point calibration procedure is now complete. In your
application program, convert the touch coordinates reported by the
touch system into the equivalent video coordinates with these equations:
VIDEO_X = SCALE_X * (TOUCH_X - OFFSET_X)
VIDEO_Y = SCALE_Y * (TOUCH_Y - OFFSET_Y)
|
|
|
|
|