|
My suggestion is to use google, but you need to pull your head out of your ass first so you can see what you're doing.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What is the best way to update a view after opening a file from the document class? I am working with OpenGL and NTGraph and I have read data from a file to an array in OnOpenDocument and I need to automatically update the view. In the past I have added a menu item called Refresh Graph and when I select it, I assign the appropriate data and then call Invalidate to update the graph. It works, but it is not automatic and I know there has to be a better way to do it. Thank you.
CWB
|
|
|
|
|
|
When you are initially opening the file, you just need to override the view's OnInitialUpdate method. Calling UpdateAllViews from your document's initialization process can lead to double-drawing the view at startup (which you may or may not mind depending on how performance hungry your app is).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Help me! i am learning about Client-Server modern.
i want to write a program that server manages the music web
(upload and download songs). Client can upload or download songs if it's a member of webpage. Client can only delete the songs that it uploaded....
thanks!Sao
|
|
|
|
|
Can anyone tell me the functionality difference between these two styles. The only difference I know is that a window style can always be either of them.
What would be the exact difference if these styles are swapped? And example would be great.
|
|
|
|
|
ArtiGujare wrote: What would be the exact difference if these styles are swapped?
For a window with WS_CHILD , GetParent() returns the parent window. For a window with WS_POPUP , GetParent() returns the owner window, and it can be drawn anywhere on the screen, not just within the parent's client area.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
The reason I posted this question was I found a strange thing happening in my code.
My application has a complex layout. with lot of modeless dialogs,Form views etc.
1) In some sequence a modeless dialog(with WS_CHILD style) is created and displayed from Wnd1.
2) Then a button in another window - wnd2 (not from the parent window) is pressed . eg: eg help file button pressed to open a help window.
3) Now when the help window - wnd3 is closed, my modeless dialog does not get painted and appears invisible. Only minimize/maximise or Alt-Tab repaints/brings back the modeless dialog.
When debugged I found out that the modeless dialog window style was WS_CHILD. I changed the style to WS_POPUP and evrything worked fine.
Could someone explain why it worked in the later case.
Thanks again,
Arti Gujare
|
|
|
|
|
Hi,
I am retrieving fields from an MS-Acces database but getting problem.
CRecrodset object is opened successfully using :
bool isOpened = rs.Open( CRecordset::forwardOnly,strSqlQuery);
And this statement is also working:
short nFields = rs.GetODBCFieldCount( );// this is returning 1 , OK
But problem is here:
while( !rs.IsEOF( ) )
{
sprintf(tmp,"rs recieved %d record",cnt++);
DisplayMsg(tmp);
for( short index = 0; index < nFields; index++ )
{
rs.GetFieldValue( index, varValue );
strResult = *(varValue.m_pstring);
}
rs.MoveNext( );
}
The control never enters in this loop.
Can anyone suggest wats happening here.
here is complete code:
strSqlQuery = queryDBData->GetSqlQuery()+ strDigits;
strConnectionString = queryDBData->GetConnectionString();
try
{
objDB.OpenEx( _T(strConnectionString),CDatabase::openReadOnly | CDatabase::noOdbcDialog );
}
catch(CDBException* dbExcep)
{
isSucceeded = false;
}
CRecordset rs(&objDB); // db is database object open above;
bool isOpened = rs.Open( CRecordset::forwardOnly,strSqlQuery);
if(isOpened)
{
CDBVariant varValue;
short nFields = rs.GetODBCFieldCount( );
sprintf(tmp,"nFields %d found in dbquery ",nFields);
DisplayMsg(tmp);
while( !rs.IsEOF( ) )
{
for( short index = 0; index < nFields; index++ )
{
rs.GetFieldValue( index, varValue );
strResult = *(varValue.m_pstring);
}
rs.MoveNext( );
}
isSucceeded = true;
}
else
isSucceeded = false;
Thanx in advance.
Cyber Friend
|
|
|
|
|
Cyber Friend wrote: The control never enters in this loop.
How are you verifying this?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
I checked it using a MessageBox but removed that line when posted to forum.
AfxMessageBox("While loop enterd");
Cyber Friend
|
|
|
|
|
Which tells you that the recordset is already at the end. Just move it to the beginning.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Hi,
When I wrote this before entering the while loop and after opening the recorset using open(), it didn't work bcoz this if block is not entered.
if(!rs.IsBOF())
{
DisplayMsg(" if block entered");
rs.MoveFirst();
}
and if I write this
rs.MoveFirst();
instead of above if block then a runtime debug assertion failed appears .
Cyber Friend
|
|
|
|
|
After opening the Recordset object using open(), when I write this if statement
if(!rs.IsBOF())
{
DisplayMsg(" if block entered");
rs.MoveFirst();
}
this if block is not entered which means that Recordset object is at beginning of file. Does it mean that Recordset is empty? While when I checked the Recordset object using
short nFields = rs.GetODBCFieldCount( );
it returned 1.
but after it while loop is not entered at all as I have mentioned in my previous posts.
Cyber Friend
|
|
|
|
|
Hi,
Sorry to u all as there was no problem in the code which I posted in my question. Actually I have the two copies of the database which I am working on and mistakenly modified the copy of the original database while I had to modify original one bcoz I was querying the original database. The values I was seeking were not in the original database which I was accessing through my application bcoz of that Recordset object was empty.
Sorry again.
Regards
Cyber Friend
|
|
|
|
|
Cyber Friend wrote: Does it mean that Recordset is empty?
Possibly.
Cyber Friend wrote: While when I checked the Recordset object using
short nFields = rs.GetODBCFieldCount( );
it returned 1.
Columns (fields) are not the same thing as rows. A table typicaly has several columns, but could easily be empty (no rows) if no data has been entered.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
I have a dialog application that opens a series of windows. I have been using ShowWindow(SW_HIDE) to hide each when opening the next. However, I am having problems now, I want to go back to the main window after opening (and hiding) all of these windows. But even when it is the only one not hidden, I cannot click on it once something else has been opened. Is this because I need my windows to be modeless? or am I able to distroy them somehow after opening them instead of using ShowWindow(SW_HIDE)because that seems more practical? Sorry for the stupid question, but this is my first MFC program and I will catch on eventually
-Brandy
|
|
|
|
|
aei_totten wrote: Is this because I need my windows to be modeless?
Yes. If the dialogs are modal, you'll only be able to interact with one of them at a time.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
So then, do I need to make every single window (besides the base) modeless?
|
|
|
|
|
Yes, if you want to be able to access the main dialog. With a modal dialog, since it has its own message pump, you'll need to dismiss it before any other of the application can be started. See here for more.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
I have this file
DET.TLB Its a type library
But, when I use it I get the error
Retrieving the COM class factory for component with CLSID {B65AD803-ABAF-11D0-BB8B-00A0C90F2744} failed due to the following error: 80040154.
SO basically this class is not registered or I don't have permissions to use it.
So, I thought maybe if I create a dll from the tlb file, I could then use it.
So does someone know how to do that?
I gave users full permissions and it still doesnt work, so does anyone know how to create a dll from that tlb?
Thanks,
nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
Ista wrote: So, I thought maybe if I create a dll from the tlb file, I could then use it.
im not that much familiar with COM but I think just opposite is always happen that we are create TLB file from dll and also as off my knowledge we coould not register a TLB file
SaRath
"D on't blindly follow rules you read somewhere without verifying that it makes sense for your situation!"
|
|
|
|
|
The RegisterTypeLib(...) function can be used to register Type Library information (as well as a newer function that I cannot remember off the top of my head) - you can write a little app to use it.
However, it sounds like your problem is that the underlying COM object(s) DLL is not registered. I would start with finding that DLL and running RegSvr32 on it.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Ista wrote: DET.TLB Its a type library
But, when I use it I get the error
Use it? How?
A .tlb file contains a description of interfaces and other types defined in a .idl or .odl file that is compiled with the MIDL compiler.
The typelibrary (the .tlb file) could be included in the distributable binary, e.g. an ActiveX control, as a resource; or it could be distributed as stand alone file.
Either way it's tightly connected to the binary that it describes.
Ista wrote: I thought maybe if I create a dll from the tlb file, I could then use it
Think of the type library as a header file. When you've had that thought I assume you realize that you cannot compile a header file and build an executable application of it.
We "use" the type library when we add a library to the project, it could be a DLL, a COM server, an ActiveX control etc.
What happens here is that somewhere ::CoCreateInstance() is called and asked to create an object that has not been registered, at least not yet.
The cure for this is naturally to register the object/server.
--
Roger
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
|
|
|
|
|
Well what Im trying to, is Open a file ( classic asp ) and go to a specific line number. This is all done in InterDev.
Opening the file is easy "devenv.exe filename.asp"
But I need to go directly to a specific line number. So I thought I could link the library and Just use the COM to open the file and use the GoTo method to do my work.
So, in the VS2005, I create the reference. IThe environment creates the wrapper DTEClass(). ( file DTE.tlb in your IDE folder )
I instantiate it and but, I get this class not registered type error.
Do you have any ideas?
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|