|
Hi,
I wrote some class that derived from the class CDialog.
In my new class i have some object control on some CList.
I also have some other class that have pointer to this CDialog - and in some place in the code - i call Create method of this CDialog - and ShowDialog.
Until here all work find. But when i press button RefreshList that belong to the derived class i see that the CList control object is null and i don't understand why
Can someone help me ?
Thanks
|
|
|
|
|
Do you mean CList as in a list of objects, or CListBox / CListCtrl?
If it's a list - do you mean NULL, or just empty? If it's NULL - then why are you using a pointer? And at what point do you create a new List to point to? If you don't create one, then of course it's NULL.
If you mean it's empty, then do you put things into it? And if you do, look for any code that removes them.
If you mean a control, then you need to point the object at a window. Look up DDX_Control in the help files for information.
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Do you have any call this object of other place except this dialog?
|
|
|
|
|
No - only calling this object in pressing dlg button ( in same class )
|
|
|
|
|
So did you use of pointers on your project?
|
|
|
|
|
Hi all
I have a rather strange requirement . My current feeling is Shell Programming but not sure what I have to do ..
Well ,
Is there any way to launch IE proxy setting dialog(IE->Tools menu ->internet options->connections tap ->LAN settings) from .net application ? the requirement is proxy setting dialog box alone should popup(not along with IE) if we click a button in the application. In fact I saw some Win32 APIs like WinHttpGetProxyForUrl ..are avilable to get/set the same but I prefer the "original IE dialog" to appear and get set .
Could any of you please throw some light on this ? Is it possible in the first place ?
Thank you in advance for your help.
regards
Bala
|
|
|
|
|
Bala.A wrote: from .net application
You'll get more help in one of the .net forums. If you've posted this question in 17 different forums, then you're a very naughty boy.
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Hello everyone,
1. Generally speaking using GetProcAddress through ordinal is faster than through name, right?
2. Why?
thanks in advance,
George
|
|
|
|
|
George_George wrote: Generally speaking using GetProcAddress through ordinal is faster than through name, right?
If you mean that strcmp is slower than indexing an array I agree. But I don't think this kind of optimization really matters in applications.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Thanks CPallini,
I ask this question only for pure technical interest. Do you mean in your experience or in theory by ordinal is faster? Why?
regards,
George
|
|
|
|
|
George_George wrote: Do you mean in your experience or in theory by ordinal is faster? Why?
I've no big experience of DLL calls via GetProcAddress since I usually use load time linking approach.
Anyway I never experience performance issues.
My previous post points out that lookup using integers is usually faster that the one using strings, but, IMHO the performance improvement is usually negligible.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
1.
You mean you use implicit linking to link with import library?
CPallini wrote: use load time linking approach
2.
If we use the approach as you used above, to link with import library, in this approach, there is no ways to use by ordinal technique?
regards,
George
|
|
|
|
|
George_George wrote: If we use the approach as you used above, to link with import library, in this approach, there is no ways to use by ordinal technique?
No, as the functions will be called via the linked stubs in the library.
I have never tried to explicitly load a DLL which has already been loaded by its lib.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Thanks jhwurmbach,
From your reply, I understand by ordinal only works when we use LoadLobrary, if we use implicit linking, there is no way to use by ordinal.
regards,
George
|
|
|
|
|
in implicit linking, linker generates export library, then it will do in the optimised possible way right? why do you think implicit linking is not using ordinal, it gives a stub which internally uses ordinal values to link. That is why normally if you rebuild DLL, u need to rebuild the application too, if it looks up using name rebuilding is not needed.
George_George wrote: if we use implicit linking, there is no way to use by ordinal.
DEF files if you need to set ordinals explicitly
see this quote
"Implicit linking looks up based on the ordinal, so ideally a function's ordinal should always stay the same. Unless you specify your own ordinals the linker may generate different ordinals each time you build your application. This in turn means that Applications which have already been built to use your DLL may cease to link correctly."
from
DLL linking[^]
u may get more info if u searched on web.
|
|
|
|
|
Thanks Rajkumar,
I think it means when using implicit linking, ordinal of DLL exported function is built into EXE. EXE is using the ordinal value to look into related address array of exported function of the DLL to invoke related function, right?
Rajkumar R wrote: Implicit linking looks up based on the ordinal,
regards,
George
|
|
|
|
|
George_George wrote: ordinal of DLL exported function is built into EXE.
in a way yes, as the export library stub is linked to exe.
export library is generated through linker switch, it uses DEF files and /or dllexport keywords.
DEF files can be used to override the automatically generated ordinals, and as names can be used in DEF files, i think in that case export library uses names to link. But by default dllexport and export library uses ordinals.
|
|
|
|
|
Thanks Rajkumar,
When using implicit linking, to use the function exported by DLL, is there any way to use by ordinal other than use by name?
regards,
George
|
|
|
|
|
I think u got confused,
simply using implicit linking by dllexport keyword uses ordinals,
u can use DEF files while using implicit linking to give a constant ordinals inplace of automatically generated ordinals.
|
|
|
|
|
Thanks Rajkumar,
Rajkumar R wrote: u can use DEF files while using implicit linking to give a constant ordinals inplace of automatically generated ordinals.
It is for DLL provider. My question is, could DLL comsumer use ordinal to invoke function exported by DLL other than by name, for example providing ordinal as input parameter?
regards,
George
|
|
|
|
|
I don't want to trace the post that u have posted and CPallini had replied that using GetProcAddress u can pass the ordinals, i think u have no doubts in this,
And in implicit linking, export library take care of linking, u just want to link to the export library. And as we discussed export library uses ordinals, normally automatically generated ordinals, so u don't know the ordinal to call it, and if u still want implicit linking(then calling by GetProcAddress is called explicit linking)and use call by ordinal u need to set ordinals by using DEF files(as u mentioned DLL provider) so that u know the ordinals(linker don't use the generated ordinal)u can call it.
I mentioned DEF files because then only u know the exact ordinal as by default linker generates.
modified on Tuesday, February 12, 2008 4:25 AM
|
|
|
|
|
Thanks Rajkumar,
I think my question should be answered. Let me summarize your points,
1. To use implicit linking, we can assign ordinal by using .DEF files, but for DLL consumer, it has to invoke DLL exported function by name other than by ordinal;
2. To use dynamic loading, i.e. GetProcAddres, as DLL provider, we can not only assign ordinal by using .DEF files, but also as DLL consumer provide ordinal as input parameter.
My understanding correct?
regards,
George
|
|
|
|
|
|
Cool, Rajkumar! Great!!
A question about http://msdn2.microsoft.com/en-us/library/aa271769(VS.60).aspx[^],
Seem if we do not use dllimport there will be one more level of indirection and the root cause is we do not know the address of function from IAT if we do not use dllimport, right?
What is the obstacle of blocking the approach (not using dllimport) from knowing the function address in IAT? From the MSDN, I can not see why if we use dllimport, the IAT can be known and if we do not use IAT the address is not known.
I think the IAT is contained in the import library file (.lib file), and whether or not we are using dllimport, it is input to linker, right (so it is always known)?
regards,
George
|
|
|
|
|
|