|
I find that if the UI thread is block. it will be blocked when call CListCtrl::GetItemCount().
I want to know how the MFC low level to achieve this function?
If I use the MsgWaitForMultiObjects to block UI thread. How to set the QS_ALLINPUTS?
|
|
|
|
|
I'm not sure if I understand you correctly.
But you can see how wait functions work here - Halt! Who Goes There?[^]
|
|
|
|
|
Low level of MFC is the Win32 API. Open the context menu by right clicking on a call to CListCtrl::GetItemCount() and choose 'Go to definition'. You will see that it is an inline function that sends the LVM_GETITEMCOUNT message to the list control window. This message is not processed while your GUI thread is blocked.
A general rule is: Never block GUI threads. If you have to wait for events, do this in worker threads.
|
|
|
|
|
Hi Jochen Arndt,
You are very nice. But why I cannot see the source code of CListCtrl::GetItemCount()?
My develop tools is visual studio 2008.
|
|
|
|
|
I don't know why. You may also place the cursor on the call and press F12. With VS 2003 here, the MFC CListCtrl::GetItemCount() code is located in the VC subdirectory atlmfc\include\afxcmn.inl.
I suggested to look on the MFC sources so that you can see that most functions will only (or besides other tasks) just send messages.
If you don't have used the 'Go to definition' feature so far, give it a try. It is very useful. Not only for MFC functions, but also for your own ones to quickly see the source.
|
|
|
|
|
Thank you Jochen Arndt
I search the visual studio installed folder, and then find this file. It's greatly thing to see the MFC controls source.
|
|
|
|
|
plz i want a code that detect if an image is RGB or not
|
|
|
|
|
|
Hi All,
Can any one help me out to work on zlib compression.
Thanks in advance!
|
|
|
|
|
Start here[^], and study the documentation.
|
|
|
|
|
This question is both vague and applicable to that very specific library. Why don't you read the manual and come back with more specific questions?
|
|
|
|
|
hi every one ...
i have written com dll i want to debug the dll i dont how to do it .
please reply
Best Regards
sarfaraz
|
|
|
|
|
hi every one ...
i have written com dll i want to debug the dll i dont how to do it .
please reply
Best Regards
sarfaraz
|
|
|
|
|
1) Write a exe program that uses your COM.
2) Launch the exe.
3) Open your COM Project is Visual Studio
4) Attach the already running exe with the Project.
5) Keep the break points and start debugging it.
|
|
|
|
|
see am not able to understand the 4th step.
attach in the sense by changing the configuration properties in that debugging and then
command and passing the path of the exe. if this the way then its control not coming to break point or i may be wrong to the exe ....
Best Regards
Sarfaraz
|
|
|
|
|
You can debug your code by loading the DLL directly into your application rather than using it in registered mode: see the CoLoadLibrary function[^].
|
|
|
|
|
hi ,thanks ...
one more thing i want to ask how to register the dll .
am getting the error message that DLL has loaded but entry point DllRegisterserver was not found ...
but am wtritten the code for it
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
HRESULT hr = RegisterServer (AfxGetInstanceHandle(), CLSID_CCmpnt, g_szFriendlyName, g_szVerIndProgID, g_szVerDndProgID);
return hr;
its in a function name STDAPI DllRegisterServer(void)
the control not coming in this function what might be cause please reply
Best Regards
Sarfaraz
|
|
|
|
|
|
STDAPI DllRegisterServer(void) this i used
in this only i written the code
|
|
|
|
|
Used where? Please show the actual declaration. Also make sure that you are exporting this correctly in your build.
|
|
|
|
|
hi thanks again now its getting register. i was not exporting correctly ..
The dll i wrote for the context menu this is done in 32 bit machine but in 64 bit machine the context menu is not coming ...
what might be the problem
|
|
|
|
|
sarfaraznawaz wrote: the context menu is not coming ...
what might be the problem Any one of a million things. As I just said to someone else in these forums, you need to give specific details, don't expect people to be able to guess what is happening in your code.
|
|
|
|
|
ok sorry ..
the code i build in 32 bit its success but when i configure the VS 2010 for 64 bit the error message con not instantiate the
HRESULT IContextMenu::GetCommandString(UINT_PTR,UINT,UINT *,LPSTR,UINT)' : is abstract
see declaration of 'IContextMenu::GetCommandString'
why this conflict
|
|
|
|
|
No idea, once again there is not enough information for me to guess.
|
|
|
|
|
In DLL i have written the code for Context menu in vs2010 using COM
i derived the class CRsEraser : public IContextMenu, public IShellExtInit
this IShellExtInit and IContextMenu is are com class
when use it
HRESULT __stdcall CCmpntFactory::CreateInstance (IUnknown *pUnknownOuter, const IID& iid, void** ppv)
{
if(pUnknownOuter != NULL)
return CLASS_E_NOAGGREGATION;
CRsEraser *pCmpnt = new CRsEraser;
if (pCmpnt == NULL)
return E_OUTOFMEMORY;
HRESULT hr = pCmpnt->QueryInterface (iid, ppv);
//////////////////////////////////////////////////////////////////////////
// Release the IUnknown pointer
pCmpnt->Release ();
return hr;
}
CRsEraser *pCmpnt = new CRsEraser;this part showing its abstract class .
in 32 bit compile its working fine same when configure to 64 bit its throwing the error what i have mention earlier .
how i configure:
1 Open your Visual C++ Solution
2 Choose Build->Configuration Manager menu
3 Inside the Configuration Manager window, change the ‘Active solution platform’ to x64. If you don’t have any, you would need to create one by selecting the ‘New..’ drop down item. Copy settings from your Win32 platform.
4 Now rebuild your solution.
|
|
|
|