|
Hey guys,
I want to test my firewire card using a C program. I do that for my Ethernet and Serial ports using WIN API's like ReadFile, WriteFile etc. but I was not able to find any such stuff for firewire. Please help me out with this.
Cheers
|
|
|
|
|
Does this[^] help (I see it is a bit dated...)?
Veni, vidi, vici.
|
|
|
|
|
Hi,
I have a picture control on a dialog box in MFC. I'll load an image onto that picture control. I'll draw a line on that image. I want to perform undo/redo functionality in for the drawing. I have done that by saving the bitmaps at each point in LButtonDown, but that thing was not working as when I click on Undo, reload the previous image, I can'n continue drawing the line. If I draw a line, it will not be the same line it will be drawn as a new line.
Can anybody have an idea regarding this.?
Regards,
|
|
|
|
|
Assumed your document has
- a background picture as its file name (drawn first)
- a list of your drawing objects (drawn after)
then an undo operation would meen just the removing of the tail list element and a refreshing
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
If you draw the line in XOR mode, redrawing the same line will erase it.
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
Hi,
I'm newbie here. I wanted to create a SDI MFC application with 3 views in one window. The layout is like this
=======
+ 1 +
-------------
+ 2 + 3 +
=======
1. List View
2. Tree View
3. Tab control with list view
Can anyone help me on how to design this window at first place. Either using Splitter or Window Explorer option.
Thank you
modified 1-Aug-12 21:30pm.
|
|
|
|
|
It could be a splitter window (2 + 3) in another (1 + (2 + 3))
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
May be the solution is also thinkable for you :
- An MDI app
- The Tabed MDI list-views controlled by the selection in your tree control
- The Tree control is in a pane (CDockablePane) controlled by the selection in your main list control
- The Main list control is in a pane as well
- The layout of the MDI-area and panes is controlled by the Users and remanent for them
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
create three different custom window-class and create those window on the main window when required
|
|
|
|
|
Unless you absolutely have to have ONLY 3 views why don't you use standard CSplitter CreateStatic and create CSplitter frame with 4 views?
Than let the MFC do the dirty work. No need to customize anything.
|
|
|
|
|
Thanks. I managed to do the 3 views splitter windows. 
|
|
|
|
|
Great, can you share the basic idea / code?
I was thinking 1 column / 3 rows would also work if it is acceptable.
|
|
|
|
|
I just got the idea from this article:
http://www.codeproject.com/Articles/190/A-Visual-Framework-Views-Tabs-and-Splitters
Basically I just wrote this in the MainFrame:
m_wndSplitterHor.CreateStatic(this, 2, 1)
m_wndSplitterHor.CreateView(0, 0, RUNTIME_CLASS(CSampleCollectList), CSize(280,300), pContext) m_wndSplitterHor.SetColumnInfo(0, 200, 0);
m_wndSplitterVer.CreateStatic(&m_wndSplitterHor, 1, 2, WS_CHILD | WS_VISIBLE, m_wndSplitterHor.IdFromRowCol(1, 0))
m_wndSplitterVer.CreateView(0, 0, RUNTIME_CLASS(CSampleTree), CSize(250,0), pContext) m_wndSplitterVer.CreateView(0, 1, RUNTIME_CLASS(CSampleCollectList), CSize(250,0), pContext)
But now im stuck with tab control in View 3. Any idea?
|
|
|
|
|
Inherit your application view class from CFormView. This enables you to have controls on the view just like you would have on a dialog. For your usage I think this is suitable and it saves time. Check for online samples too...
Sunil
|
|
|
|
|
Dear all,
I have a question about how to hook HW interrupt in flat memory mode...Maybe you can give me some directions...
@ about my application...
- created by combining Watcom C and DOS32/A.
- written for running on DOS mode( not on OS mode )
- with DOS32/A now I can access >1M memory and allocate large memory to use...(running in flat memory mode !!!)
@ current issue...
- I want to write an ISR(interrupt service routine) for one PCI card. Thus I need to "hook" the HW interrupt to test...
- For example, the PCI card's interrupt line(0x3C) = 0xE in DOS mode. That means this device will issue interrupt via 8259's IRQ 14.
But... I did not how to achieve my goal to hook this interrupt in "flat mode" ?
@ reference I found...
- in watcom C's library doc, there is one sample using _dos_getvect, _dos_setvect, and _chain_intr to hook INT 0x1C...I tested this code and found OK.
But when I apply it to my case: INT76 ( where IRQ 14 is "INT 0x76" due to (14-8) + 0x70 )then nothing happened...
* I have checked HW interrupt is truly generated but my own ISR did NOT invoked...
Do I lose something ? or are there any functions I can use (in DOS32/A) to achieve my goal ? 
|
|
|
|
|
Wow - there's a blast from the past.
With your sample app that hooks INT 0x1C, was that also running in flat-mode?
That is to say - the 80x86 family run in two modes - one that has a flat address-space and the other that has segmented memory space.
When in segmented mode (DOS) there's a table that holds the address of all of the ISRs. To hook an interrupt, you simply grab the table entry you want then overwrite it with the address of your own routine. Inside your routine you do what you need, calling the original routine before, after your code or not at all. When you want to remove the hook, you simply re-write the table entry.
While in protected mode (win,linux,dos4gw/dos32a) memory is arranged quite differently. You don't have a globally accessable place that you can just read and write in quite the same way. You have the beasts known as Interrupt Descriptor Table.
I spent a long time 15 years ago trying to roll-my-own code that would enter protected mode. I've got vague memories of having trouble wrapping my head around the IDT & GDT.
What I'm getting at, is that I can't be sure that the functions you're calling are intended for flat-mode. If the ISR is running in flat-mode, you can't even address it in the 4 bytes that each entry has in a real-mode IDT.
I also don't quite follow the formula you've used to come up with int 0x76
Anyway, here's a page on IDTs and the differences between real/protected mode.
http://en.wikipedia.org/wiki/Interrupt_descriptor_table[^]
You know what I'd probably be doing? Downloading the source-code for some old games that used the dos4g/w extended and looking there for some hints. You should find something in either the timing or the sound code. The one that immediately comes to mind is Doom. Don't remember if Duke Nukem 3d was too I beleive Rise Of The Triad - ROTT used the watcom compiler. A lot of games by iD, Apogee & 3dRealms of the era used the extender.
Good luck & thanks for the read & memories.
|
|
|
|
|
My app runs at "flat memory mode" in DOS(by DOS extender -DOS/32A). I added the sample code to hook INT 0x1C in my app then found OK ! Thus that code should be running in flat mode ^_^
Another example demonstrating if app is in flat mode maybe: if allocating memory on this mode, get the offset address of this pointer then I got 4-byte address ! ( If in real mode, the offset address will be 2byte because real mode is SEG:OFF format...)
As you said memory is arranged quite differently with dos extender BUT I think there must be handy APIs provided by DOS/32A to achieve this goal because it is a common demand...
And 0x76 comes in below statement:
"DOS/32 Advanced will install real mode IRQ callbacks for all 16 hardware interrupts (IRQ 0-7, IRQ 8-15 = INT 08-0Fh, INT 70-77h)"
Because my device use IRQ14 thus (14-8)+0x70 = 0x76 and it is the interrupt number CPU got to calculate the entry of ISR !
|
|
|
|
|
|
Thanks in advance... I will try it !
But...does it work ?
Does anybody successfully use these 2 to hook HW interrupt ? 
|
|
|
|
|
Here's some wonderful reading.
[Interrupt Service Routines]
[he WATCOM C/C++ Programmer's FAQ]
[finding a device on the PCI bus]
[PCI Device access under 32-Bit PM DOS]
there are 2 ways of finding a PCI device on the bus. You can either use the PCI BIOS interface call, or direct hardware I/O.
Here's the BIOS way:
INTEL_VENDOR_ID EQU 8086h ; intel's unique sig #
INTEL_EXP_NIC EQU 1227h ; sample PCI device etherexpress 10/100 NIC
.386
mov ax, 0b102h ; interrupt 1a function b102
mov dx, INTEL_VENDOR_ID
mov cx, INTEL_EXP_NIC
xor si, si ; 0=1st device, 1=2nd etc.
int 1ah
jc nope
; once returned from this call, BH=bus number, BL=device/function #
nope:
|
|
|
|
|
Thanks for your information first...
But what I want is to "replace" the ISR for specific HW interrupt in flat mode, not retrieving PCI device in protected mode ! 
|
|
|
|
|
How to spacify the width of a string in 'scanf_s' ?
I feel hard, since the width of the string in the input file is not fixed varying from 50 character to 120, so how to specify the buffer size.
I used 'scanf' to read input, I do not need to specify the length of the string.
Please advise.
Thanks
|
|
|
|
|
mrby123 wrote: How to spacify the width of a string in 'scanf_s' ?
Like this[^]...
mrby123 wrote: I feel hard, since the width of the string in the input file is not fixed varying from 50 character to 120, so how to specify the buffer size.
If the size varies, you have to specify the maximum size, the smaller string will fit just fine in the larger strings array.
mrby123 wrote: I used 'scanf' to read input, I do not need to specify the length of the string.
Yes, but this was a frequent cause of crashes due to buffer overflows, you don't HAVE to use scanf_s, if the previous version worked just fine for you, you can disable the warning with a pragma comment.
|
|
|
|
|
mrby123 wrote: I feel hard, since the width of the string in the input file is not fixed varying from 50 character to 120, so how to specify the buffer size.
You have to use a buffer at least equal to the maximum string length of the input file (hence at least 120 characters long) and specify the size of your buffer (that is 120 ) in the scanf_s call.
Veni, vidi, vici.
|
|
|
|
|
Hi,
i am stuck with a problem while working with Windows CE 5.0 on handheld device.I am using Embedded VC++(eVC++) with programming in C++(MFC).
i want to set the value "Never" to a Switch state to Suspend dropdown programmatically.
This dropdown is located in settings>>Power properties.
modified 24-Jul-12 1:19am.
|
|
|
|