|
Can you show code that it makes error?
|
|
|
|
|
Hi guys. I am using the function
void CPortConnectDlg::OnBsend3()
{
_outp(0x378,0x3); //The function to connect to the port
}
When i compile the project, it has no error but, when i try to send the data to the parallel port, it is not working, instead, windows gives me an error i can't really understand. Please can anyone help me.
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
What Windows version? Maybe this will help....
"Because these functions write directly to an I/O port, they cannot be used in user code in Windows NT,
Windows 2000, Windows XP, and Windows Server 2003. For information about using I/O ports in these
operating systems, search for "Serial Communications in Win32" at MSDN."
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: What Windows version
I am using windows XP and 2000 interchangable
Mark Salsbery wrote: For information about using I/O ports in these
operating systems, search for "Serial Communications in Win32" at MSDN."
Does this mean that i have to send the message using serial port and not Parellel ports? If so, please offer some advice since i really needed to connect to the printer(parallel port).
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Wamuti wrote: Does this mean that i have to send the message using serial port and not Parellel ports?
No.
It means a long time ago, direct hardware access was no longer allowed by the operating system.
Maybe check this out: Code Project Parallel Port Articles (C++/MFC)[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks. I am going through it right now.
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Wamuti wrote: windows gives me an error i can't really understand.
Well certainly someone here can understand it, especially if you don't post it because it's easier to understand if you can't see it
|
|
|
|
|
:-> Sorry for that,The error is
"The exception Privileged instruction.
(0xc0000096) occured in the application at location 0x1022cc4b"
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Wamuti wrote: ...it is not working, instead, windows gives me an error...
That's because Windows' HAL is prohibiting direct access to the port from user-mode code.
"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
|
|
|
|
|
DavidCrow wrote: ...That's because Windows' HAL...
What is windows HAL?
DavidCrow wrote: ...is prohibiting direct access to the port from user-mode code.
What can i do about it. I was reading this code from codeproject http://www.codeproject.com/system/AsefPortAccess.asp[^]
but the source code is also giving me the same error.(Ofcourse i can trouble the author with lots of questions;)) Please help
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Wamuti wrote: What is windows HAL?
See here.
Wamuti wrote: What can i do about it.
Change to kernel mode (ring 0) and write a device driver.
Wamuti wrote: I was reading this code from codeproject http://www.codeproject.com/system/AsefPortAccess.asp[^]
but the source code is also giving me the same error.
Are you using the included device driver file?
"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
|
|
|
|
|
Some grids should be merged ,which may put picture in.
http://botu.bokee.com/photodata1/2007-11-16/000/201/057/11971045/11971045_h.jpg[^]
I try to use MSFlexgrid ,but it can't put pic in merged grids .
And it is best if it can put multi-line text in one grid .
-- modified at 7:14 Friday 16th November, 2007
===========================
http://begtostudy.blogspot.com/
email:begtostudy@gmail.com
MSN:begtostudy@gmail.com
|
|
|
|
|
Take a look in http://www.codeproject.com/listctrl/[^] you will find some things that can help you, maybe not a complete example, but you can use different parts on each article to get what you want. I recommend you to start with the XListCtrl of Hans Dietrich
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Thanks a lot .
But ,I didn't see which tool can merge grids ,especially column grids .It's a big problem ,i think .
-- modified at 21:23 Friday 16th November, 2007
===========================
http://begtostudy.blogspot.com/
email:begtostudy@gmail.com
MSN:begtostudy@gmail.com
|
|
|
|
|
Sorry, im not english speaker, can you repeat in other words? I didnt understand what you wanted to say.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
OK.
In other words ,how can I put multi-line text or a image in one grid which is merged by several grids .
===========================
http://begtostudy.blogspot.com/
email:begtostudy@gmail.com
MSN:begtostudy@gmail.com
|
|
|
|
|
Sorry but I dont really know it, I have take an overview to some articles and I think you will be able to find what you need in the section of ListCtrl, there are lots of diferents functionalities. I guess you may find two or three of them that have things that can help you.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi,
I need to change the default cursor into a vertical line, when within a certain area of the display. The line would then be able to move OnMouseMove.
Question(s) is (are):
Do I need to create a custom IDC_CURSOR resource? Based on say crosshair?
Or is there an easier way to change from the default cursor to a vertical line?
Even a vertical line attached to the edge of the default cursor would suffice.
Any help would be much appreciated.
Cheers.
pod_999
|
|
|
|
|
The easiest way is to create a mouse pointer in your resource editor and then charge it in your view with
m_hCursor=AfxGetApp()->LoadCursor(IDC_MYCURSOR);
if (m_hCursor)
::SetCursor (m_hCursor);
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Thanks Nelek, I'll give it a go.
Cheers.
|
|
|
|
|
BTW, I once faced with a problem, the cursor was changing when i clicked in a button, but then when I moved the mouse, the cursor changed another time to the standard one.
To avoid this, I made my m_hCursor member variable, set the first two lines in the click where I wanted to have the new cursor, and the last line "::SetCursor (m_hCursor)" in the OnMouseMove ()
It maybe is not the best solution but it works.
Logically you will have to load another time the usual white cursor when you end with your personal one.
Do it with LoadStandardCursor(IDC_ARROW)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Are you handling the WM_SETCURSOR message? In it, you can set the cursor by calling SetCursor() .
"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
|
|
|
|
|
Hi everybody,
if you create a new Dialog and create from it a new CDialog derived class,
then the class with the most common function is already written by Visual Studio
or the MFC.
This nude basic class, how is it called?
Because i derived a View-Class of CFormView which includes all the functions and variables
of all my view's in the whole project.
If i create a new View, the class is derived from CFormView. So i need to change the class
that it derives from my "UniView" Class.
Is it possible to create a own "Template" of this class, so that all the sourcecode is
automatically inserted ?
I hope you can understand my request, it's complicated to explain with expression which i don't know
how the are called LOL
Big thanks
|
|
|
|
|
Go to the *.h and to the *.cpp, press ctrl+h and replace CFormView with your CUniView
w8 a moment... what do u want exactly to achieve? A View that is derived from your CUniView, or a View derived from CFormView but that you can use everywhere in your project?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
I have a View-derived-Class "UniView" ... there'in i have many functions which are
the common basic functionalities of all my implemented views. ( For example the view is colored
in blue, initialization of variables, etc )
For each window in my project i create a dialog ressource and create a new class from CFormView.
Visual Studio writes now a "standard view class" kind of
class NewView : public CFormView
{
NewView();
~NewView();
#ifdef DEBUG
...
...
#endif
};
So the user can now implements his code into it.
But i change the source code in this way that this new view is derived by my proper UniView.
I change the constructor, add Handlers, etc ...
These changings are made in all Views of my project ...
So i need to applic this changings everytime i create a new view.
Now the question is: Is it possible to create directly a "template" that the self-generated
source code of the new view is derived from UniView, has directly handled some handlers
and so far ...
Big thanks for help
|
|
|
|