|
CArray works fine as a container, the differences there are not that great. Now take your CArray of strings - can you sort it ? Ask for the highest value in there ? Remove duplicates ? The power of STL is the functions which can interact with STL containers and the fact that STL containers, unlike the MFC ones, define a common iterator interface so they can easily interact with each other.
Check out my article on STL functors ( or Chris L's for that matter ) to see some of the stuff you're missing out on.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Thanks for the info. I'll check those out.
Software Zen: delete this;
|
|
|
|
|
Hi
I am trying to convert CIPAddressCtrl variable to string variable and vice versa.
Can anyone tell me how? or attach some code to do the same.
Thanks
Yogi
|
|
|
|
|
Hi,
Dose any body known how to load .DLL file into your project that have .LIB file also and creating an warpper for that file???
|
|
|
|
|
Your question is difficult to understand, but I'll try to help. Loading a dll is something you do at run time. Using a .lib is something you do at compile time. It is a static library that gets linked in to your final application. If you are asking if it is possible to use both a dll and a .lib at the same time in the same project, then the answer is yes.
Now, I have no idea what you mean by creating a wrapper "for that file". First of all, which file are you talking about? You want to create a wrapper for the .lib? That doesn't make any sense to me. When you write a wrapper for something, you are dealing with source code. When you use a .lib file you are dealing with a binary file.
Can you re-phrase your question?
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
What i mean i create the wrapper for the DLL file I do have the code for that DLL file and the code is writin in C/Win32. Now i want to use this code in the MFC app with the MDI style so where CView it would display that object.
Now i think think this is how i load the dll at run time
HINSTANCE m_hInstDLL;
if ((m_hInstDLL = LoadLibrary("name.dll")) == NULL)
{
return FALSE; // Failed to load the localized resources.
}
else
{
AfxSetResourceHandle(m_hInstDLL);
// Get resources from the DLL.
}
Now after loading the DLL how do i use these function for the DLL? what else to i have to declare that where the wrapper come in. I want to have a class that controls all this functions. where abouts do i start. I hope you known what i'm trying to say.
Then main think is that i want to display the control in CView window or is it called CDocument window...but you known what i'm taking about here.
Thanks for the help Matt
|
|
|
|
|
E3 wrote:
creating an warpper for that file???
By Hands, sir, by your own hands
|
|
|
|
|
Help! hate to get back to this old topic again, but must say that ADO docs is rather lame for C++ programmer. This is something that can be so easily done with VB - but i'm near the end of my VC module.
QUESTION 1:
I need to determine whether a given field is a primary key for foreign key. and put the result in a character string or int.
This is what I did:
char szPK[20];
for(i=0; i<20; i++)
{
szPK[i]='\0';
}
strcpy(szPK, (pRs->Fields->Item[j])->Properties->Item["KEYCOLUMN"]);
I think we're on the right track, execpt the return type.
error C2664: 'strcpy' : cannot convert parameter 2 from 'class _com_ptr_t<class _com_iiid<struct="" adocg::property,&struct="" __s_guid="" _guid_00000503_0000_0010_8000_0
i="" dont="" know="" smart="" pointer,="" so="" i="" have="" no="" idea="" how="" to="" convert:
(prs-="">Fields->Item[j])->Properties->Item["KEYCOLUMN"]
to type: char*
QUESTION 2: how can u tell FK from PK?
QUESTION 3: how can I determine the foreign key associated with a primary key on another table?
I need to get the associated table name and associated field name (FK) given a PK on a given table.
Thank!
Norm
thanks
norm
|
|
|
|
|
Hello,
I have a problem. I have been given some code in C++ by my tutor which I have been told works fine and does exactly as it's supposed to do. I have been given the project of writing a GUI for this, and so have tried compiling and running this in Visual C++ using the console application project. The thing is I can't seem to get VC to put it in a project and compile it.
Any one got any easy ways of doing this?
|
|
|
|
|
I usually just create a new console project. Then I include the files that I know will need to be compiled. The only other thing that I usually need to do is make sure certain include files are properly included.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
If you know you are going to be puting this code in a GUI, then don't put it into a console application. You'll find yourself starting over unless you know exactly what to change in the project settings after the fact.
It's fairly simple to do what you want. Just create a GUI project (e.g. Dialog based, SDI, MDI). Then, with Windows Explorer, copy all of the files that you want to have in your project into the root directory of the GUI project you just created. Then, from the "File View" tab of the workspace in Visual Studio, right click on the project name, and select "Add file to project...". In the ensuing file dialog, Ctrl+Click all of the files (header and source) that you want to compile into your project. Then click "OK".
You should now be able to build the project assuming that your files build as is in a Win32/MFC environment.
The smart thing to do here, though, would be to put your code into a static library. Then you can keep it separate and re-usable for other projects. You don't have to do this, but it makes it a bit cleaner. If you need more information on how to do this, let me know and I'll provide you with some details.
Hope this helps.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
There are several solution.
- Create Win32 console project.
- Import all H and CPP files.
- Compile project.
Kuphryn
|
|
|
|
|
Hi,
I've been given the task of creating a programmable state machine, ( a class that will take in an input file that will denote the allowable states and actions etc... ) I was thinking of implementing it in XML or something.
Has this been done before? Any hints/tips/code?
Cheers
Asim
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
I've done this on more than one occassion and in more than one language.....What language/tools are you using? that makes a difference in how you put it together......
Just trying to keep the forces of entropy at bay
|
|
|
|
|
Hello,
I am a little lost with some code. I have an MDI application without Doc/View Support
The code for File->New is the following (by default).
CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd() ;
// create a new MDI child window
pFrame->CreateNewChild(
RUNTIME_CLASS(CChildFrame), IDR_NICKMITYPE, m_hMDIMenu, m_hMDIAccel);
I want to open a bitmap and have it appear in this new window, yet it appears in the background of the project. How can I get the View to be set to this new window I made and not the background. For some reason, if I call pFrame->GetView() and then retrieve the buffer where my bitmap is, it puts it to the background. I really want to put in this new window, and am lost on how to do that. Can anyone give me any advice or point me to some articales or something that I could use to figure this out?
Thanks a whole bunch,
NickOne
|
|
|
|
|
Hi,
Does anyone have any idea how to create a line connecting two modeless dialogs, like in MSAccess relationship editor?
I could create the dialogs inside a CWnd or CView derived class and even the drag and drop support is enable between the two dialogs (which holds a CListBox control), but I couldn't figure out how to create (or draw) the line connecting them.
Any help or lights on these would be really nice.
Thanks,
Crercio O. Silva / DBTools Development
http://www.dbtools.com.br
|
|
|
|
|
I suppose you could pick an arbitrary set of points (say half the height of both dialogs) and then use the DrawLine method in GDI.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Nick Parker wrote:
I suppose you could pick an arbitrary set of points (say half the height of both dialogs) and then use the DrawLine method in GDI.
I couldn't find the DrawLine method. Is it the same as using LineTo, MoveTo?
Thanks,
Crercio O. Silva / DBTools Development
http://www.dbtools.com.br
|
|
|
|
|
Crercio O. Silva wrote:
I couldn't find the DrawLine method. Is it the same as using LineTo, MoveTo?
Sorry, I have had my head stuck in .NET lately as it is available in GDI+. You could write your own DrawLine function, here could be a prototype:
void DrawLine(CDC *dc, CPoint& start, CPoint& end);
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
I'm not familiar with the relationship editor,
but I would guess that the windows twixt which
the line is drawn are not top level windows
(modeless dialogs), but rather child windows
of some container and it is on the container
window that the line is drawn.
|
|
|
|
|
Scott H. Settlemier wrote:
I'm not familiar with the relationship editor,
but I would guess that the windows twixt which
the line is drawn are not top level windows
(modeless dialogs), but rather child windows
of some container and it is on the container
window that the line is drawn.
Oh, I guess I forgot to say this before. The dialogs are childs from a Dialog Container (A CWnd derived control).
Thanks for the tip.
[]s
Crercio O. Silva / DBTools Development
http://www.dbtools.com.br
|
|
|
|
|
CDC::MoveTo and CDC::LineTO ?
I think the problem you might have is how to handle the action itself, how to click ( somewhere ), then drag the mouse ( to draw the line ), and release ( to finalize the connection )
I'd do it by hand, and handle the WM_MOUSEMOVE, WM_LBUTTONDOWN and WM_LBUTTONUP of the modeless dialogs; on the WM_LBUTTONDOWN, "anchor" the starting point, and on the mouse move, draw the line from the anchor to the current point, and on the WM_LBUTTONUP, process the connection by fetching which dialog is the "target" and which is the source, and drawing the line from the closest border.
Max.
|
|
|
|
|
Maximilien wrote:
CDC::MoveTo and CDC::LineTO ?
I think the problem you might have is how to handle the action itself, how to click ( somewhere ), then drag the mouse ( to draw the line ), and release ( to finalize the connection )
This part actually is already done. I'm using a CListBox ctrl inside each modeless dialog. I managed to implement the drag and drop from one dialog to another. Although in the destination dialog there is a need to have at least one item selected (I couldn't figure out the item on the drop position). I'm now starting the code to draw the line itself. What I've done so far was:
- I derived a class from CWnd named CContainerWnd with these methods:
CContainer::AddDialog(CString pName)
CContainer::RemoveDialog(CString pName)
CContainer::CreateRelationship(CString PKName, CString FKName)
This class is the parent for all modeless dialogs. I have also used a CFormView as a container for doc/view arquiteture, which worked like a charm including the scrollbars.
Inside the CreateRelationship I managed to identify the dialogs position (which I save when created), so to draw the lines was quite easy. The problem comes when I move one of the dialogs. In this case it's necessary to clear the old line and redraw it in the new position. Also there is an even worse problem: if there is another dialog in between two that are related, the line will be drawn over this dialog, so far I couldn't figure out how to do it.
I think if I'm able to create a CWnd derived class just to handle the line it may solve my problem, but I'm not too familiar with that.
Thanks for the tips.
[]s
Crercio O. Silva / DBTools Development
http://www.dbtools.com.br
|
|
|
|
|
Crercio O. Silva wrote:
if there is another dialog in between two that are related, the line will be drawn over this dialog, so far I couldn't figure out how to do it.
You need to re-order the drawings. in your view, you need to draw the different lines then draw the dialogs.
Max.
|
|
|
|
|
Maximilien wrote:
You need to re-order the drawings. in your view, you need to draw the different lines then draw the dialogs.
I have implemented this. So far the lines are drawn as they should be. When the dialog moves a method in the CContainer erases the previous lines and redraw all of them again. I used this approach to handle the draw of the dialogs:
- first I connected WM_SIZE and WM_MOVE in the dialogs to the CContainer window, when one of them occurs it will call a method to repaint the lines
- in the paint lines method I first draw the lines and then I hide/show the dialogs in order to make the lines stay under the dialogs.
This is really working but the problem is I really think that using CDialog::ShowWindow() is causing me problems since the application goes into a infinite loop (looks like ShowWindow(SW_SHOW/SW_HIDE) updates the position of the dialog causing them to call the repaint method of the CContainer parent.
Las night I worked on this till 3:00AM I wasn't thinking clearly anymore. Maybe after some sleep ...
Thanks man
Crercio O. Silva / DBTools Development
http://www.dbtools.com.br
|
|
|
|