|
|
Hello: There are several books available for writing drivers. Assuming that your developing for NT/Win2k/XP the book I recommend is by Walter Oney called "Programming the Microsoft Windows Driver Model, Second Edition ". You will also need to order the DDK from Microsoft.
Dave Jones
|
|
|
|
|
|
is the target of your device driver is on Windows or Unix system, and what is your compiler...
TOXCCT
|
|
|
|
|
Hi,,,
I develop an ActiveX control (ATL 3.0) and I build and test it as unicode on WinXP Pro..
Can this control work fine on Win9x - ME ?
what precautions must I take care of ?
thanks in advance.
|
|
|
|
|
|
thank you..
but what about :Microsoft Layer for Unicode
can i link to it statically so i can distribute the ocx with no dependencies ?
|
|
|
|
|
|
How to create a dhtml dialog in vc and then how can we call it through toolbar and i have also to do some processing on the atl component under it using vb script please explain it briefly or tell me some articles
ThanX in advance
Inam
|
|
|
|
|
I've been trying to do something like this in my OnInitDialog:
<br />
CDatabase db;<br />
AnstalldaSet set(&db);<br />
TRY<br />
{<br />
set.Open();<br />
if (! set.IsBOF())<br />
{<br />
set.MoveFirst();<br />
while (! set.IsEOF())<br />
{<br />
m_Fornamn.SetWindowText(set.m_FORNAMN);<br />
m_Efternamn.SetWindowText(set.m_EFTERNAMN);<br />
set.MoveNext();<br />
}<br />
}<br />
}<br />
CATCH(CDBException, pDBException)<br />
{<br />
AfxMessageBox(pDBException->m_strError);<br />
}<br />
END_CATCH<br />
<br />
set.Close();<br />
<br />
return TRUE;
However, I get a strange problem - when I started the app the first time, it all worked great.
However, when I closed the app it didn't dissapear from the Processes view in the taskmanager. If I stop the process it won't run again... I tried restarting the computer, but that doesn't help either.
Does anybody have a clue? I don't...
BTW, when I double click to start the program (or CTRL+F5 in VisualC++) it appears in the Processes view, and in MySQL Admin as an open thread. But the dialog never shows on the screen!
(It's a normal App-Wizard generated dialog app, with the only addition of a CRecordset class!)
Big thanks to DavidCrow for helping with the recordset...
|
|
|
|
|
Your problem is with the record set object.
What you are doing is you create the database connection, create a recordset and issue a query, getting a set of results. Then, you run through the complete database and alter the window name/edit box contents based on the results from the database. Your dialog will default to showing the last entry in the database after it is shown.
Instead of browsing through the entire database on the dialog initialization, you should only create and issue the query commands there. Then create a set of Forward/Backward buttons on your dialog to browse through it.
The actual problem may also persist in either the database or the connection into the database. Or it may also reside elsewhere in your program. Try debugging through the application to see what it does. Pay special interest on the HWND of the dialog. If it gets initialized properly, then the dialog is created. If it is not, then the dialog would never show up.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks for the help! Worked a bit better now!
I've created 2 buttons now, to be able to move back and forward for a start. But neither
void CCPTestDatabasDlg::OnBback() <br />
{<br />
AnstalldaSet::MovePrev(); <br />
}
or
<br />
{<br />
set.MovePrev(); <br />
}
works... Any thoughts? Should I declare some kind of global pointer in my recordsetclass or?
|
|
|
|
|
No.
You should move the AnstalldaSet member variable (your CRecordset-derived class, I assume) into the header file of your dialog, as it's member variable. This way, you can access the created object anytime.
Also, remember that you MUST move the database object in there as well. Otherwise, you create the database object, bind the recordset, create a query, and when OnInitDialog goes out of scope, the database object gets destroyed and closes itself up, making your recordset object just about useless.
It is possible to create recordset objects that get their results from the database and then save the whoke result into local variables. However, I suggest you keep the database connection constantly open when you browse the databse, no matter what the type of the recordset is. So, move both the CDatabase object and the CRecordset-derived class into the dialog's header file. Initialize and open them in OnInitDialog , then use them when the dialog is open, and close them in the destructor of the dialog.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Antti Keskinen wrote:
You should move the AnstalldaSet member variable (your CRecordset-derived class, I assume) into the header file of your dialog, as it's member variable. This way, you can access the created object anytime.
How do I go about this? Do I just include the first two lines in the dlg.h?
I'm very new 2 database programming (and VisualC++ for that matter), so I don't really know what U mean...
BTW, any relation to Esa Keskinen?
|
|
|
|
|
Nope, no relation
Just like that. Move the two lines into the dialog header. Try to think of it like this: when your dialog object gets created, a CDatabase object and a CRecordset object are created with it, because they are in the header file. Then, in the initialization, you initialize the objects, and upon clean-up, you destroy them.
Inbetween these two episodes, you use them
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks! After a bit of fiddling I got it work! I just put the two lines in the beginning of the .cpp file instead (got some errors when I put it in the .h file).
Another question though... How should I go about performing an update when I'm not using CRecordview?
Thanks again!
|
|
|
|
|
What update do you mean ?
If you mean how to update the data members, then I suggest you familiarize yourself with the concept of RFX, or Record Field Exchange . This practise is used to get data from the data source and save it into local variables (members of the CRecordset -derived object, such as CStrings , int s etc). When you issue a MoveNext call, the actual pointers inside the results list (handled by the CRecordset object) are moved forward. Then DoFieldExchange , an overriddable virtual function gets called. In here, if you issue a set of certain function calls (RFX calls), you can load the data in the currently selected row into the local variables you specify. We are not interested how the actual database or result browsing works: the CRecordset object offers an interface through which we can copy the desired data away into local variables.
The rest is quite simple: following the same logic, you implement a Dialog Data Exchange (DDX) routine, in which you copy the contents of the variables from the CRecordset object into local variables of the dialog class (member variable to member variable, respectively). After this, you let the DDX routine (DoDataExchange virtual function on the dialog class) to "bind" these local variables into the actual controls of the dialog resource. This means that whenever the DDX routine is ran, data is copied from either the local variables into the controls, or vice-versa.
The same bi-directionality is implemented in the CRecordset object, but it works a bit differently (See the CRecordset documentation for more info, especially AddNew and Update member functions).
Hope this clears it up a bit. See MSDN documentation for a complete explanation. Naturally, experimenting with both DDX and RFX is the best way to learn how to use them. But if you understand the basic concept: "Binding a local attribute of a class into a control's data/manipulation or into a query's result row's column", you've taken a huge leap forwards.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Oleg Galkin and Alexander Kuzmin give us solutions to this problem. Unfortunately, I cann't get it work well even in the easiest circumstances.
Is there any other good solution to it?
|
|
|
|
|
The easiest way, of course, would be to use a dynamic splitter instead.. But, if you want it to be static, you can always set the static frame's width/height to zero. This will 'hide' the window.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
CScrollview data plotting & grabbing the plotted data
>>
Mainly how to find what is the position of mouse pointer when clicked corresponding to data plotted
Hello friends
I am developing an application in which i have to
1.0 Get the data from file
2.0 Store it to array
3.0 Plot the data with MM_LOENGLISH mapping mode on view
(because i want printous as it is)
4.0 Allow user to grab the data from the view by clicking on the
selected portion from the view, say marquee select
5.0 Corresponding to user selection on view, grab the dat from
the array and then put the data into seperate file.
I am having query in point 4.0:
How can one implement the functionality in which the data has to be plotted on UI and certain part of data has to be grabbed from the visual display.
How the exact position of mouse is located on UI vis a vis data in array? (I want to grab the data on UI by selecting the data , there has to be a mapping with the array data?)
So that when i grab on UI i get some value on mouse clicking and then based on that i can grab the data?
No matter what ever the OS is i.e 2000 or Xp or 98.
No matter what ever the screen resolution is (It must work for all combination)
What i am doing presently is :
i am taking data from the document
Step 3.0 onwards
<br />
CPoint OldPointL, NewPointL;<br />
<br />
CSize sizeTotal;<br />
sizeTotal = GetTotalSize();<br />
long interval = (long)(((sizeTotal.cy * 0.95f) / 5)*0.9f);<br />
<br />
if(m_bFitToScale == true)<br />
{<br />
m_ScaleX = (float)ClientRect.Width () / <br />
(float)pDoc->m_ChannelDataArray.GetSize () ;<br />
}<br />
else<br />
{<br />
m_ScaleX = 1;<br />
}<br />
OldPointL.x = ClientRect.left;<br />
<br />
int Ly = OldPointL.y = (long)(ClientRect.top - ClientRect.Height () * 0.95f);<br />
m_GeoYScale = interval * 0.5f/ceilf(GetMaxValue());<br />
<br />
for(int xCount=0; xCount < pDoc->m_ChannelDataArray.GetSize (); xCount++)<br />
{<br />
NewPointL.x = (int)(m_LeftMargin + xCount * m_ScaleX) ;<br />
NewPointL.y = (int)( Ly + m_GeoYScale * data->GetLValue ()) ;<br />
CLine *pL = new CLine((float)OldPointL.x, (float)OldPointL.y,<br />
(float)NewPointL.x, (float)NewPointL.y, <br />
RGB(255, 0, 0), 1);<br />
pDoc->AddLine(pL);<br />
OldPointL = NewPointL;
}<br />
After this Invalidate is called and in ondraw i am drawing all the lines and labels ?
For step 4.0 i am going for onXButtonUp function
StartPoint = ScrollView.GetPosition() + point.x
(Point recd. from Onxbuttonup function)
Startpoint on left button and endpoint on R button
NOW MAIN TASK IS TO GRAB THE DATA FROM THE DATA ARRAY IN DOC BASED ON GRAB SELECTION ON VIEW
ANy help suggestion Please soon
I am not expert in this and i am learning, kindly can you give me sugestion?
I had posted the same theme query
http://www.codeguru.com/forum/showt...threadid=279607
Thanks
Leave your mark wherever you go
|
|
|
|
|
Hi all. Happy chinese new year. Do anyone know how to display simple text in a MDI application? Thank you.
|
|
|
|
|
In an MDI application, you first create the frame window. Then, you create child frames on request, and fill these frames with view windows. Each child frame owns one and only one view, unless there's a tab control inside the frame.
If you need to display text in a view, override the view's ON_WM_PAINT handler and use the TextOut function of the CDC class. This will draw text on your view.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I could be just a complete moron and not know where to look. But what I need help with is taking numbers from a edit box(when a button is clicked) and made into a varible. Then I want to take those variables and make another variable(I know how to do this), then I would like to output the product in a static field.(I think is simple but I don't know)
If someone could help me or point me in the right direction I'd greatly appreciate it.
Thanx
|
|
|
|
|
MrNiceBerG wrote:
then I would like to output the product in a static field
I'm not any MFC pro by any means, but I think this will do what you want.
(CStatic*)(GetDlgItem(ID_OF_STATIC))->SetWindowText(varWithProduct); That would be assuming that varWithProduct is some type of string. I'm sure there are other (probably better) ways to do it, but that might get you started.
- monrobot13
|
|
|
|
|
I am not really and MFC pro either, but perhaps I can grant more insight of what is happening to you.
If you are creating a dialog-based solution, you can use the Dialog Data Exchange to bind a CString object into the contents of the edit box. Then, calling UpdateData(TRUE) would copy the contents of the edit box into the CString variable. Calling UpdateData(FALSE) would update the controls from the variables.
After this, you can use the previously posted method to update the static control's text, issuing the name of CString object as a parameter to the SetWindowText method.
Here is a hands-on example on how it might be implemented:
CString m_csEditBoxText;
CStatic m_StaticControl;<DIV>
.... <DIV>
void CMyDialog::DoDataExchange( CDataExchange* pDX )
{
DDX_Text( pDX, IDC_EDIT_CONTROL_ID, m_csEditBoxText );
DDX_Control( pDX, IDC_STATIC_CONTROL_ID, m_StaticControl );
}<DIV>
.... <DIV>
void CMyDialog::OnClickButtonX( someParams )
{
UpdateData(TRUE);<DIV>
m_StaticControl->SetWindowText( m_csEditBoxText );<DIV>
UpdateData(FALSE);<DIV>
} This implementation should work, assuming you have given an identifier to both the edit box and the static control (all static controls default to having IDC_STATIC as their identifier). Then put these identifiers into the dialog data exchange routine. I have not tested it, but if it does not work, then use the implementation given in the previous post to update the static control's caption, removing the lowest two code lines from the button click handler.
Hope this will help you out
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|