|
prithaa wrote: I wanted to know how should I use SQLExec() and how do I pass this handle (SQLHstmt StatementHandle) and what is the meaning of this SQL handle.
I don't know what SQLExec() is, but I'm assuming you want to use ODBC
because you mentioned SQLHSTMT. If that's the case, you may want to study
this: Microsoft Open Database Connectivity (ODBC)[^]
The CDatabase and CRecordset MFC classes are wrappers for the ODBC APIs, handles,
etc. and are a bit easier to use than the straight APIs.
For the actual SQL queries, I still say your best bet is the SQL board.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
prithaa wrote: Actually I wanted to store and use multiple SQL queries through CDatabase class .But I was unable to do it.
Why not?
CDatabase db;
db.SQLExec("CREATE TABLE ...");
...
db.SQLExec("DROP TABLE ..."); Now if you actually wanted to have a result set sent back to you, you'd also need to use a CRecordset object.
"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 all,
I'am having a new tool bar with 5 buttons in my appication. Each button opens a form.
Now i should like to know how to automatically close the first form, when second form is opening ? like wise for all forms.
so at present time only one form should be visible.
can u please answer this question.
thanks
panthal
|
|
|
|
|
You can send WM_CLOSE to them,how did you make them?
|
|
|
|
|
thanks for your reply, i'll try this.
but How to send WM_CLOSE can u explain clearly please
R u asking about that tool bar buttons?
|
|
|
|
|
You must use of SendMessage.
|
|
|
|
|
There is more than a solution. I make it like this.
void CMainFrame::CloseMyFrame ()
{
CMDIChildWnd* pMDIActive = MDIGetActive();
CDocument* pDoc = pMDIActive->GetActiveDocument();
CMyView* pMyView;
POSITION pos = pDoc->GetFirstViewPosition();
while (pos)
{ pMyView = (CMyView*) pDoc->GetNextView(pos);
if (pMyView->IsKindOf(RUNTIME_CLASS(CMyView)))
{ CFrameWnd* pTempFrame = pMyView->GetParentFrame ();
pTempFrame->DestroyWindow ();
return;
}
}
return;
}
And, when I want to use it...
extern CFPSApp theApp;
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
pFrame->CloseMyFrame ();
I forgot...
I make it to close a specific Frame (that may be only ONCE at a time)
For other that I may be more times at once opened, I like follows
void CMainFrame::CloseMyFrame (CString szName)
if ((pMyView->IsKindOf(RUNTIME_CLASS(CMyOtherView))) && (pMyView->m_pParent->m_szName == szName))
This is because I use that views to modifify the parameters of an element. So I hold a pointer to the element that is being shown as a member variable in every window. So I get easy access to the data I have to show/modify and use it to differenciate between the 48 possible CFormViews that can be opened at once.
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'm making such a program.
The image has a rect bound to its edge, with control points.
Dragging the control points to rotate,enlarge(etc.) the image.
I'm using gdi+.
Any straight way?
Thanks.
-- modified at 1:04 Sunday 25th November, 2007
|
|
|
|
|
What does clicking the "X" box in the upper right corner of a dialog do? I'm puzzled by the behavior I am observing, and would like to understand it better. Below I describe two situations with very different results which seem to depend on clicking that box.
SITUATION A
void CDlgControl::OnBUTTONCreateLadder() <br />
{ <br />
pLD = new CLadder; <br />
}<br />
void CDlgControl::OnBUTTONTestButton() <br />
{<br />
pLD->DestroyWindow();<br />
delete pLD;<br />
pLD = NULL;<br />
}
In SITUATION A above, the dialog is created and displayed. Debug shows it progressing through each command in OnBUTTONTestButton(). Debug then traces it through many Windows functions until it finally reaches a window titled Disassembly where it fails on a command
7E41B517 call 7E4194A4
Debug assertion failure
File Winocc.cpp
When not using Debug, it simply fails on the same message
SITUATION B
The same exact code is used. However, prior to executing OnBUTTONTestButton(), I click the "X" box in the upper right corner of the CLadder window. Then I execute OnBUTTONTestButton(), and everything works just fine.
QUESTION: What does that "X" box do? What makes SITUATION A different from SITUATION B?
Thanks
|
|
|
|
|
The "X" button issues a WM_SYSCOMMAND [^] notification to be sent to the window, with the wParam value set to SC_CLOSE . The default window handling closes the window.
With situation B, the window has already been destroyed by the time OnBUTTONTestButton is called, so a great deal of the normal window shutdown logic has already occurred. There's something wrong in the way you're handling the window destruction, or possibly in the CLadder destructor. Without seeing more of the CLadder code, it's difficult to say.
Software Zen: delete this;
|
|
|
|
|
ModalDialog should call EndDialog instead of DestoryWindow, then you could delete the pointer of Dialog Variable.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
You may want to use Spy++ (it comes with Visual Studio) to see what messages are being passed to windows
Florin Crişan
|
|
|
|
|
i want to get info with os hardware.for example CPU , DISK and so on.help ma
|
|
|
|
|
What info are you wanting to know about the CPU, HDD, etc? Be specific. We're not here to play guessing games.
"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
|
|
|
|
|
Boy, you sound cranky today David. Not getting enough sleep?
Software Zen: delete this;
|
|
|
|
|
David is an active member on the codeproject especialy on this forum and I saw his answers they are good and exactly but I think if lgbean more explain about his question David could answer to him I think his question was general.(BTW when I saw your Gary R. Wheeler I remember you did you remember me?;))
|
|
|
|
|
Nah, just a bad hair day.
"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
|
|
|
|
|
|
Because message handlers are very different for the two views.
If put them in one view, the "if...else" statements lays everywhere.
Put them in two views, the codes become much easier.
I want it to work as SDI, the only difference is that the view can be switched.
How to implement it?
-- modified at 1:01 Sunday 25th November, 2007
|
|
|
|
|
Or adding a second DocTemplate, or using a Splitter Window[^]
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
|
|
|
|
|
A splitter windows is not convenient for the user.
A MDI is possible, but a little expensive.
Any way to implement it using SDI with no doc-view support?
|
|
|
|
|
|
THX
But I get data from the database, so the document is not necessary, any better way?
|
|
|
|
|
Since you mentioned CFrameWnd and CView, I thought you were using a doc-view style CWinApp. Using the doc-view makes it easy to do the switching since you can use the the internals of the MFC stuff. The CDocument contents are not really needed - I usually have a CMyDocument class with nothing but a constructor, and multiple CFormViews that I switch between.
It doesn't get much simpler than the link I gave.
Judy
|
|
|
|
|
I need to iterate over a std::string and replace every occurance of '\' with '/'.
There are different ways:
I could use the index operator [],
Or I could use the iterator begin()
What is the accepted way to do this?
|
|
|
|