|
I use in dialog-based application ActiveX object (1) and in ActiveX object (1) second ActiveX object (2). I don`t use events from first ActiveX (1) in second ActiveX (2). Please, help me. Thanks.
Ivan
|
|
|
|
|
are you asking how to reflect a message from the activex object(2) that is embedded in activex object(1)?
where do you want to handle the messages?
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hello,
I don't manage to export a procedure from a DLL.
I created a Win32 Dynamic Link Library with a function which declaration is:
__declspec(dllexport) BOOL Ping(UINT uiTimeout);
When I look at the overview of my resulting dll, I can see my function 'Ping' in
the export table but I can't get its address from another project.
In my project, I load the dll thanks to 'AfxLoadLibrary' but when I use 'GetProcAddress'
to get the address of the 'Ping' function, I get a NULL pointer:
typedef BOOL (* PINGFUNCTION)(UINT);
HINSTANCE hDLL = AfxLoadLibrary(m_szControl);
if (hDLL)
{
// Get the address of the ping function
FARPROC pnProc = GetProcAddress((HMODULE) hDLL, "Ping");
PINGFUNCTION MyPingFunction = (PINGFUNCTION) pnProc;
if (! MyPingFunction)
{
return ((int) GetLastError());
}
}
|
|
|
|
|
i use:
extern "C" int __declspec(dllexport) __stdcall FuncName(param 1, param 2,etc)
the "int" is the data type returned from the function
works for me
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
How can I resize a DataGrid column
|
|
|
|
|
Hi there,
I'm using Access 2000 (mdb file) and connect it to my app. through ODBC Driver.
My problem is that in Access DB there is a field which is autonumber (which means that each new entry this fields gets : Last Entry value + 1).
How can i use this functionality in MFC ODBC when i add a new Record, ie :
m_pSet->AddNew (); and then ... ????
Thanks in advanced,
Ariel.
|
|
|
|
|
you just insert a new record and provide values and column names for each column in the table that requires one ... some are set to allow null while others are not (this is your choice as db designer) ... the autonumber field you don't even have to mention in the add statement as the db will do that for you ... you might need to read it back out after the add if you are updating multiple tables as part of the same action
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
First, Thank you very much for taking the time and answer my question - i really apritiate it !
Well, i just found that this was my error (linked a control to such autonumber field).
Second, I have another question if you can :
I have a table linked to another table by 1 to many, i cant insert a new row to the table because of this link - how can i link the data from the other table to the current one (i managed to fill the combo with all the other table entries but its still not connected) - how do i do it.
Thank you again,
Ariel.
|
|
|
|
|
the table on the one side of the one-to-many must be written to first so that the foreign key field (the many) in the other table can relate to that value ... this is called referentail integrity and ensures that you don't get orphaned records in one table that don't have a partner in a related table
for example, you have a customer record that has cust_id as a primary key and you have another table containing, say, physical address details that are linked to the customer table by the cust_id field ... in the address table cust_id is a foreign key ... the db won't allow you to insert an address record for a customer (cust_id) that doesn't exist in the customer table
unless you turn off the checking of course ... which is a BAD THING generally
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hi there,
First thank you for the answer.
Actually i know about the referentail integrity needed in a 1-to-many connection.
The thing is i don't know how to use it in actual user interface of MFC.
Lets Say as you said i have :
Table1.ID - connected in m_T1_ID linked to a CEdit Value : m_edtVal
Table1.Table2ID - connected in m_T1_T2_ID linked to a CComboBox Value : m_cmbVal
How can i put all Table2 Entries in m_cmbVal and put the Actual Table2.ID inside Table1.Table2ID ?
m_pSet->AddNew();
// Somwhere in here i should reference the 1-to-many, but how ???
Thank you for your answer,
Ariel.
|
|
|
|
|
Does static_cast<> produce any code or
class_A_ptr *a = static_cast < class_B_ptr * > (b);
is equal to
class_A_ptr *a = (class_B_ptr *)b;
?
With the best regards, Vitaly.
|
|
|
|
|
Testing with MS Visual C++, in release build, no difference, code size was the same either way.
|
|
|
|
|
the newstyle casts are basically the same as the oldstyle casts, except the results are more clearly defined.
(class_B_ptr*) is actually a combination of several kinds of casts, const_cast and static_cast depending on situation. there is also dynamic_cast and reinterpret_cast, which all do different things, and only very specific things (unlike the oldstyle casts which would often allow you to do something you didn't intend to do).
static_cast can sometimes generate code, for instance, when casting an object with multiple vtables, the vtable is adjusted when you cast it. but generally speaking it usually does not.
|
|
|
|
|
thanks a lot
With the best regards, Vitaly.
|
|
|
|
|
How could I close a modeless dialog from a view? This dialog is opened by a thread defined in the view (like as: AfxBeginThread(RUNTIME_CLASS(CThread)) ). The dialog isn´t defined in view, it´s defined in a CWinThread.
|
|
|
|
|
Do you want to hide it, or destroy it ? If you want to hide it, use ShowWindow(SW_HIDE), if you want to close it permanently, use DestroyWindow()
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
On clicking on an item of a tree I don´t get an answer until I click it tree times. How can I get it to answer on the first click? I treat it on "OnLButtonDown" and on "OnClick" but with the same result.
|
|
|
|
|
trap the TVN_SELCHANGED notification message
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
How could I from the cancel button from a dialog close all the program? Thanks
|
|
|
|
|
DoModal() will return IDCANCEL if the cancel button is clicked.
just post a WM_CLOSE message to your main window.
CMyDialog thedialog;
int returnvalue = thedialog.DoModal();
if (returnvalue == IDCANCEL)
AfxGetMainWnd()->PostMessage(WM_CLOSE);
else
...
|
|
|
|
|
Sorry, it´s me again. I desperately need a modeless dialog over a view WHILE it is filled with a treecontrol that is on view (the view is a CTreeView).
I create a modelees dialog before filling in the tree view, immediately I fill in the tree but the modeless dialog doesn´t come out on the screen until the tree hasn´t completely filled in and it is useless I can´t use it.
Could you help me to show modeless dialog correctly? Thanks. Could you explain it step by step?
|
|
|
|
|
I always do it in the constructor :
If (Create(pParent, IDD))
ShowWindow(SW_SHOW);
then I make my dialog a pointer, and call new on it when I want my dialog to appear. Depending on the dialog, I either delete and recreate, or use ShowWindow to hide and reshow it.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
ok, I have got the modeless but now I can´t click on any button of the modaless dialog while the tree is filling.
|
|
|
|
|
isnt this a threading issue? the view treectrl is not returning until it is filled in completely and so the dialog doesn't get its kick-off message ... maybe spin one of the tasks off into a separate thread and 2 things at once so to speak
alternatively you could post a message back to your main window or view or whatever after the initdialog has completed telling the view to build the tree now
or did i miss the point?
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
I coded an application using hook events but when I trace events in debug mode, only the events sent by this application are catched!! The application doesn't catch others events from Windows!!
My hook functions are in a dll, I don't understand!!
|
|
|
|