|
Hi,
Did you ever figure this out? I just ran into this problem... It started happening out of nowhere, and I'm not sure what I changed to get this to fail...
Cheers,
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
hello @all,
i have an mfc program and an access database. i connected them with odbc.
how can i make the following sql statement in my mfc programm?
'select distinct xy from mytable'
thank you very much.
mfc
|
|
|
|
|
Use CRecordset Open() member function.
|
|
|
|
|
thanks for reply, but it does not work. somewhere i make a mistake.
i want to read out 'xy' from a table 'mytable' and put these CString into a ComboBox:
Now i tried this:
<br />
CMyDatabase db;<br />
db.Open( CRecordset::dynaset,<br />
_T( "Select distinct xy from mytable" ) );<br />
<br />
db.MoveFirst();<br />
while(!db.IsEOF())<br />
{<br />
m_ctrlCombo.AddString(db.m_xy);<br />
db.MoveNext();<br />
}<br />
db.Close();<br />
UpdateData(false);<br />
i get the error, when i want to use this funktion. the error:
error with the call of a data record
thanks
mfc
|
|
|
|
|
you can use some SQL tools(such SQL Server's Query Analyzer) which can chech you SQL statement, go, if you SQL statement is right that you can see the result for you query.
My English is not good, but I can try my best for your problem.
hi
|
|
|
|
|
In my MFC dialog program, the main dialog is a property sheet, with various property pages. When the dialog is open, I want my program to do something special when the user presses (and releases) the space bar. Currently, I'm catching the WM_KEYUP message in my property sheet's PreTranslateMsg function, and returning true if the key is space (the OnKeyUp function doesn't work for some reason). Unfortunately, pressing space also activates the currently selected button, which I definitely don't want. How do I get around that?
Thanks!
|
|
|
|
|
I would say, you should override the OnKeyDown() function instead.
Within that function, check the nChar parameter, and if it is the keyboard button, do your thing, then exit without calling the base class implementation. Or call the baseclass implementation, but change the value of nChar to somnething else that wouldn't be a problem for you.
Get back to us on that, please.
Two Rivers!
|
|
|
|
|
I wasn't able to get my OnKeyUp/Down functions working (in the sheet OR page), so I'm just catching the WM_KEYUP/DOWN in PreTranslateMsg in the sheet.
I finally got it working, by returning true (that function) if the key was pressed down, and by performing the action when the key was released. I thought I tried that before, but oh well
Thanks for the reply!
|
|
|
|
|
I am not using MFC stuff at all. How would overriding OnKeyDown() work? Thanks for the answer.
Thanks
Sean
|
|
|
|
|
Well, you check the parameter passed to this function, and if it's a "whatever you want" you don't call the base class implementation, isntead call whatever you need.
I thoguh it would be pretty obvious"? After all, it's the point (and power) of C++ operator overloading.
|
|
|
|
|
I have a toolbar and am adding text labels to the buttons. The problem is that the toolbar is not sizing itself properly and the toolbar is still the size of a regular toolbar. How do I tell the toolbar to size properly?
-- Steve
|
|
|
|
|
Are you sending TB_AUTOSIZE to cause resizing of the toolbar, or sending TB_SETBUTTONSIZE before adding buttons? Also, are you using Win32, MFC, or WTL, and do you mean sizing verically (text below images) or horizontally (next to images)?
|
|
|
|
|
I'm using MFC and I need to resize the toolbar vertically. I am trying to create Internet Explorer-like buttons. I didn't have a problem in Win32, but MFC doesn't resize the toolbar automatically.
-- Steve
|
|
|
|
|
So did you try sending the messages mentioned in my last post?
|
|
|
|
|
Try:
m_wndToolBar.SetSizes (TOOLBAR_BUTTON_SIZE, TOOLBAR_BUTTON_IMAGE_SIZE);
|
|
|
|
|
Thanks. One more question, how do I check toolbar buttons when using CToolBar instead of CToolBarCtrl? It doesn't have a CheckButton() function.
-- Steve
|
|
|
|
|
You can always get the underlying CToolbarCtrl and call its member functions.
|
|
|
|
|
Is there a way i can check the items without mixing classes?
-- Steve
|
|
|
|
|
Err..
Have you actually read the MSDN docs?
Get it, it's worth it, or go on the net to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfcnotes_tn031.asp
Anyway, you won't be mixing classes. Here's a quote from those documentations:
CToolBar::GetToolBarCtrl, a member function new to MFC 4.0, allows you to take advantage of the Windows common control's support for toolbar customization and additional functionality. CToolBar member functions give you most of the functionality of the Windows common controls; however, when you call GetToolBarCtrl, you can give your toolbars even more of the characteristics of Windows 95 toolbars. When you call GetToolBarCtrl, it will return a reference to a CToolBarCtrl object. See CToolBarCtrl for more information about designing toolbars using Windows common controls. For more general information about common controls, seeCommon Controls in the Windows 95 SDK Programmer’s Reference.
Hope that helps. Essentially, there's no harm, as CToolBar are made from (or using) the CToolBarCtrl .
I suggest you go to the docs... you'll learn a heck lot more.
|
|
|
|
|
The link is out of date. I found the page with Google by enter "TN031 Control Bars".
|
|
|
|
|
Hi,
I need to know how to create an SDI within a MFC DLL so that another MFC Application can open it. Has anyone ever done something like this?
Thanks,
Melanie
|
|
|
|
|
I recommend a dialog box. Here are some useful articles on MFC DLLs.
http://www.mindcracker.com/mindcracker/c_cafe/dll.asp
Kuphryn
|
|
|
|
|
I have written 2 articles that cover this. One just does what you want, the other if a big extension of it:
Doc/View from dll[^]
Plug-In Architecture[^]
The first covers your immediate problem. The seconds allows future expansion to yuo application as well.
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
I would suggest that you rename your DLL's CChildFrm derived class to something different so that you can check that it is creating the type from the DLL. In all the projects I have done using this method, I have never had a specialised child frame in a DLL so far, but I wouldn't expect it to be a problem, as the document / view class's are being created correctly form the RUNTIME_CLASS information.
Sorry, I can't be of any more help in this one.
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
hi everyone,
i'm working on a sdi application with window's explorer style(i.e. a
sdi application with a vertical splitter, dividing the windows into 2
panes, left and right pane).
i added a command, named 'add info', to the main menu and added the event handler to 'add info'. the coding of the event handler of 'add info'
command is done in left pane class. what 'add info' command do is creating a dialog that collects inputs from users then store these user inputs into a database. i modified the contructor of the dialog for 'add info' to accept a database object pointer(get past from the left pane class, when the dialog object is created).
when i start the program, if the windows focus in on left pane, i was able to run 'add info' command, display the dialog, save the inputs from the dialog and store in the database without any problem.
the problem occurs when my window focus is on right pane, if i run
'add info', i get error 'Unhandled exception at 0x005832ba in myapp.exe: 0xC0000005: Access violation reading location 0x61636f4c.'
and the debugger points out that the program crashes at line 44 in objcore.cpp, within the function iskindof(.....)..
here is the function..
BOOL CObject::IsKindOf(const CRuntimeClass* pClass) const
{
ASSERT(this != NULL);
// it better be in valid memory, at least for CObject size
ASSERT(AfxIsValidAddress(this, sizeof(CObject)));
// simple SI case
CRuntimeClass* pClassThis = GetRuntimeClass();
return pClassThis->IsDerivedFrom(pClass);
}
after doing several tests, i found out that it was the database pointer, that get past from the left pane class to the dialog class, causing the problem.. strangely, the pointer doesn't cause any problem with left pane, but causing problems with right pane.. does anyone have any suggestion on fixing this?
thx in advance.
|
|
|
|